From 866572e252e84b138fc379865995b7ba6e8cbf66 Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Wed, 17 Dec 2025 11:03:02 +0100 Subject: [PATCH] ci(docker): fix repo mount path for pkgmgr as base layer of Infinito.Nexus Standardize Docker/CI/test environments to mount pkgmgr at /opt/src/pkgmgr. This makes the layering explicit: pkgmgr is the lower-level foundation used by Infinito.Nexus. Infra-only change (Docker, CI, shell scripts). No runtime or Nix semantics changed. https://chatgpt.com/share/69427fe7-e288-800f-90a4-c1c3c11a8484 --- .github/workflows/test-virgin-root.yml | 8 ++++---- .github/workflows/test-virgin-user.yml | 10 +++++----- Dockerfile | 2 +- scripts/docker/entry.sh | 10 +++++----- scripts/installation/arch/package.sh | 2 +- scripts/test/test-e2e.sh | 16 ++++++++-------- scripts/test/test-env-nix.sh | 12 ++++++------ scripts/test/test-env-virtual.sh | 4 ++-- scripts/test/test-integration.sh | 8 ++++---- scripts/test/test-unit.sh | 8 ++++---- 10 files changed, 40 insertions(+), 40 deletions(-) diff --git a/.github/workflows/test-virgin-root.yml b/.github/workflows/test-virgin-root.yml index 121eb6a..e32da96 100644 --- a/.github/workflows/test-virgin-root.yml +++ b/.github/workflows/test-virgin-root.yml @@ -31,15 +31,15 @@ jobs: set -euo pipefail docker run --rm \ - -v "$PWD":/src \ + -v "$PWD":/opt/src/pkgmgr \ -v pkgmgr_repos:/root/Repositories \ -v pkgmgr_pip_cache:/root/.cache/pip \ - -w /src \ + -w /opt/src/pkgmgr \ "pkgmgr-${{ matrix.distro }}-virgin" \ bash -lc ' set -euo pipefail - git config --global --add safe.directory /src + git config --global --add safe.directory /opt/src/pkgmgr make install make setup @@ -50,5 +50,5 @@ jobs: pkgmgr version pkgmgr echo ">>> Running Nix-based: nix run .#pkgmgr -- version pkgmgr" - nix run /src#pkgmgr -- version pkgmgr + nix run /opt/src/pkgmgr#pkgmgr -- version pkgmgr ' diff --git a/.github/workflows/test-virgin-user.yml b/.github/workflows/test-virgin-user.yml index 0ec7366..0a6c4af 100644 --- a/.github/workflows/test-virgin-user.yml +++ b/.github/workflows/test-virgin-user.yml @@ -31,8 +31,8 @@ jobs: set -euo pipefail docker run --rm \ - -v "$PWD":/src \ - -w /src \ + -v "$PWD":/opt/src/pkgmgr \ + -w /opt/src/pkgmgr \ "pkgmgr-${{ matrix.distro }}-virgin" \ bash -lc ' set -euo pipefail @@ -42,7 +42,7 @@ jobs: useradd -m dev echo "dev ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/dev chmod 0440 /etc/sudoers.d/dev - chown -R dev:dev /src + chown -R dev:dev /opt/src/pkgmgr mkdir -p /nix/store /nix/var/nix /nix/var/log/nix /nix/var/nix/profiles chown -R dev:dev /nix @@ -51,7 +51,7 @@ jobs: sudo -H -u dev env HOME=/home/dev PKGMGR_DISABLE_NIX_FLAKE_INSTALLER=1 bash -lc " set -euo pipefail - cd /src + cd /opt/src/pkgmgr make setup-venv . \"\$HOME/.venvs/pkgmgr/bin/activate\" @@ -59,6 +59,6 @@ jobs: pkgmgr version pkgmgr export NIX_REMOTE=local - nix run /src#pkgmgr -- version pkgmgr + nix run /opt/src/pkgmgr#pkgmgr -- version pkgmgr " ' diff --git a/Dockerfile b/Dockerfile index 6f14706..b071b67 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,6 +50,6 @@ RUN set -euo pipefail; \ # Entry point COPY scripts/docker/entry.sh /usr/local/bin/docker-entry.sh -WORKDIR /src +WORKDIR /opt/src/pkgmgr ENTRYPOINT ["/usr/local/bin/docker-entry.sh"] CMD ["pkgmgr", "--help"] diff --git a/scripts/docker/entry.sh b/scripts/docker/entry.sh index 62704ec..6837a89 100755 --- a/scripts/docker/entry.sh +++ b/scripts/docker/entry.sh @@ -12,16 +12,16 @@ if [[ -f /etc/os-release ]]; then echo "[docker-pkgmgr] Detected distro: ${ID:-unknown} (like: ${ID_LIKE:-})" fi -# Always use /src (mounted from host) as working directory -echo "[docker-pkgmgr] Using /src as working directory" -cd /src +# Always use /opt/src/pkgmgr (mounted from host) as working directory +echo "[docker-pkgmgr] Using /opt/src/pkgmgr as working directory" +cd /opt/src/pkgmgr # --------------------------------------------------------------------------- -# DEV mode: rebuild package-manager from the mounted /src tree +# DEV mode: rebuild package-manager from the mounted /opt/src/pkgmgr tree # --------------------------------------------------------------------------- if [[ "${REINSTALL_PKGMGR:-0}" == "1" ]]; then echo "[docker-pkgmgr] DEV mode enabled (REINSTALL_PKGMGR=1)" - echo "[docker-pkgmgr] Rebuilding package-manager from /src via scripts/installation/package.sh..." + echo "[docker-pkgmgr] Rebuilding package-manager from /opt/src/pkgmgr via scripts/installation/package.sh..." bash scripts/installation/package.sh || exit 1 fi diff --git a/scripts/installation/arch/package.sh b/scripts/installation/arch/package.sh index 7a6304e..813cd62 100755 --- a/scripts/installation/arch/package.sh +++ b/scripts/installation/arch/package.sh @@ -6,7 +6,7 @@ echo "[arch/package] Building Arch package (makepkg --nodeps) in an isolated bui SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../../.." && pwd)" -# We must not build inside /src (mounted repo). Build in /tmp to avoid permission issues. +# We must not build inside /opt/src/pkgmgr (mounted repo). Build in /tmp to avoid permission issues. BUILD_ROOT="/tmp/package-manager-arch-build" PKG_SRC_DIR="${PROJECT_ROOT}/packaging/arch" PKG_BUILD_DIR="${BUILD_ROOT}/packaging/arch" diff --git a/scripts/test/test-e2e.sh b/scripts/test/test-e2e.sh index e692a33..96b1c43 100755 --- a/scripts/test/test-e2e.sh +++ b/scripts/test/test-e2e.sh @@ -6,12 +6,12 @@ echo ">>> Running E2E tests: $PKGMGR_DISTRO" echo "============================================================" docker run --rm \ - -v "$(pwd):/src" \ + -v "$(pwd):/opt/src/pkgmgr" \ -v "pkgmgr_nix_store_${PKGMGR_DISTRO}:/nix" \ -v "pkgmgr_nix_cache_${PKGMGR_DISTRO}:/root/.cache/nix" \ -e REINSTALL_PKGMGR=1 \ -e TEST_PATTERN="${TEST_PATTERN}" \ - --workdir /src \ + --workdir /opt/src/pkgmgr \ "pkgmgr-${PKGMGR_DISTRO}" \ bash -lc ' set -euo pipefail @@ -40,14 +40,14 @@ docker run --rm \ } # Mark the mounted repository as safe to avoid Git ownership errors. - # Newer Git (e.g. on Ubuntu) complains about the gitdir (/src/.git), - # older versions about the worktree (/src). Nix turns "." into the - # flake input "git+file:///src", which then uses Git under the hood. + # Newer Git (e.g. on Ubuntu) complains about the gitdir (/opt/src/pkgmgr/.git), + # older versions about the worktree (/opt/src/pkgmgr). Nix turns "." into the + # flake input "git+file:///opt/src/pkgmgr", which then uses Git under the hood. if command -v git >/dev/null 2>&1; then # Worktree path - git config --global --add safe.directory /src || true + git config --global --add safe.directory /opt/src/pkgmgr || true # Gitdir path shown in the "dubious ownership" error - git config --global --add safe.directory /src/.git || true + git config --global --add safe.directory /opt/src/pkgmgr/.git || true # Ephemeral CI containers: allow all paths as a last resort git config --global --add safe.directory "*" || true fi @@ -55,6 +55,6 @@ docker run --rm \ # Run the E2E tests inside the Nix development shell nix develop .#default --no-write-lock-file -c \ python3 -m unittest discover \ - -s /src/tests/e2e \ + -s /opt/src/pkgmgr/tests/e2e \ -p "$TEST_PATTERN" ' diff --git a/scripts/test/test-env-nix.sh b/scripts/test/test-env-nix.sh index 90de78a..ccd3f3f 100755 --- a/scripts/test/test-env-nix.sh +++ b/scripts/test/test-env-nix.sh @@ -9,18 +9,18 @@ echo ">>> Image: ${IMAGE}" echo "============================================================" docker run --rm \ - -v "$(pwd):/src" \ + -v "$(pwd):/opt/src/pkgmgr" \ -v "pkgmgr_nix_store_${PKGMGR_DISTRO}:/nix" \ -v "pkgmgr_nix_cache_${PKGMGR_DISTRO}:/root/.cache/nix" \ - --workdir /src \ + --workdir /opt/src/pkgmgr \ -e REINSTALL_PKGMGR=1 \ "${IMAGE}" \ bash -lc ' set -euo pipefail if command -v git >/dev/null 2>&1; then - git config --global --add safe.directory /src || true - git config --global --add safe.directory /src/.git || true + git config --global --add safe.directory /opt/src/pkgmgr || true + git config --global --add safe.directory /opt/src/pkgmgr/.git || true git config --global --add safe.directory "*" || true fi @@ -38,9 +38,9 @@ docker run --rm \ # ------------------------------------------------------------ # Retry helper for GitHub API rate-limit (HTTP 403) # ------------------------------------------------------------ - if [[ -f /src/scripts/nix/lib/retry_403.sh ]]; then + if [[ -f /opt/src/pkgmgr/scripts/nix/lib/retry_403.sh ]]; then # shellcheck source=./scripts/nix/lib/retry_403.sh - source /src/scripts/nix/lib/retry_403.sh + source /opt/src/pkgmgr/scripts/nix/lib/retry_403.sh elif [[ -f ./scripts/nix/lib/retry_403.sh ]]; then # shellcheck source=./scripts/nix/lib/retry_403.sh source ./scripts/nix/lib/retry_403.sh diff --git a/scripts/test/test-env-virtual.sh b/scripts/test/test-env-virtual.sh index 819cdde..c7aafd0 100755 --- a/scripts/test/test-env-virtual.sh +++ b/scripts/test/test-env-virtual.sh @@ -17,8 +17,8 @@ echo # ------------------------------------------------------------ if OUTPUT=$(docker run --rm \ -e REINSTALL_PKGMGR=1 \ - -v "$(pwd):/src" \ - -w /src \ + -v "$(pwd):/opt/src/pkgmgr" \ + -w /opt/src/pkgmgr \ "${IMAGE}" \ bash -lc ' set -euo pipefail diff --git a/scripts/test/test-integration.sh b/scripts/test/test-integration.sh index d2722c3..7aeaf94 100755 --- a/scripts/test/test-integration.sh +++ b/scripts/test/test-integration.sh @@ -6,19 +6,19 @@ echo ">>> Running INTEGRATION tests in ${PKGMGR_DISTRO} container" echo "============================================================" docker run --rm \ - -v "$(pwd):/src" \ + -v "$(pwd):/opt/src/pkgmgr" \ -v "pkgmgr_nix_store_${PKGMGR_DISTRO}:/nix" \ -v "pkgmgr_nix_cache_${PKGMGR_DISTRO}:/root/.cache/nix" \ - --workdir /src \ + --workdir /opt/src/pkgmgr \ -e REINSTALL_PKGMGR=1 \ -e TEST_PATTERN="${TEST_PATTERN}" \ "pkgmgr-${PKGMGR_DISTRO}" \ bash -lc ' set -e; - git config --global --add safe.directory /src || true; + git config --global --add safe.directory /opt/src/pkgmgr || true; nix develop .#default --no-write-lock-file -c \ python3 -m unittest discover \ -s tests/integration \ - -t /src \ + -t /opt/src/pkgmgr \ -p "$TEST_PATTERN"; ' diff --git a/scripts/test/test-unit.sh b/scripts/test/test-unit.sh index 6fd1028..03e339d 100755 --- a/scripts/test/test-unit.sh +++ b/scripts/test/test-unit.sh @@ -6,19 +6,19 @@ echo ">>> Running UNIT tests in ${PKGMGR_DISTRO} container" echo "============================================================" docker run --rm \ - -v "$(pwd):/src" \ + -v "$(pwd):/opt/src/pkgmgr" \ -v "pkgmgr_nix_cache_${PKGMGR_DISTRO}:/root/.cache/nix" \ -v "pkgmgr_nix_store_${PKGMGR_DISTRO}:/nix" \ - --workdir /src \ + --workdir /opt/src/pkgmgr \ -e REINSTALL_PKGMGR=1 \ -e TEST_PATTERN="${TEST_PATTERN}" \ "pkgmgr-${PKGMGR_DISTRO}" \ bash -lc ' set -e; - git config --global --add safe.directory /src || true; + git config --global --add safe.directory /opt/src/pkgmgr || true; nix develop .#default --no-write-lock-file -c \ python3 -m unittest discover \ -s tests/unit \ - -t /src \ + -t /opt/src/pkgmgr \ -p "$TEST_PATTERN"; '