Skip to content

Commit

Permalink
cleanup env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
dfry committed May 20, 2023
1 parent dc35d29 commit 983af26
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions terraform/control-center/init/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ envs:
cloud_platform: aws
cloud_region: eu-west-1
k8s_cluster_type: k3s
iac_terraform_modules_tag: v0.9.1
iac_terraform_modules_tag: v0.9.11
enable_vault_oauth_to_gitlab: true
letsencrypt_email: test@mojalabs.io
tags: {
"Origin": "Terraform",
"mojaloop/cost_center": "mlf-iac-sandbox",
"mojaloop/env": "ft-sbox-rw",
"mojaloop/owner": "Samuel-Kummary"
}
}
3 changes: 1 addition & 2 deletions terraform/control-center/init/setlocalenv.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export IAC_TEMPLATES_TAG=$IAC_MODULES_TAG
export IAC_TERRAFORM_MODULES_TAG=$IAC_MODULES_TAG
export IAC_TEMPLATES_TAG=$IAC_TERRAFORM_MODULES_TAG
export CONTROL_CENTER_CLOUD_PROVIDER=aws
5 changes: 2 additions & 3 deletions terraform/gitlab/ci-templates/bootstrap/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ cache:
- source setcivars.sh
- yq eval '.' environment.yaml -o=json > environment.json
- for var in $(jq -r 'to_entries[] | "\(.key)=\(.value)\n"' ./environment.json); do export $var; done
- if [ "$PRIVATE_REPO_USER" == "nullvalue" ]; then echo "https://${PRIVATE_REPO_USER}:${PRIVATE_REPO_TOKEN}@github.com" > ~/.gitcredentials.store; fi
- if [ "$PRIVATE_REPO_USER" == "nullvalue" ]; then echo "https://${PRIVATE_REPO_USER}:${PRIVATE_REPO_TOKEN}@${PRIVATE_REPO}" > ~/.gitcredentials.store; fi
- if [ "$PRIVATE_REPO_USER" == "nullvalue" ]; then git config --global credential.helper 'store --file ~/.gitcredentials.store'; fi
- git config --global advice.detachedHead false
- set
Expand Down Expand Up @@ -82,8 +82,7 @@ prepare:image:
DOCKER_TAG: latest
before_script:
# Authenticate to the docker registry and dependency proxy
- if [ "$PRIVATE_REPO_USER" == "nullvalue" ]; then export PRIVATE_REPO_HOST=null.com; else export PRIVATE_REPO_HOST=ghcr.io; fi
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"${PRIVATE_REPO_HOST}\":{\"auth\":\"$(printf "%s:%s" "${PRIVATE_REPO_USER}" "${PRIVATE_REPO_TOKEN}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"${PRIVATE_REPO}\":{\"auth\":\"$(printf "%s:%s" "${PRIVATE_REPO_USER}" "${PRIVATE_REPO_TOKEN}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor
--context "${CI_PROJECT_DIR}/.gitlab/ci"
Expand Down
1 change: 1 addition & 0 deletions terraform/gitlab/ci-templates/bootstrap/setcivars.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export PRIVATE_REPO_TOKEN=$PRIVATE_REPO_TOKEN
export PRIVATE_REPO_USER=$PRIVATE_REPO_USER
export PRIVATE_REPO=$PRIVATE_REPO
export IAC_TEMPLATES_TAG=$IAC_TEMPLATES_TAG
export IAC_TERRAFORM_MODULES_TAG=$IAC_TERRAFORM_MODULES_TAG
5 changes: 2 additions & 3 deletions terraform/gitlab/ci-templates/k8s-cluster/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ cache:
- source setcivars.sh
- yq eval '.' environment.yaml -o=json > environment.json
- for var in $(jq -r 'to_entries[] | "\(.key)=\(.value)\n"' ./environment.json); do export $var; done
- if [ "$PRIVATE_REPO_USER" == "nullvalue" ]; then echo "https://${PRIVATE_REPO_USER}:${PRIVATE_REPO_TOKEN}@github.com" > ~/.gitcredentials.store; fi
- if [ "$PRIVATE_REPO_USER" == "nullvalue" ]; then echo "https://${PRIVATE_REPO_USER}:${PRIVATE_REPO_TOKEN}@${PRIVATE_REPO}" > ~/.gitcredentials.store; fi
- if [ "$PRIVATE_REPO_USER" == "nullvalue" ]; then git config --global credential.helper 'store --file ~/.gitcredentials.store'; fi
- git config --global advice.detachedHead false
- set
Expand All @@ -75,8 +75,7 @@ prepare:image:
DOCKER_TAG: latest
before_script:
# Authenticate to the docker registry and dependency proxy
- if [ "$PRIVATE_REPO_USER" == "nullvalue" ]; then export PRIVATE_REPO_HOST=null.com; else export PRIVATE_REPO_HOST=ghcr.io; fi
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"${PRIVATE_REPO_HOST}\":{\"auth\":\"$(printf "%s:%s" "${PRIVATE_REPO_USER}" "${PRIVATE_REPO_TOKEN}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(printf "%s:%s" "${CI_REGISTRY_USER}" "${CI_REGISTRY_PASSWORD}" | base64 | tr -d '\n')\"},\"${PRIVATE_REPO}\":{\"auth\":\"$(printf "%s:%s" "${PRIVATE_REPO_USER}" "${PRIVATE_REPO_TOKEN}" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json
script:
- /kaniko/executor
--context "${CI_PROJECT_DIR}/.gitlab/ci"
Expand Down

0 comments on commit 983af26

Please sign in to comment.