问:Gitlab CI 谁重试旧管道
Q : Gitlab CI who to retry older pipeline
我第一次在重试具有 4 个阶段且每个阶段有 1 个作业的旧管道时遇到故障,当管道仅重试步骤 4 和步骤 1 时 运行
我的.git实验室-ci.yml
stages:
- build
- deploy
- clean
before_script:
…
variables:
GIT_SUBMODULE_STRATEGY: recursive
GIT_STRATEGY: clone
build:
stage: build
script:
- git submodule init
- git submodule update -f
allow_failure: false
when: manual
only:
- master
production:
stage: deploy
script:
- ssh $DEPLOY_SERVER_USER@$DEPLOY_SERVER_ADDRESS "[ -f /usr/bin/rsync ] || apt-get install -qq -y rsync && [ -f /usr/bin/getfacl ] …. »
allow_failure: false
rollback:
stage: clean
script:
- ssh $DEPLOY_SERVER_USER@$DEPLOY_SERVER_ADDRESS "[ -d /var/www/old/ ] … exit 1"
when: on_failure
allow_failure: false
cleanup:
stage: clean
script:
- ssh $DEPLOY_SERVER_USER@$DEPLOY_SERVER_ADDRESS "rm -rf /var/www/old && rm -rf /var/www/new && rm -rf /var/www/acl"
when: on_success
allow_failure: false
或者在我的 git 工作流程中将我的 master 恢复到所需的提交不是更合乎逻辑吗?
是的,正确的方法是先还原代码,然后 运行 再次管道。
但在某些情况下我们没有时间修复代码,我们需要进行紧急回滚。
但是看看你的管道,你的步骤构建是没有用的。
您也需要将 git submodule
命令移动到其他步骤,因为其他作业只使用您的原始代码,没有子模块的内容
我第一次在重试具有 4 个阶段且每个阶段有 1 个作业的旧管道时遇到故障,当管道仅重试步骤 4 和步骤 1 时 运行
我的.git实验室-ci.yml
stages: - build - deploy - clean before_script: … variables: GIT_SUBMODULE_STRATEGY: recursive GIT_STRATEGY: clone build: stage: build script: - git submodule init - git submodule update -f allow_failure: false when: manual only: - master production: stage: deploy script: - ssh $DEPLOY_SERVER_USER@$DEPLOY_SERVER_ADDRESS "[ -f /usr/bin/rsync ] || apt-get install -qq -y rsync && [ -f /usr/bin/getfacl ] …. » allow_failure: false rollback: stage: clean script: - ssh $DEPLOY_SERVER_USER@$DEPLOY_SERVER_ADDRESS "[ -d /var/www/old/ ] … exit 1" when: on_failure allow_failure: false cleanup: stage: clean script: - ssh $DEPLOY_SERVER_USER@$DEPLOY_SERVER_ADDRESS "rm -rf /var/www/old && rm -rf /var/www/new && rm -rf /var/www/acl" when: on_success allow_failure: false
或者在我的 git 工作流程中将我的 master 恢复到所需的提交不是更合乎逻辑吗?
是的,正确的方法是先还原代码,然后 运行 再次管道。
但在某些情况下我们没有时间修复代码,我们需要进行紧急回滚。
但是看看你的管道,你的步骤构建是没有用的。
您也需要将 git submodule
命令移动到其他步骤,因为其他作业只使用您的原始代码,没有子模块的内容