Skip to content

Commit

Permalink
sagemathgh-36385: Fixes for the push_to_docker_hub workflow
Browse files Browse the repository at this point in the history
    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
<!-- If your change requires a documentation PR, please link it
appropriately. -->

This is a follow up PR of sagemath#36047. It does the following:

1. It fixes a wrong sort order for the tags that would cause a wrong tag
for stable releases
2. It enables the push of the `sagemath-dev:develop` and `sagemath-
dev:latest` tags according to my suggestion in
sagemath#36047 (comment)
3. It implements improvements suggested by @saraedum in sagemath#36047.
4. It contains the upgrades from the auto-generated *dependabot-
branches* for the Docker Hub GitHub App
(`dependabot/github_actions/docker/...`). Thus, as soon as this PR is
merged, these auto-generated branches can be deleted by a maintainer.

Still open is this suggestion from
sagemath#36047 (comment):

> Could we delete the gitlab setup in this PR as well? It's not working
anymore anyway

@saraedum What should be deleted explicitly? `.gitlab-ci.yml` and the
scripts used by it excludingly (`.ci/protect-secrets.sh`, `.ci/describe-
system.sh`)? Other sources?


### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#36385
Reported by: Sebastian Oehms
Reviewer(s): Matthias Köppe, Sebastian Oehms
  • Loading branch information
Release Manager committed Oct 18, 2023
2 parents 731be1c + ca58150 commit f909b0a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
32 changes: 9 additions & 23 deletions .github/workflows/push_to_docker_hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ on:
# Allow to run manually
branches:
- 'develop'
- 'docker_hub_gha'
push:
tags:
# Just create image on pushing a tag
Expand All @@ -14,6 +13,7 @@ on:
jobs:
sagemath-dev:
name: Build Docker image on target make-build and push to DockerHub sagemath-dev
# target make-build replaces former sagemath-dev, see https://github.com/sagemath/sage/pull/36047
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -25,10 +25,9 @@ jobs:
id: set_tag
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
TAG_NAME=$(git tag --sort=v:refname | tail -1)
TAG_NAME=$(git tag --sort=creatordate | tail -1)
TAG="sagemath/sagemath-dev:$TAG_NAME"
TAG_LIST="$TAG, sagemath/sagemath-dev:develop"
TAG_LIST="$TAG" # don't tag develop until meaning of sagemath-dev is clear
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "TAG=$TAG" >> $GITHUB_ENV
echo "TAG_LIST=$TAG_LIST" >> $GITHUB_ENV
Expand All @@ -37,30 +36,20 @@ jobs:
id: upd_tag_list
run: |
TAG_LIST="${{ env.TAG_LIST }}, sagemath/sagemath-dev:latest"
TAG_LIST="${{ env.TAG_LIST }}" # don't tag latest until meaning of sagemath-dev is clear
echo "TAG_LIST=$TAG_LIST" >> $GITHUB_ENV
if: "!contains(env.TAG_NAME, 'beta') && !contains(env.TAG_NAME, 'rc')"

- name: Check env
run: |
echo ${{ env.TAG_NAME }}
echo ${{ env.TAG }}
echo ${{ env.TAG_LIST }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push make-build
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
Expand All @@ -84,7 +73,7 @@ jobs:
id: set_tag
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
TAG_NAME=$(git tag --sort=v:refname | tail -1)
TAG_NAME=$(git tag --sort=creatordate | tail -1)
TAG="sagemath/sagemath:$TAG_NAME"
TAG_LIST="$TAG, sagemath/sagemath:develop"
BASE="sagemath/sagemath-dev:$TAG_NAME"
Expand All @@ -100,20 +89,17 @@ jobs:
echo "TAG_LIST=$TAG_LIST" >> $GITHUB_ENV
if: "!contains(env.TAG_NAME, 'beta') && !contains(env.TAG_NAME, 'rc')"

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push sagemath
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ ARG MAKE_BUILD=make-build
################################################################################
# Image containing the run-time dependencies for Sage #
################################################################################
FROM ubuntu:latest as run-time-dependencies
LABEL maintainer="Erik M. Bray <erik.bray@lri.fr>, Julian Rüth <julian.rueth@fsfe.org>"
FROM ubuntu:jammy as run-time-dependencies
LABEL maintainer="Erik M. Bray <erik.bray@lri.fr>, Julian Rüth <julian.rueth@fsfe.org>, Sebastian Oehms <seb.oehms@gmail.com>"
# Set sane defaults for common environment variables.
ENV LC_ALL C.UTF-8
ENV LANG C.UTF-8
Expand Down

0 comments on commit f909b0a

Please sign in to comment.