如何在gitlab中为一个阶段设置手动批准?
How to set manual approval for a stage in gitlab?
我有一些相关的阶段和工作。
install-rpm:
stage: deployrpm
allow_failure: true
extends:
- .iftestawsdeploy
image:
name: amazon/aws-cli
entrypoint: [""]
variables:
terraform_version: 1.1.7
terragrunt_version: 0.36.6
kubectl_version: 1.21.11
before_script:
- *install_dependencies
- *install_myproject_rpm
script:
- *run_myproject_deploy
- exit 0
after_script:
- *forward_myproject_resources
- ls dist1
- exit 0
artifacts:
paths:
- ./dist1
tags:
- ec2runner
cleanup-aws:
stage: cleanup
allow_failure: true
extends:
- .iftestawsdeploy
image:
name: amazon/aws-cli
entrypoint: [""]
variables:
terraform_version: 1.1.7
terragrunt_version: 0.36.6
kubectl_version: 1.21.11
before_script:
- *install_dependencies
- *install_myproject_rpm
- *use_myproject_resources
script:
- *teardown_myproject
after_script:
- *nuke_SUB_AWS_resources
tags:
- dev
我想在上面的作业清理或清理阶段之前设置一个选项,这样当前面的阶段完成时,这个 job/stage 应该等到有人点击继续或批准按钮。
这样,如果部署出现任何故障,我们可以执行研发任务,稍后我们可以恢复清理任务。
请建议如何设置。
在您要手动启动的阶段之前创建一个阶段,并在该阶段创建一个手动作业。
stages:
# ...
- cleanup_approval
- cleanup
manual_cleanup:
# this job must be run manually to allow cleanup stage to run
stage: cleanup_approval
when: manual
script:
- echo noop
allow_failure: false
cleanup-aws:
stage: cleanup
# runs after `manual_cleanup` job in the previous stage has been manually run
# ...
我有一些相关的阶段和工作。
install-rpm:
stage: deployrpm
allow_failure: true
extends:
- .iftestawsdeploy
image:
name: amazon/aws-cli
entrypoint: [""]
variables:
terraform_version: 1.1.7
terragrunt_version: 0.36.6
kubectl_version: 1.21.11
before_script:
- *install_dependencies
- *install_myproject_rpm
script:
- *run_myproject_deploy
- exit 0
after_script:
- *forward_myproject_resources
- ls dist1
- exit 0
artifacts:
paths:
- ./dist1
tags:
- ec2runner
cleanup-aws:
stage: cleanup
allow_failure: true
extends:
- .iftestawsdeploy
image:
name: amazon/aws-cli
entrypoint: [""]
variables:
terraform_version: 1.1.7
terragrunt_version: 0.36.6
kubectl_version: 1.21.11
before_script:
- *install_dependencies
- *install_myproject_rpm
- *use_myproject_resources
script:
- *teardown_myproject
after_script:
- *nuke_SUB_AWS_resources
tags:
- dev
我想在上面的作业清理或清理阶段之前设置一个选项,这样当前面的阶段完成时,这个 job/stage 应该等到有人点击继续或批准按钮。 这样,如果部署出现任何故障,我们可以执行研发任务,稍后我们可以恢复清理任务。 请建议如何设置。
在您要手动启动的阶段之前创建一个阶段,并在该阶段创建一个手动作业。
stages:
# ...
- cleanup_approval
- cleanup
manual_cleanup:
# this job must be run manually to allow cleanup stage to run
stage: cleanup_approval
when: manual
script:
- echo noop
allow_failure: false
cleanup-aws:
stage: cleanup
# runs after `manual_cleanup` job in the previous stage has been manually run
# ...