Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit fb599d0

Browse files
author
Release Manager
committed
Trac #30933: GH Actions: Repair upload of docker images to docker.pkg.github.com
These docker images are built by the portability CI workflows for Linux. However, refactoring of the workflow had broken the upload to `docker.pkg.github.com`. (Although the login to `docker.pkg.github.com` succeeds, the push fails with `no basic auth credentials` - see https://github.com/mkoeppe/sage/runs/1414148202?check_suite_focus=true) URL: https://trac.sagemath.org/30933 Reported by: mkoeppe Ticket author(s): Matthias Koeppe Reviewer(s): Dima Pasechnik
2 parents 7f8ee0f + 21afe51 commit fb599d0

File tree

4 files changed

+6
-0
lines changed

4 files changed

+6
-0
lines changed

.github/workflows/tox-experimental.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
fi
8484
if echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin; then
8585
echo "DOCKER_PUSH_REPOSITORY=docker.pkg.github.com/${{ github.repository }}/" >> $GITHUB_ENV
86+
echo "DOCKER_CONFIG_FILE=$HOME/.docker/config.json" >> $GITHUB_ENV
8687
fi
8788
- run: |
8889
set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;"

.github/workflows/tox-optional.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
fi
8484
if echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin; then
8585
echo "DOCKER_PUSH_REPOSITORY=docker.pkg.github.com/${{ github.repository }}/" >> $GITHUB_ENV
86+
echo "DOCKER_CONFIG_FILE=$HOME/.docker/config.json" >> $GITHUB_ENV
8687
fi
8788
- run: |
8889
set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;"

.github/workflows/tox.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ jobs:
7676
fi
7777
if echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin; then
7878
echo "DOCKER_PUSH_REPOSITORY=docker.pkg.github.com/${{ github.repository }}/" >> $GITHUB_ENV
79+
echo "DOCKER_CONFIG_FILE=$HOME/.docker/config.json" >> $GITHUB_ENV
7980
fi
8081
- run: |
8182
set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;"

tox.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ passenv =
138138
docker: DOCKER_TARGETS
139139
# If set, we use this prefix and push to it
140140
docker: DOCKER_PUSH_REPOSITORY
141+
# If set, we symlink this file into {envdir}/.docker/; this can be used for providing credentials for pushing
142+
docker: DOCKER_CONFIG_FILE
141143
local: MAKE
142144
local: PREFIX
143145
local: SAGE_NUM_THREADS
@@ -593,6 +595,7 @@ commands =
593595
# From https://hub.docker.com/r/multiarch/ubuntu-core/
594596
# configure binfmt-support on the Docker host (works locally or remotely, i.e: using boot2docker)
595597
docker-{arm64,armhf}: docker run --rm --privileged multiarch/qemu-user-static:register --reset
598+
docker: bash -c 'if [ x"{env:DOCKER_CONFIG_FILE:}" != x ]; then mkdir -p {envdir}/.docker && ln -sf $(realpath "{env:DOCKER_CONFIG_FILE:}") {envdir}/.docker/; fi'
596599
docker: bash -c 'for docker_target in {env:DOCKER_TARGETS:with-targets}; do \
597600
docker: BUILD_TAG={env:DOCKER_PUSH_REPOSITORY:}sage-{envname}-$docker_target:$(git describe --dirty --always); \
598601
docker: DOCKER_BUILDKIT={env:DOCKER_BUILDKIT:0} \

0 commit comments

Comments
 (0)