Skip to content

Commit 6429f21

Browse files
author
Matthias Koeppe
committed
.github/workflows/docker.yml, tox.ini: Use the commit sha before merging the CI fixes as the DOCKER_TAG
1 parent 1cf0c13 commit 6429f21

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

.github/workflows/docker.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,6 @@ jobs:
179179
(export PATH=$(pwd)/build/bin:$PATH; (cd upstream && bash -x update-pkgs.sh) && sed -i.bak '/upstream/d' .dockerignore && echo "/:toolchain:/i ADD upstream upstream" | sed -i.bak -f - build/bin/write-dockerfile.sh && git diff)
180180
if: inputs.upstream_artifact
181181

182-
- name: Merge CI fixes from sagemath/sage
183-
run: |
184-
.ci/merge-fixes.sh
185-
env:
186-
GH_TOKEN: ${{ github.token }}
187-
188182
- name: Try to login to ghcr.io
189183
if: inputs.docker_push_repository != ''
190184
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
@@ -197,6 +191,9 @@ jobs:
197191
echo "DOCKER_PUSH_REPOSITORY=$(echo ${{ inputs.docker_push_repository }} | tr "[:upper:]" "[:lower:]")" >> $GITHUB_ENV
198192
echo "DOCKER_CONFIG_FILE=$HOME/.docker/config.json" >> $GITHUB_ENV
199193
fi
194+
# This line needs to be run before the step "Merge CI fixes from sagemath/sage".
195+
DOCKER_TAG="$(git describe --dirty --always)"
196+
echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV
200197
# From the docker documentation via .ci/update-env.sh:
201198
# "A tag name must be valid ASCII and may
202199
# contain lowercase and uppercase letters, digits, underscores, periods and
@@ -211,6 +208,15 @@ jobs:
211208
EXTRA_DOCKER_TAGS="dev $EXTRA_DOCKER_TAGS";;
212209
esac
213210
echo "EXTRA_DOCKER_TAGS=$EXTRA_DOCKER_TAGS" >> $GITHUB_ENV
211+
212+
- name: Merge CI fixes from sagemath/sage
213+
# This step needs to happen after the commit sha is put in DOCKER_TAG
214+
# so that multi-stage builds can work correctly.
215+
run: |
216+
.ci/merge-fixes.sh
217+
env:
218+
GH_TOKEN: ${{ github.token }}
219+
214220
- name: Configure and build Sage distribution within a Docker container
215221
run: |
216222
set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg NUMPROC=4 --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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ passenv =
142142
TARGETS_OPTIONAL
143143
docker: EXTRA_DOCKER_BUILD_ARGS
144144
docker: EXTRA_DOCKER_TAGS
145+
docker: DOCKER_TAG
145146
# Use DOCKER_BUILDKIT=1 for new version - for which unfortunately we cannot save failed builds as an image
146147
docker: DOCKER_BUILDKIT
147148
docker: BUILDKIT_INLINE_CACHE
@@ -699,7 +700,7 @@ commands =
699700
docker: bash -c 'for docker_target in {env:DOCKER_TARGETS:with-targets}; do \
700701
docker: BUILD_IMAGE_STEM=sage-$(echo {envname} | sed "s/docker-//;s/-incremental//"); \
701702
docker: BUILD_IMAGE=$DOCKER_PUSH_REPOSITORY$BUILD_IMAGE_STEM-$docker_target; \
702-
docker: BUILD_TAG=$(git describe --dirty --always); \
703+
docker: BUILD_TAG={env:DOCKER_TAG:$(git describe --dirty --always)}; \
703704
docker: TAG_ARGS=$(for tag in $BUILD_TAG {env:EXTRA_DOCKER_TAGS:}; do echo --tag $BUILD_IMAGE:$tag; done); \
704705
docker: DOCKER_BUILDKIT={env:DOCKER_BUILDKIT:0} \
705706
docker: docker build . -f {envdir}/Dockerfile \

0 commit comments

Comments
 (0)