diff --git a/.env b/.env index c95a67d5..22846cb4 100644 --- a/.env +++ b/.env @@ -6,3 +6,4 @@ AURWEB_FASTAPI_PREFIX=https://localhost:8444 AURWEB_SSHD_PREFIX=ssh://aur@localhost:2222 GIT_DATA_DIR="./aur.git/" TEST_RECURSION_LIMIT=10000 +COMMIT_HASH= diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a7864280..c1a20427 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,6 +55,7 @@ deploy: AURWEB_PHP_PREFIX: https://aur-dev.archlinux.org AURWEB_FASTAPI_PREFIX: https://aur-dev.archlinux.org AURWEB_SSHD_PREFIX: ssh://aur@aur-dev.archlinux.org:2222 + COMMIT_HASH: $CI_COMMIT_SHA script: - pacman -Syu --noconfirm docker-compose socat openssh - chmod 600 ${SSH_KEY} diff --git a/docker-compose.aur-dev.yml b/docker-compose.aur-dev.yml index 075b5bb2..3f574d42 100644 --- a/docker-compose.aur-dev.yml +++ b/docker-compose.aur-dev.yml @@ -48,6 +48,7 @@ services: fastapi: restart: always environment: + - COMMIT_HASH=$COMMIT_HASH - FASTAPI_BACKEND="gunicorn" - FASTAPI_WORKERS=${FASTAPI_WORKERS} - AURWEB_FASTAPI_PREFIX=${AURWEB_FASTAPI_PREFIX} diff --git a/docker/fastapi-entrypoint.sh b/docker/fastapi-entrypoint.sh index 6d91a16d..ec9eb5c1 100755 --- a/docker/fastapi-entrypoint.sh +++ b/docker/fastapi-entrypoint.sh @@ -11,6 +11,10 @@ sed -ri "s;^(aur_location) = .+;\1 = ${AURWEB_FASTAPI_PREFIX};" conf/config sed -ri 's/^(cache) = .+/\1 = redis/' conf/config sed -ri 's|^(redis_address) = .+|\1 = redis://redis|' conf/config +if [ "$COMMIT_HASH" ]; then + sed -ri "s/^;?(commit_hash) =.*$/\1 = $COMMIT_HASH/" conf/config +fi + sed -ri "s|^(git_clone_uri_anon) = .+|\1 = ${AURWEB_FASTAPI_PREFIX}/%s.git|" conf/config.defaults sed -ri "s|^(git_clone_uri_priv) = .+|\1 = ${AURWEB_SSHD_PREFIX}/%s.git|" conf/config.defaults