From 164f66d4b795cfa9da2b77dfa6dc217e70e984a4 Mon Sep 17 00:00:00 2001 From: Clemens Date: Thu, 7 Mar 2024 12:19:28 +0100 Subject: [PATCH] renamed env variables according to convention --- infrastructure/build/image/Dockerfile | 8 ++++---- infrastructure/build/image/resources/entrypoint.sh | 10 +++++----- infrastructure/build/image/resources/functions.sh | 14 +++++++------- src/main/resources/website/build-configmap.yaml | 4 ++-- src/main/resources/website/build-secret.yaml | 2 +- src/test/cljc/dda/c4k_website/website_test.cljc | 6 +++--- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/infrastructure/build/image/Dockerfile b/infrastructure/build/image/Dockerfile index 4d3289b..84e606e 100644 --- a/infrastructure/build/image/Dockerfile +++ b/infrastructure/build/image/Dockerfile @@ -3,9 +3,9 @@ FROM clojure:lein # Prepare Entrypoint Script ADD resources /tmp -ENV BUILDDIR="/etc/website" -ENV SOURCEDIR="/etc/websitesource" -ENV WEBSITEROOT="/var/www/html/website/" -ENV HASHFILEDIR="/var/hashfile.d" +ENV BUILD_DIR="/etc/website" +ENV SOURCE_DIR="/etc/websitesource" +ENV WEBSITE_ROOT="/var/www/html/website/" +ENV HASHFILE_DIR="/var/hashfile.d" RUN /tmp/install.sh diff --git a/infrastructure/build/image/resources/entrypoint.sh b/infrastructure/build/image/resources/entrypoint.sh index 485a546..e50684b 100755 --- a/infrastructure/build/image/resources/entrypoint.sh +++ b/infrastructure/build/image/resources/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/bash -mkdir $BUILDDIR -mkdir $SOURCEDIR +mkdir $BUILD_DIR +mkdir $SOURCE_DIR set -euo pipefail @@ -11,15 +11,15 @@ filename="website.zip" hashfilename="hashfile" echo "Check for new content" -touch $HASHFILEDIR/$hashfilename -currentHash=$( cat $HASHFILEDIR/$hashfilename ) +touch $HASHFILE_DIR/$hashfilename +currentHash=$( cat $HASHFILE_DIR/$hashfilename ) newHash=$( get-hash-data ) if [[ $currentHash == $newHash ]] then echo "Nothing to do" else - echo $currentHash > $HASHFILEDIR/$hashfilename + echo $currentHash > $HASHFILE_DIR/$hashfilename echo "Generate .netrc file" generate-netrc-file echo "Downloading website data" diff --git a/infrastructure/build/image/resources/functions.sh b/infrastructure/build/image/resources/functions.sh index 8333acb..60f192d 100644 --- a/infrastructure/build/image/resources/functions.sh +++ b/infrastructure/build/image/resources/functions.sh @@ -1,29 +1,29 @@ #!/bin/bash function generate-netrc-file() { - echo "machine $GIT_HOST password $AUTHTOKEN" > ~/.netrc + echo "machine $GIT_HOST password $AUTH_TOKEN" > ~/.netrc } function get-website-data() { - curl -H "Authorization: token $AUTHTOKEN" -o $SOURCEDIR/$1 $GITREPOURL + curl -H "Authorization: token $AUTH_TOKEN" -o $SOURCE_DIR/$1 $GIT_REPO_URL } function get-hash-data() { - curl -s -H "Authorization: token $AUTHTOKEN" $GITCOMMITURL | jq '.sha' + curl -s -H "Authorization: token $AUTH_TOKEN" $GIT_COMMIT_URL | jq '.sha' } function write-hash-data() { - echo $1 > $HASHFILEDIR/$2 + echo $1 > $HASHFILE_DIR/$2 } function unzip-website-data() { - unzip $SOURCEDIR/$1 -d $BUILDDIR + unzip $SOURCE_DIR/$1 -d $BUILD_DIR } function build-website() { - (cd $BUILDDIR; dir=$(ls); cd $dir; ./generate.sh;) + (cd $BUILD_DIR; dir=$(ls); cd $dir; ./generate.sh;) } function move-website-files-to-target() { - (cd $BUILDDIR; dir=$(ls); cd $dir; rsync -ru --exclude-from "/etc/exclude.pattern" --delete target/html/* $WEBSITEROOT;) + (cd $BUILD_DIR; dir=$(ls); cd $dir; rsync -ru --exclude-from "/etc/exclude.pattern" --delete target/html/* $WEBSITE_ROOT;) } diff --git a/src/main/resources/website/build-configmap.yaml b/src/main/resources/website/build-configmap.yaml index 96dbb86..f3a812a 100644 --- a/src/main/resources/website/build-configmap.yaml +++ b/src/main/resources/website/build-configmap.yaml @@ -7,5 +7,5 @@ metadata: app.kubernetes.part-of: NAME-website data: GIT_HOST: GITHOST - GITREPOURL: REPOURL - GITCOMMITURL: COMMITURL \ No newline at end of file + GIT_REPO_URL: REPOURL + GIT_COMMIT_URL: COMMITURL \ No newline at end of file diff --git a/src/main/resources/website/build-secret.yaml b/src/main/resources/website/build-secret.yaml index de659ef..71bec46 100644 --- a/src/main/resources/website/build-secret.yaml +++ b/src/main/resources/website/build-secret.yaml @@ -6,4 +6,4 @@ metadata: labels: app.kubernetes.part-of: NAME-website data: - AUTHTOKEN: TOKEN + AUTH_TOKEN: TOKEN diff --git a/src/test/cljc/dda/c4k_website/website_test.cljc b/src/test/cljc/dda/c4k_website/website_test.cljc index 2ed5fb3..9d7aec5 100644 --- a/src/test/cljc/dda/c4k_website/website_test.cljc +++ b/src/test/cljc/dda/c4k_website/website_test.cljc @@ -237,8 +237,8 @@ :labels {:app.kubernetes.part-of "test-io-website"}}, :data {:GIT_HOST "mygit.de" - :GITREPOURL "https://mygit.de/api/v1/repos/someuser/repo/archive/main.zip" - :GITCOMMITURL "https://mygit.de/api/v1/repos/someuser/repo/git/commits/HEAD"}} + :GIT_REPO_URL "https://mygit.de/api/v1/repos/someuser/repo/archive/main.zip" + :GIT_COMMIT_URL "https://mygit.de/api/v1/repos/someuser/repo/git/commits/HEAD"}} (cut/generate-build-configmap {:issuer "staging" :build-cpu-request "500m" :build-cpu-limit "1700m" @@ -260,7 +260,7 @@ :namespace "test-io", :labels {:app.kubernetes.part-of "test-io-website"}}, :data - {:AUTHTOKEN "YWJlZGpnYmFzZG9kag=="}} + {:AUTH_TOKEN "YWJlZGpnYmFzZG9kag=="}} (cut/generate-build-secret {:unique-name "test.io", :authtoken "abedjgbasdodj"}))))