From cc984986033ef9103789fed4a92bbcfa323f3415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me> Date: Tue, 14 Nov 2023 19:12:02 +0100 Subject: [PATCH] CI/CD => dotenv for test --- ExerciseChecker/.gitlab-ci/01_functions.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ExerciseChecker/.gitlab-ci/01_functions.yml b/ExerciseChecker/.gitlab-ci/01_functions.yml index 2b482cb..c173b18 100644 --- a/ExerciseChecker/.gitlab-ci/01_functions.yml +++ b/ExerciseChecker/.gitlab-ci/01_functions.yml @@ -7,6 +7,7 @@ DOCKER_REGISTRY_USER=dojohessotest DOCKER_REGISTRY_IMAGE=dojohesso/test-dojo_exercise_checker DOCKER_REGISTRY_PASSWORD=$DOCKER_TEST_REGISTRY_PASSWORD + DOTENV_PROD_KEY=$DOTENV_TEST_KEY fi @@ -52,12 +53,11 @@ - cd $PROJECT_FOLDER - sed -i -r "s/\{\{VERSION\}\}/${VERSION}/g" src/app.ts - | - if [ $CI_COMMIT_REF_PROTECTED == "true" ]; then + if [ $CI_COMMIT_REF_PROTECTED == "true" || $CI_COMMIT_BRANCH == "test" ]; then echo "Decrypt production env vars" sed -i -r "s/(DOTENV_KEY[ ]*:[ ]*[\'\"\`])[^'\"\`]*([\'\"\`])([ ]*\,)?//g" src/app.ts sed -i -r "s/,[\ \n]*\}/\}/g" src/app.ts npx dotenv-vault local decrypt "${DOTENV_PROD_KEY}" > .env - fi - cd .. -- GitLab