我已经配置了gitlab ci / cd管道,以便当某人合并到Development分支时,gitlab为stag环境和prod环境进行两个构建,然后根据环境将war包上传到两个s3位置
image: registry.gitlab.com/group/project/imangename:latest
stages:
- build
- deploy
before_script:
- chmod +x mvnw
- export JAVA_HOME="/opt/jdk1.8.0_131"
build_stag:
stage: build
script:
- ./mvnw clean
- ./mvnw -Pstag package -DskipTests
artifacts:
paths:
- target/ROOT.war.original
- scripts/*
- appspec.yml
only:
- Development
deploy_stag:
stage: deploy
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
script:
- cp target/ROOT.war.original target/ROOT.war
- apt-get install zip -y
- zip MyApplication.zip appspec.yml scripts/stop_application scripts/start_application scripts/basic_health_check.sh
- aws s3 cp MyApplication.zip s3://stag-bins/
only:
- Development
build_prod:
stage: build
script:
- ./mvnw clean
- ./mvnw -Pprod package -DskipTests
artifacts:
paths:
- target/ROOT.war.original
- scripts/*
- appspec.yml
only:
- Development
deploy_prod:
stage: deploy
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest # see the note below
script:
- cp target/ROOT.war.original target/ROOT.war
- apt-get install zip -y
- zip MyApplication.zip appspec.yml scripts/stop_application scripts/start_application scripts/basic_health_check.sh prod.xml
- aws s3 cp MyApplication.zip s3://prod-bins/
only:
- Development
我希望在stag构建结束后立即在指定的s3位置看到stag二进制文件。但是事实证明,只有在prod构建结束时才能看到stag二进制文件。 stag构建完成后,是否可以上传stag二进制文件,而无需等待prod构建完成?