Skip to content

Commit

Permalink
Hotfix/fix cookiecutter pact and vault flags (#37)
Browse files Browse the repository at this point in the history
* Fix cookiecutter Pact and Vault flags
  • Loading branch information
daniele-20tab authored Nov 28, 2022
1 parent 35e3a66 commit c5f653f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions bootstrap/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ def init_service(self):
"terraform_backend": self.terraform_backend,
"terraform_cloud_organization": self.terraform_cloud_organization,
"tfvars": self.tfvars,
"use_redis": self.use_redis,
"use_vault": bool(self.vault_url),
"use_redis": self.use_redis and "true" or "false",
"use_vault": self.vault_url and "true" or "false",
},
output_dir=self.output_dir,
no_input=True,
Expand Down
4 changes: 2 additions & 2 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"project_url_prod": null,
"terraform_backend": "gitlab",
"terraform_cloud_organization": null,
"use_redis": false,
"use_vault": false,
"use_redis": "false",
"use_vault": "false",
"environment_distribution": "1",
"environments_stacks": {},
"tfvars": {},
Expand Down
18 changes: 9 additions & 9 deletions {{cookiecutter.project_dirname}}/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ cache:
docker run --rm
-v ${PWD}:${PWD}
-w ${PWD}
-e CI_ENVIRONMENT_NAME{% if cookiecutter.use_vault %}
-e CI_ENVIRONMENT_NAME{% if cookiecutter.use_vault == "true" %}
-e CI_JOB_JWT_V2
-e ENV_SLUG{% endif %}
-e PROJECT_SLUG
-e RELEASE_END
-e RELEASE_START{% if not cookiecutter.use_vault %}
-e RELEASE_START{% if cookiecutter.use_vault == "false" %}
-e SENTRY_AUTH_TOKEN
-e SENTRY_DSN{% endif %}
-e SENTRY_ORG
-e SENTRY_PROJECT_NAME
-e SENTRY_URL{% if cookiecutter.use_vault %}
-e SENTRY_URL{% if cookiecutter.use_vault == "true" %}
-e SERVICE_SLUG={{ cookiecutter.service_slug }}
-e VAULT_ADDR{% endif %}
-e VERSION_REF
Expand Down Expand Up @@ -164,13 +164,13 @@ test:
- >
docker run --rm
-v ${PWD}:${PWD}
-w ${PWD}{% if cookiecutter.use_vault %}
-w ${PWD}{% if cookiecutter.use_vault == "true" %}
-e CI_JOB_JWT_V2
-e ENV_SLUG{% else %}
-e PACT_BROKER_BASE_URL
-e PACT_BROKER_PASSWORD
-e PACT_BROKER_USERNAME{% endif %}
-e PROJECT_SLUG{% if cookiecutter.use_vault %}
-e PROJECT_SLUG{% if cookiecutter.use_vault == "true" %}
-e VAULT_ADDR{% endif %}
--entrypoint=""
pactfoundation/pact-cli:latest-node14 ./scripts/ci_pact.sh ${PACT_CMD}
Expand Down Expand Up @@ -334,15 +334,15 @@ build_production:
-w ${PWD}{% if cookiecutter.terraform_backend == "gitlab" %}
-e CI_API_V4_URL
-e CI_COMMIT_SHA
-e CI_JOB_ID{% if cookiecutter.use_vault %}
-e CI_JOB_ID{% if cookiecutter.use_vault == "true" %}
-e CI_JOB_JWT_V2{% endif %}
-e CI_JOB_STAGE
-e CI_JOB_TOKEN
-e CI_PROJECT_ID
-e CI_PROJECT_NAME
-e CI_PROJECT_NAMESPACE
-e CI_PROJECT_PATH
-e CI_PROJECT_URL{% elif cookiecutter.use_vault %}
-e CI_PROJECT_URL{% elif cookiecutter.use_vault == "true" %}
-e CI_JOB_JWT_V2{% endif %}
-e ENV_SLUG
-e PROJECT_DIR=${CI_PROJECT_DIR}
Expand All @@ -352,7 +352,7 @@ build_production:
-e TERRAFORM_EXTRA_VAR_FILE=${ENV_SLUG}.tfvars
-e TERRAFORM_VARS_DIR=${CI_PROJECT_DIR}/terraform/vars
-e TF_ROOT=${CI_PROJECT_DIR}/terraform/{{ cookiecutter.deployment_type }}{% if cookiecutter.terraform_backend == "gitlab" %}
-e TF_STATE_NAME="env_${ENV_SLUG}"{% endif %}{% if not cookiecutter.use_vault %}{% if cookiecutter.deployment_type == "digitalocean-k8s" %}
-e TF_STATE_NAME="env_${ENV_SLUG}"{% endif %}{% if cookiecutter.use_vault == "false" %}{% if cookiecutter.deployment_type == "digitalocean-k8s" %}
-e TF_VAR_digitalocean_token="${DIGITALOCEAN_TOKEN}"{% endif %}
-e TF_VAR_internal_backend_url="${INTERNAL_BACKEND_URL}"
-e TF_VAR_internal_service_port="${FRONTEND_SERVICE_PORT}"{% if cookiecutter.deployment_type == "other-k8s" %}
Expand All @@ -363,7 +363,7 @@ build_production:
-e TF_VAR_sentry_dsn="${SENTRY_DSN}"{% endif %}
-e TF_VAR_service_container_image{% if cookiecutter.terraform_backend != "gitlab" %}
-e TF_WORKSPACE="{{ cookiecutter.project_slug }}_frontend_environment_${ENV_SLUG}"{% endif %}{% if cookiecutter.terraform_backend == "terraform-cloud" and not cookiecutter.use_vault %}
-e TFC_TOKEN{% endif %}{% if cookiecutter.use_vault %}
-e TFC_TOKEN{% endif %}{% if cookiecutter.use_vault == "true" %}
-e VAULT_ADDR
-e VAULT_ENV_SECRETS="sentry_frontend"
-e VAULT_STACK_SECRETS="digitalocean k8s"
Expand Down

0 comments on commit c5f653f

Please sign in to comment.