我正在尝试运行一个gitlab
阶段(provision-runner
),但是此此阶段必须仅在另一阶段(install-terraform
)完成后才能运行 。因此,此阶段取决于此。
因此,我想仅在 provision-runner
完成后才运行install-terraform
阶段。
provision-runner
//this should run second
provision-runner:
stage: provision-runner
script:
- cd runner
- terraform init
- terraform plan
- terraform apply --auto-approve
install-terraform
//this should run first
install_terraform:
stage: install-terraform
script:
- export VER="0.12.9"
- wget https://releases.hashicorp.com/terraform/${VER}/terraform_${VER}_linux_amd64.zip
- unzip terraform_${VER}_linux_amd64.zip
- sudo mv terraform /usr/local/bin/
- which terraform
install_terraform
阶段应始终在provision-runner
之前首先运行。您可能会问,为什么不把它放在第一位。我知道,但是我想用另一种方式做。因此,在provision-runner
发生之前,它总是执行阶段install_terraform