Skip to content
Snippets Groups Projects

wip: test-keypair without file

Closed Krish Moodbidri requested to merge feat-test-keypair into feat-deploy-xdmod-supremm
Compare and Show latest version
1 file
+ 5
1
Compare changes
  • Side-by-side
  • Inline
+ 38
21
@@ -7,38 +7,55 @@ variables:
OS_IDENTITY_API_VERSION: "3"
OS_AUTH_TYPE: "v3applicationcredential"
OS_AUTH_URL: "https://keystone.cloud.rc.uab.edu:5000/v3"
TF_ROOT: ${CI_PROJECT_DIR}/
TF_VAR_internal_network: "xdmod-packer-clusternet"
TF_VAR_external_network: "xdmod-packer-dmznet"
TF_VAR_flavor: "m1.medium"
GIT_SUBMODULE_STRATEGY: "recursive"
GIT_SUBMODULE_UPDATE_FLAGS: "--force"
cache:
paths:
- .terraform
- .terraform.lock.hcl
- terraform.tfstate
stages: # List of stages for jobs, and their order of execution
- validate
- build
- test
- deploy
- cleanup
build_packer:
stage: build
tf-validate:
stage: validate
tags: [build]
script:
- cd CRI_XCBC && git checkout dev && cd ..
- terraform --version
- terraform init
- terraform apply
unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
script:
- echo "Running unit tests... This will take about 60 seconds."
- sleep 60
- echo "Code coverage is 90%"
- terraform validate
- pwd
- terraform plan
- 'sed -i -E "s/(cod_deploy: ).*/\1false/" CRI_XCBC/group_vars/all'
lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
tf-apply:
cache:
paths:
- .terraform/
stage: build
tags: [build]
script:
- echo "Linting code... This will take about 10 seconds."
- sleep 10
- echo "No lint issues found."
- export BUILD_DATE=$(TZ=America/Chicago date +%Y%m%d%H%M%S)
- XDMOD_IMAGES=($(openstack image list --sort-column Name --sort-descending -f value -c Name -c ID | grep -P ' xdmod-\d{14}$' | awk '{print $2}'))
- export TF_VAR_image_ohpc="${XDMOD_IMAGES[0]}"
# - export TF_VAR_image_ohpc="xdmod-20230629191611"
- echo $TF_VAR_image_ohpc
- export TF_VAR_keypair_name="os-gen-keypair-$BUILD_DATE"
- terraform apply -auto-approve || terraform destroy -auto-approve
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
clean-up:
stage: cleanup
tags: [build]
script:
- echo "Deploying application..."
- echo "Application successfully deployed."
- terraform destroy -auto-approve
when: manual
Loading