From fc0b532e8eb109951efc1337128b47b4ee483ad1 Mon Sep 17 00:00:00 2001 From: David Fry Date: Fri, 19 May 2023 13:52:12 +0100 Subject: [PATCH] add null checks --- terraform/gitlab/ci-templates/bootstrap/.gitlab-ci.yml | 4 ++-- terraform/gitlab/ci-templates/k8s-cluster/.gitlab-ci.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform/gitlab/ci-templates/bootstrap/.gitlab-ci.yml b/terraform/gitlab/ci-templates/bootstrap/.gitlab-ci.yml index b07e27358..8ef1506b4 100644 --- a/terraform/gitlab/ci-templates/bootstrap/.gitlab-ci.yml +++ b/terraform/gitlab/ci-templates/bootstrap/.gitlab-ci.yml @@ -51,8 +51,8 @@ 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 - - echo "https://${PRIVATE_REPO_USER}:${PRIVATE_REPO_TOKEN}@github.com" > ~/.gitcredentials.store - - git config --global credential.helper 'store --file ~/.gitcredentials.store' + - if [ ! -z "$PRIVATE_REPO_USER" ]; then echo "https://${PRIVATE_REPO_USER}:${PRIVATE_REPO_TOKEN}@github.com" > ~/.gitcredentials.store; fi + - if [ ! -z "$PRIVATE_REPO_USER" ]; then git config --global credential.helper 'store --file ~/.gitcredentials.store'; fi - git config --global advice.detachedHead false - set - git clone ${TEMPLATE_REPO_URL} template-repo diff --git a/terraform/gitlab/ci-templates/k8s-cluster/.gitlab-ci.yml b/terraform/gitlab/ci-templates/k8s-cluster/.gitlab-ci.yml index 9da07a6dd..2befee4af 100644 --- a/terraform/gitlab/ci-templates/k8s-cluster/.gitlab-ci.yml +++ b/terraform/gitlab/ci-templates/k8s-cluster/.gitlab-ci.yml @@ -49,8 +49,8 @@ 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 - - echo "https://${PRIVATE_REPO_USER}:${PRIVATE_REPO_TOKEN}@github.com" > ~/.gitcredentials.store - - git config --global credential.helper 'store --file ~/.gitcredentials.store' + - if [ ! -z "$PRIVATE_REPO_USER" ]; then echo "https://${PRIVATE_REPO_USER}:${PRIVATE_REPO_TOKEN}@github.com" > ~/.gitcredentials.store; fi + - if [ ! -z "$PRIVATE_REPO_USER" ]; then git config --global credential.helper 'store --file ~/.gitcredentials.store'; fi - git config --global advice.detachedHead false - set