From ab0ec0887db0298852f94e54e4a8e02cc50b35bf Mon Sep 17 00:00:00 2001 From: copilotcoder Date: Wed, 22 Jul 2026 17:51:22 -0400 Subject: [PATCH] Getting rid of repeated version numbers. Signed-off-by: copilotcoder --- .gitea/workflows/cicd.yaml | 22 ++++++++++++---------- versions/ci.env | 6 ------ 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/cicd.yaml b/.gitea/workflows/cicd.yaml index 4b56588..ab8ddee 100644 --- a/.gitea/workflows/cicd.yaml +++ b/.gitea/workflows/cicd.yaml @@ -135,9 +135,9 @@ jobs: if retry_cmd 5 3 env GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa -o IdentitiesOnly=yes -o StrictHostKeyChecking=no" \ git fetch --depth 1 origin "${HEAD_SHA}" >/dev/null 2>&1; then - git checkout FETCH_HEAD -- Dockerfile.cicd-base .dockerignore versions/ci.env scripts/compute-cicd-base-hash.sh scripts/resolve-mirrored-image.sh + git checkout FETCH_HEAD -- Dockerfile.cicd-base .dockerignore versions/ci.env backend/pyproject.toml frontend/package.json scripts/compute-cicd-base-hash.sh scripts/resolve-mirrored-image.sh else - git checkout HEAD -- Dockerfile.cicd-base .dockerignore versions/ci.env scripts/compute-cicd-base-hash.sh scripts/resolve-mirrored-image.sh + git checkout HEAD -- Dockerfile.cicd-base .dockerignore versions/ci.env backend/pyproject.toml frontend/package.json scripts/compute-cicd-base-hash.sh scripts/resolve-mirrored-image.sh fi chmod +x scripts/compute-cicd-base-hash.sh @@ -329,6 +329,10 @@ jobs: source versions/ci.env set +a + PYTHON_VERSION="$(python3 -c 'from pathlib import Path; import re, tomllib; pyproject = tomllib.loads(Path("backend/pyproject.toml").read_text()); requires_python = pyproject["project"]["requires-python"]; match = re.search(r"(\\d+\\.\\d+)", requires_python); raise SystemExit("could not derive backend Python version") if not match else None; print(match.group(1))')" + + NODE_MAJOR="$(node -p "const pkg = require('./frontend/package.json'); const match = String(pkg.engines?.node ?? '').match(/(\\d+)/); if (!match) throw new Error('could not derive frontend Node major'); process.stdout.write(match[1])")" + PLAYWRIGHT_BROWSERS_MIRROR_TAG="${GITEA_REGISTRY}/${PLAYWRIGHT_MIRROR_IMAGE}" PLAYWRIGHT_BROWSERS_UPSTREAM_TAG="${PLAYWRIGHT_IMAGE}" PLAYWRIGHT_BROWSERS_LOCAL_TAG="$(./scripts/resolve-mirrored-image.sh \ @@ -347,6 +351,8 @@ jobs: docker build --progress=plain -f Dockerfile.cicd-base \ --build-arg BASE_IMAGE_VERSION="v1.0.0-${BASE_HASH}" \ --build-arg BASE_IMAGE_HASH="${BASE_HASH}" \ + --build-arg PYTHON_VERSION="${PYTHON_VERSION}" \ + --build-arg NODE_MAJOR="${NODE_MAJOR}" \ --build-arg PLAYWRIGHT_VERSION="${PLAYWRIGHT_VERSION}" \ --build-arg PLAYWRIGHT_DISTRO="${PLAYWRIGHT_DISTRO}" \ --build-arg PLAYWRIGHT_BROWSERS_IMAGE="${PLAYWRIGHT_BROWSERS_IMAGE}" \ @@ -1101,10 +1107,8 @@ jobs: FRONTEND_BASE_TAG_REF="${FRONTEND_BASE_REPO}:${HEAD_SHA}" FRONTEND_BASE_CACHE_REF="${FRONTEND_BASE_REPO}:cache" - set -a - # shellcheck source=versions/ci.env - source versions/ci.env - set +a + NODE_ALPINE_TAG="$(node -p "const pkg = require('./frontend/package.json'); const match = String(pkg.engines?.node ?? '').match(/(\\d+)/); if (!match) throw new Error('could not derive frontend Node major'); process.stdout.write(match[1] + '-alpine')")" + YARN_VERSION="$(node -p "const pkg = require('./frontend/package.json'); const match = String(pkg.packageManager ?? '').match(/^yarn@(.*)$/); if (!match) throw new Error('could not derive frontend Yarn version'); process.stdout.write(match[1])")" retry_registry_op pull "${FRONTEND_BASE_CACHE_REF}" 5 3 || true BUILDKIT_NO_CLIENT_TOKEN=1 DOCKER_BUILDKIT=1 docker build -f Dockerfile.frontend \ @@ -1299,10 +1303,8 @@ jobs: DEPLOYABLE_FRONTEND_TAG_REF="${DEPLOYABLE_FRONTEND_REPO}:${HEAD_SHA}" DEPLOYABLE_FRONTEND_CACHE_REF="${DEPLOYABLE_FRONTEND_REPO}:cache" - set -a - # shellcheck source=versions/ci.env - source versions/ci.env - set +a + NODE_ALPINE_TAG="$(node -p "const pkg = require('./frontend/package.json'); const match = String(pkg.engines?.node ?? '').match(/(\\d+)/); if (!match) throw new Error('could not derive frontend Node major'); process.stdout.write(match[1] + '-alpine')")" + YARN_VERSION="$(node -p "const pkg = require('./frontend/package.json'); const match = String(pkg.packageManager ?? '').match(/^yarn@(.*)$/); if (!match) throw new Error('could not derive frontend Yarn version'); process.stdout.write(match[1])")" docker_login_with_retry 5 3 retry_registry_op pull "${DEPLOYABLE_FRONTEND_CACHE_REF}" 5 3 || true diff --git a/versions/ci.env b/versions/ci.env index f1858c2..8a180bb 100644 --- a/versions/ci.env +++ b/versions/ci.env @@ -9,10 +9,4 @@ PLAYWRIGHT_MIRROR_IMAGE=darkhelm.org/playwright-browsers:${PLAYWRIGHT_IMAGE_TAG} POSTGRES_IMAGE_TAG=16-alpine POSTGRES_MIRROR_IMAGE=darkhelm.org/postgres:${POSTGRES_IMAGE_TAG} POSTGRES_UPSTREAM_IMAGE=docker.io/library/postgres:${POSTGRES_IMAGE_TAG} - -FRONTEND_NODE_ALPINE_TAG=24-alpine -FRONTEND_YARN_VERSION=4.17.1 - UBUNTU_CICD_BASE_VERSION=26.04 -PYTHON_VERSION=3.14 -NODE_MAJOR=24