ci(e2e): run registry setup scripts as the runner user

On Ubuntu 26.04, sudo ignores -E and drops the registry settings.
Harbor then listens on its default port while Docker tries to log in
on the port configured by the workflow.

Run the registry setup scripts as the runner user so they inherit the
job environment. Use sudo within the Harbor and Nexus scripts for the
operations that need it.

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2026-11-25 17:37:38 +01:00
parent 45f22b1c11
commit cd3ff47a07
3 changed files with 6 additions and 8 deletions

View File

@@ -47,9 +47,9 @@ echo "::group::Installing Harbor"
( (
cd /tmp/harbor cd /tmp/harbor
set -x set -x
./install.sh sudo -H ./install.sh
sleep 10 sleep 10
netstat -aptn sudo netstat -aptn
) )
echo "::endgroup::" echo "::endgroup::"
@@ -58,7 +58,7 @@ echo "::group::Compose config"
( (
cd /tmp/harbor cd /tmp/harbor
set -x set -x
docker compose config sudo -H docker compose config
) )
echo "::endgroup::" echo "::endgroup::"

View File

@@ -36,7 +36,7 @@ EOF
export NEXUS_VERSION export NEXUS_VERSION
mkdir -p /tmp/nexus/data mkdir -p /tmp/nexus/data
chown 200:200 /tmp/nexus/data sudo chown 200:200 /tmp/nexus/data
cp "${SCRIPT_DIR}/docker-compose.yml" /tmp/nexus/docker-compose.yml cp "${SCRIPT_DIR}/docker-compose.yml" /tmp/nexus/docker-compose.yml
echo "::group::Pulling Nexus $NEXUS_VERSION" echo "::group::Pulling Nexus $NEXUS_VERSION"
@@ -82,7 +82,7 @@ echo "::endgroup::"
echo "::group::Change user's password" echo "::group::Change user's password"
( (
set -x set -x
curl --fail -v -k --max-time 10 -u "$REGISTRY_USER:$(cat /tmp/nexus/data/admin.password)" -X PUT -H 'Content-Type: text/plain' -d "$REGISTRY_PASSWORD" "http://$NEXUS_HOST:$NEXUS_PORT/service/rest/v1/security/users/$REGISTRY_USER/change-password" curl --fail -v -k --max-time 10 -u "$REGISTRY_USER:$(sudo cat /tmp/nexus/data/admin.password)" -X PUT -H 'Content-Type: text/plain' -d "$REGISTRY_PASSWORD" "http://$NEXUS_HOST:$NEXUS_PORT/service/rest/v1/security/users/$REGISTRY_USER/change-password"
) )
echo "::endgroup::" echo "::endgroup::"

View File

@@ -93,9 +93,7 @@ jobs:
if: inputs.type == 'local' if: inputs.type == 'local'
env: env:
ID: ${{ inputs.id }} ID: ${{ inputs.id }}
run: | run: bash "./.github/e2e/${ID}/install.sh"
sudo -E bash ./.github/e2e/${ID}/install.sh
sudo chown $(id -u):$(id -g) -R ~/.docker
- -
name: Docker meta name: Docker meta
id: meta id: meta