有没有办法 deploy-prod 我的GitLab管道中的作业 main 在特定的版本标记处分支,而不是总是提取最新的代码?这里$VERSION_NUMBER是管道中可用的变量
deploy-prod
main
deploy-prod: tags: - prod-runner image: docker.xxx/nodejs:14 stage: deploy-prod environment: name: prod script: - npm install - npx sequelize-cli db:migrate when: manual rules: - if: $VERSION_NUMBER != ''
你可以跑步 before_script 要获取所有标记并在脚本中通过传递 VERSION_NUMBER 。
before_script
VERSION_NUMBER
before_script: - git fetch --tags script: - git checkout tags/${VERSION_NUMBER} # Your commands here...