Skip to content
Snippets Groups Projects
Commit 8ea73efb authored by Bo-Chun Chen's avatar Bo-Chun Chen
Browse files

Update gitlab ci stages

parent aa9a96d6
2 merge requests!6Add CD feature to the repo,!1wip: test-keypair without file
Pipeline #7892 failed
...@@ -16,35 +16,31 @@ cache: ...@@ -16,35 +16,31 @@ cache:
- terraform.tfstate - terraform.tfstate
stages: # List of stages for jobs, and their order of execution stages: # List of stages for jobs, and their order of execution
- validate
- build - build
- test
- deploy - deploy
build_packer: tf-validate:
stage: build stage: build
tags: [build] tags: [build]
script: script:
- terraform --version - terraform --version
- terraform init - terraform init
- terraform apply --auto-approve - terraform validate
- terraform plan
unit-test-job: # This job runs in the test stage. tf-apply:
stage: test # It only starts when the job in the build stage completes successfully. stage: build
tags: [build]
script: script:
- echo "Running unit tests... This will take about 60 seconds." - export BUILD_DATE=$(TZ=America/Chicago date +%Y%m%d)
- sleep 60 - export TF_VAR_internal_network="tf-clusternet-$BUILD_DATE"
- echo "Code coverage is 90%" - export TF_VAR_external_network="tf-dmznet-$BUILD_DATE"
- terraform apply -auto-approve
lint-test-job: # This job also runs in the test stage. clean-up:
stage: test # It can run at the same time as unit-test-job (in parallel). stage: cleanup
tags: [build]
script: script:
- echo "Linting code... This will take about 10 seconds." - terraform destroy -auto-approve
- sleep 10
- echo "No lint issues found."
deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
environment: production
script:
- echo "Deploying application..."
- echo "Application successfully deployed."
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment