ci: render
Rendered by https://gitlab.com/developerdurp/yml/-/pipelines/1279031201
This commit is contained in:
@@ -31,6 +31,15 @@
|
||||
- name: docker:dind
|
||||
entrypoint: ["dockerd-entrypoint.sh", "--tls=false"]
|
||||
script:
|
||||
# Begin of version.sh
|
||||
- |
|
||||
#check for Version variable
|
||||
if [ -z "${VERSION}" ]; then
|
||||
# If not, assign a default value
|
||||
VERSION=$CI_COMMIT_SHORT_SHA
|
||||
fi
|
||||
# End of version.sh
|
||||
|
||||
# Begin of build.sh
|
||||
- |
|
||||
#Build Docker Container
|
||||
@@ -39,6 +48,10 @@
|
||||
docker build -t $containername .
|
||||
docker save -o $CI_PROJECT_DIR/packages/$containername.$VERSION.tar.gz $containername
|
||||
# End of build.sh
|
||||
artifacts:
|
||||
expire_in: 1 hour
|
||||
paths:
|
||||
- $CI_PROJECT_DIR/packages
|
||||
.docker_push_gitlab:
|
||||
image: registry.internal.durp.info/docker:20.10.17
|
||||
variables:
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
cd $WORKDIR
|
||||
# End of cd-workdir.sh
|
||||
|
||||
# Begin of terraform-fmt.sh
|
||||
# Begin of fmt.sh
|
||||
- |
|
||||
#Terraform fmt
|
||||
terraform fmt -diff -check -write=false
|
||||
# End of terraform-fmt.sh
|
||||
# End of fmt.sh
|
||||
.terraform_validate:
|
||||
script:
|
||||
# Begin of cd-workdir.sh
|
||||
@@ -19,13 +19,13 @@
|
||||
cd $WORKDIR
|
||||
# End of cd-workdir.sh
|
||||
|
||||
# Begin of terraform-init.sh
|
||||
# Begin of init.sh
|
||||
- "#Terraform init \nterraform init -reconfigure -backend-config=\"address=${GITLAB_TF_ADDRESS}\" -backend-config=\"lock_address=${GITLAB_TF_ADDRESS}/lock\" -backend-config=\"unlock_address=${GITLAB_TF_ADDRESS}/lock\" -backend-config=\"username=gitlab-ci-token\" -backend-config=\"password=${CI_JOB_TOKEN}\" -backend-config=\"lock_method=POST\" -backend-config=\"unlock_method=DELETE\" -backend-config=\"retry_wait_min=5\" \n"
|
||||
# End of terraform-init.sh
|
||||
# End of init.sh
|
||||
|
||||
# Begin of terraform-validate.sh
|
||||
# Begin of validate.sh
|
||||
- "#Terraform validate\nterraform validate \n"
|
||||
# End of terraform-validate.sh
|
||||
# End of validate.sh
|
||||
.terraform_plan:
|
||||
variables:
|
||||
PLAN: plan.tfplan
|
||||
@@ -37,13 +37,13 @@
|
||||
cd $WORKDIR
|
||||
# End of cd-workdir.sh
|
||||
|
||||
# Begin of terraform-init.sh
|
||||
# Begin of init.sh
|
||||
- "#Terraform init \nterraform init -reconfigure -backend-config=\"address=${GITLAB_TF_ADDRESS}\" -backend-config=\"lock_address=${GITLAB_TF_ADDRESS}/lock\" -backend-config=\"unlock_address=${GITLAB_TF_ADDRESS}/lock\" -backend-config=\"username=gitlab-ci-token\" -backend-config=\"password=${CI_JOB_TOKEN}\" -backend-config=\"lock_method=POST\" -backend-config=\"unlock_method=DELETE\" -backend-config=\"retry_wait_min=5\" \n"
|
||||
# End of terraform-init.sh
|
||||
# End of init.sh
|
||||
|
||||
# Begin of terraform-plan.sh
|
||||
# Begin of plan.sh
|
||||
- "#Terraform plan \napk add --update curl jq\nalias convert_report=\"jq -r '([.resource_changes[].change.actions?]|flatten)|{\\\"create\\\":(map(select(.==\\\"create\\\"))|length),\\\"update\\\":(map(select(.==\\\"update\\\"))|length),\\\"delete\\\":(map(select(.==\\\"delete\\\"))|length)}'\"\nterraform plan -out=$PLAN $ARGUMENTS\nterraform show --json $PLAN | convert_report > $JSON_PLAN_FILE\n"
|
||||
# End of terraform-plan.sh
|
||||
# End of plan.sh
|
||||
artifacts:
|
||||
reports:
|
||||
terraform: $WORKDIR/$JSON_PLAN_FILE
|
||||
@@ -55,15 +55,15 @@
|
||||
cd $WORKDIR
|
||||
# End of cd-workdir.sh
|
||||
|
||||
# Begin of terraform-init.sh
|
||||
# Begin of init.sh
|
||||
- "#Terraform init \nterraform init -reconfigure -backend-config=\"address=${GITLAB_TF_ADDRESS}\" -backend-config=\"lock_address=${GITLAB_TF_ADDRESS}/lock\" -backend-config=\"unlock_address=${GITLAB_TF_ADDRESS}/lock\" -backend-config=\"username=gitlab-ci-token\" -backend-config=\"password=${CI_JOB_TOKEN}\" -backend-config=\"lock_method=POST\" -backend-config=\"unlock_method=DELETE\" -backend-config=\"retry_wait_min=5\" \n"
|
||||
# End of terraform-init.sh
|
||||
# End of init.sh
|
||||
|
||||
# Begin of terraform-apply.sh
|
||||
# Begin of apply.sh
|
||||
- |
|
||||
#Terraform validate
|
||||
terraform apply -auto-approve $ARGUMENTS
|
||||
# End of terraform-apply.sh
|
||||
# End of apply.sh
|
||||
.terraform_destroy:
|
||||
script:
|
||||
# Begin of cd-workdir.sh
|
||||
@@ -72,12 +72,12 @@
|
||||
cd $WORKDIR
|
||||
# End of cd-workdir.sh
|
||||
|
||||
# Begin of terraform-init.sh
|
||||
# Begin of init.sh
|
||||
- "#Terraform init \nterraform init -reconfigure -backend-config=\"address=${GITLAB_TF_ADDRESS}\" -backend-config=\"lock_address=${GITLAB_TF_ADDRESS}/lock\" -backend-config=\"unlock_address=${GITLAB_TF_ADDRESS}/lock\" -backend-config=\"username=gitlab-ci-token\" -backend-config=\"password=${CI_JOB_TOKEN}\" -backend-config=\"lock_method=POST\" -backend-config=\"unlock_method=DELETE\" -backend-config=\"retry_wait_min=5\" \n"
|
||||
# End of terraform-init.sh
|
||||
# End of init.sh
|
||||
|
||||
# Begin of terraform-destroy.sh
|
||||
# Begin of destroy.sh
|
||||
- |
|
||||
#Terraform validate
|
||||
terraform destroy -auto-approve $ARGUMENTS
|
||||
# End of terraform-destroy.sh
|
||||
# End of destroy.sh
|
||||
|
||||
Reference in New Issue
Block a user