Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for the push_to_docker_hub workflow #36385

Merged
merged 10 commits into from
Oct 21, 2023

Conversation

soehms
Copy link
Member

@soehms soehms commented Oct 2, 2023

This is a follow up PR of #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 New GitHub workflow to continue our images on Docker Hub #36047 (comment)
  3. It implements improvements suggested by @saraedum in New GitHub workflow to continue our images on Docker Hub #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 #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

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

⌛ Dependencies

@github-actions
Copy link

Documentation preview for this PR (built with commit 5e7a4e3; changes) is ready! 🎉

@soehms
Copy link
Member Author

soehms commented Oct 10, 2023

It would be desirable if this PR was merged by the next stable release. The current existing code would assign its images to a wrong tag (the last rc tag).

@@ -75,7 +75,7 @@ ARG MAKE_BUILD=make-build
################################################################################
# Image containing the run-time dependencies for Sage #
################################################################################
FROM ubuntu:latest as run-time-dependencies
FROM ubuntu:jammy as run-time-dependencies
LABEL maintainer="Erik M. Bray <[email protected]>, Julian Rüth <[email protected]>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your name should appear here now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your name should appear here now

Done! Thanks for reviewing!

Copy link
Contributor

@mkoeppe mkoeppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 15, 2023
    
<!-- ^^^^^
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
@saraedum
Copy link
Member

@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?

Yes, these can be deleted.

vbraun pushed a commit to vbraun/sage that referenced this pull request Oct 17, 2023
    
<!-- ^^^^^
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
@soehms
Copy link
Member Author

soehms commented Oct 18, 2023

@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?

Yes, these can be deleted.

Thanks! I'll do this in another follow-up PR, which will be necessary since now the second job (which should push the micro_release to the sagemath tags) is failing due to a No space left on device error (see log of the 10.2.beta7 run).

@vbraun vbraun merged commit f909b0a into sagemath:develop Oct 21, 2023
14 of 21 checks passed
@soehms soehms deleted the push_to_docker_hub_fixes branch October 21, 2023 21:14
@soehms
Copy link
Member Author

soehms commented Oct 25, 2023

which will be necessary since now the second job (which should push the micro_release to the sagemath tags) is failing due to a No space left on device error (see log of the 10.2.beta7 run).

Maybe this was just a temporary problem. The run for 10.2.beta8 was successful again. But it's still not clear to me what happened.

Before the 10.2.beta7 release the new workflow produced images of 9.9 GB for the make-build target and of 3.1 GB for the make-micro-release target (all uncompressed size).

The failure because of disk quota is amazing since there should be more than 25 GB available for the job. I could repeat the behavior when running the job for 10.2.beta7 in my own fork repository. What could be the reason for this? Maybe because the target make-micro-release is reached after an intermediate step make-all? From docker/Dockerfile:

################################################################################
# Image with a full build of sage, ready to release.                           #
################################################################################
FROM make-all as make-release
RUN make micro_release

or what purpose do we need make all for these images? Anyway, if I try to skip this using new target:

FROM $MAKE_BUILD as make-micro
RUN make micro_release

with

docker build --build-arg MAKEFLAGS... --build-arg MAKE_BUILD="sagemath/sagemath-dev:develop" -f docker/Dockerfile --target=make-micro --tag sage .

I'm getting an even larger image with 10.4 GB. Any ideas what I'm doing wrong here?

Furthermore: What could have increased the needed disk space for 10.2.beta7?

@mkoeppe
Copy link
Contributor

mkoeppe commented Oct 25, 2023

Each RUN step in a Dockerfile creates a new filesystem layer. If you add files in one RUN step and remove them again in a following RUN step, the image size will not decrease.
In particular, when you create binaries in one RUN step and strip them in a following step, the resulting image will have both the unstripped binary and the stripped binary.

@mkoeppe
Copy link
Contributor

mkoeppe commented Oct 25, 2023

The free space on GitHub runners is broken into several volumes; run df -h to check.
Operations executed by the Docker daemon typically use space somewhere in /var, which does not have very much space.
You can adjust it as we do in https://github.com/sagemath/sage/blob/develop/.github/workflows/docker.yml#L148

@soehms
Copy link
Member Author

soehms commented Oct 26, 2023

Each RUN step in a Dockerfile creates a new filesystem layer. If you add files in one RUN step and remove them again in a following RUN step, the image size will not decrease. In particular, when you create binaries in one RUN step and strip them in a following step, the resulting image will have both the unstripped binary and the stripped binary.

Thanks! That's reasonable!

@soehms
Copy link
Member Author

soehms commented Oct 26, 2023

The free space on GitHub runners is broken into several volumes; run df -h to check. Operations executed by the Docker daemon typically use space somewhere in /var, which does not have very much space.

That sounds reasonable, too. I guess that cached docker images are not cleared after a run.

You can adjust it as we do in https://github.com/sagemath/sage/blob/develop/.github/workflows/docker.yml#L148

Many thanks for the hint. I will include that step in the next PR.

@soehms
Copy link
Member Author

soehms commented Nov 13, 2023

@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?

Yes, these can be deleted.

This will be done in #36716 !

@soehms
Copy link
Member Author

soehms commented Nov 13, 2023

The free space on GitHub runners is broken into several volumes; run df -h to check. Operations executed by the Docker daemon typically use space somewhere in /var, which does not have very much space. You can adjust it as we do in https://github.com/sagemath/sage/blob/develop/.github/workflows/docker.yml#L148

This is in #36716, as well!

vbraun pushed a commit to vbraun/sage that referenced this pull request Dec 9, 2023
…kflow

    
<!-- ^^^^^
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 PR implements the suggested changes of
sagemath#36385. Furthermore, it enables the
workflow to detect whether the current tag has already been pushed to
Docker Hub. Thus, if the workflow run on pushing the tag fails due to a
timeout this gives us the possibility to have a scheduler try for a
second or third time (I add a cron for Tuesday and Thursday). Such
timeouts (after 6 hours for a job) seem to happen sporadically, even
though each of the both jobs usually succeeds in less than 4 hours.

I also improve the code structure be refactoring to a reusable workflow
`docker_hub.yml`.

I tested the changes in my fork repository. To prevent from overriding
the existing tags `10.2.rc0` and `develop` I temporarily changed the tag
names to `10.2.rc0t` and `developt` for the test runs. Here is a
[successful run](https://github.com/soehms/sage/actions/runs/6814399805)
that created these tags on Docker Hub. To avoid confusion I've removed
them again. A test-run on existing tags which should skip the subsequent
steps is [this
one](https://github.com/soehms/sage/actions/runs/6828167406).

FYI: I also updated the
[README](https://hub.docker.com/r/sagemath/sagemath) on Docker Hub.
Please have a look and make corrections / additions there if necessary.


### 📝 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#36716
Reported by: Sebastian Oehms
Reviewer(s): Matthias Köppe, Sebastian Oehms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants