Skip to content

CI: Use ImageOS (ubuntu24) instead of runner.os (Linux) in cache keys #130200

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

Merged
merged 1 commit into from
Feb 17, 2025

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Feb 16, 2025

Problem

In #129834 we recently switched the ubuntu-24.04-arm runners to ubuntu-22.04-arm.

However, the CI jobs consistently broken due to an unknown GCC option:

After clearing the config caches, a re-run passed:

This was the cache key for "Restore config.cache" is:

key: ${{ github.job }}-${{ runner.os }}-${{ env.IMAGE_VERSION }}-${{ inputs.config_hash }}

Which evaluates to build_ubuntu_reusable-Linux-0.0.10-9cf14f6717fb4cec718ff086229088aa00b4e898b87da1d8f14119ec638f68e7 for both runners.

That is because runner.os is Linux and env.IMAGE_VERSION is 0.0.10 for both.

So they both used the same cache.

Fix

env.IMAGE_VERSION comes from $ImageVersion, and there's also a $ImageOS which gives ubuntu22 or ubuntu24.

This will give us a fresh cache when we next change the OS version.

@hugovk hugovk added the infra CI, GitHub Actions, buildbots, Dependabot, etc. label Feb 16, 2025
Comment on lines -65 to -66
- name: Runner image version
run: echo "IMAGE_VERSION=${ImageVersion}" >> "$GITHUB_ENV"
Copy link
Member Author

Choose a reason for hiding this comment

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

This was set but not used in this job.

Comment on lines +56 to +57
- name: "Runner image version"
run: echo "IMAGE_OS_VERSION=${ImageOS}-${ImageVersion}" >> "$GITHUB_ENV"
Copy link
Member Author

Choose a reason for hiding this comment

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

This wasn't being set in this job, so env.IMAGE_VERSION was evaluating as an empty string in the keys below.

@hugovk hugovk merged commit 3d7a141 into python:main Feb 17, 2025
57 checks passed
@hugovk hugovk deleted the 3.14-ci-cache-key branch February 17, 2025 11:53
@miss-islington-app
Copy link

Thanks @hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @hugovk, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 3d7a141c2f235b70dd6c2d64308022c4b77df131 3.13

@miss-islington-app
Copy link

Sorry, @hugovk, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 3d7a141c2f235b70dd6c2d64308022c4b77df131 3.12

hugovk added a commit to hugovk/cpython that referenced this pull request Feb 17, 2025
…he keys (pythonGH-130200)

(cherry picked from commit 3d7a141)

Co-authored-by: Hugo van Kemenade <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Feb 17, 2025

GH-130222 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Feb 17, 2025
hugovk added a commit to hugovk/cpython that referenced this pull request Feb 17, 2025
…he keys (pythonGH-130200)

(cherry picked from commit 3d7a141)

Co-authored-by: Hugo van Kemenade <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Feb 17, 2025

GH-130226 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Feb 17, 2025
@hugovk
Copy link
Member Author

hugovk commented Feb 18, 2025

And let's backport to 3.9-3.11 because they're still using ubuntu-20.04 which will be fully unsupported by 2025-04-01, so this fix is needed before we upgrade those:

#122566 (comment)

@hugovk hugovk added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Feb 18, 2025
@miss-islington-app
Copy link

Thanks @hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.9.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @hugovk, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 3d7a141c2f235b70dd6c2d64308022c4b77df131 3.10

@miss-islington-app
Copy link

Sorry, @hugovk, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 3d7a141c2f235b70dd6c2d64308022c4b77df131 3.11

@miss-islington-app
Copy link

Sorry, @hugovk, I could not cleanly backport this to 3.9 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 3d7a141c2f235b70dd6c2d64308022c4b77df131 3.9

@bedevere-app
Copy link

bedevere-app bot commented Feb 18, 2025

GH-130252 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Feb 18, 2025
@hugovk
Copy link
Member Author

hugovk commented Feb 18, 2025

And let's backport to 3.9-3.11 because they're still using ubuntu-20.04 which will be fully unsupported by 2025-04-01, so this fix is needed before we upgrade those:

#122566 (comment)

3.9 and 3.10 don't have these cache keys so don't need this backport.

@hugovk hugovk removed the needs backport to 3.9 only security fixes label Feb 18, 2025
@hugovk hugovk removed the needs backport to 3.10 only security fixes label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infra CI, GitHub Actions, buildbots, Dependabot, etc. skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants