【发布时间】:2021-11-17 08:14:41
【问题描述】:
说明
正如我从 this Stackoverflow question 和 Gitlab-CI official documentation 中发现的那样,通过使用 tags 关键字,可以为单个项目触发不同的运行器。所以我在我的服务器上注册了不同的运行器(每个(暂存和生产)服务器一个运行器),带有dashboard_staging 和dashboard_production 标签名称。
一切正常,为了正确启动 gitlab-runner,我执行了以下命令:
sudo gitlab-runner verify # Everything was ok
sudo gitlab-runner start # It was started successfully on both servers
然后我已经提交了更改并将它们推送到 Gitlab 上并成功触发。
问题
- 我已执行上述命令,但其中一条管道仍在等待运行器。
- 由于
build阶段尚未完全完成,因此其工作已完成的标签不会继续。
代码
stages:
- test
- build
- deploy
cache:
untracked: true
key:
files:
- yarn.lock
paths:
- node_modules/
- .yarn
dashboard:test:staging:
stage: test
tags:
- dashboard_staging
when: manual
before_script:
- echo "do sth"
only:
- staging
except:
changes:
- 'docker/**/*'
- '*.md'
script:
- echo "do sth"
dashboard:test:production:
stage: test
tags:
- dashboard_production
when: manual
before_script:
- echo "do sth"
only:
- staging
except:
changes:
- 'docker/**/*'
- '*.md'
script:
- echo "do sth"
dashboard:build:staging:
stage: build
tags:
- dashboard_staging
only:
- staging
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- echo "do sth"
dashboard:build:production:
stage: build
tags:
- dashboard_production
only:
- staging
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- echo "do sth"
dashboard:deploy:staging:
stage: deploy
tags:
- dashboard_staging
except:
changes:
- 'docker/**/*'
- '*.md'
only:
- staging
before_script:
- echo "do sth"
script:
- echo "do sth"
dashboard:deploy:production:
stage: deploy
tags:
- dashboard_production
except:
changes:
- 'docker/**/*'
- '*.md'
only:
- staging
before_script:
- echo "do sth"
script:
- echo "do sth"
问题
- 如何在
Deploy阶段解决这个待处理的问题?
- 有没有办法让定义的标签彼此独立运行?
【问题讨论】:
标签: gitlab-ci