Skip to content

CI: Include Python version in cache.config key #111410

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 2 commits into from
Oct 28, 2023

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Oct 27, 2023

Yesterday, the actions/setup-python updated the Python version 3.x from 3.11 to 3.12 which caused build failures in the "Configure CPython" step of the check_generated_files job:

configure: loading cache config.cache
configure: error: `PKG_CONFIG_PATH' has changed since the previous run:
configure:   former value:  `/opt/hostedtoolcache/Python/3.11.6/x64/lib/pkgconfig'
configure:   current value: `/opt/hostedtoolcache/Python/3.12.0/x64/lib/pkgconfig'
configure: error: in `/home/runner/work/cpython/cpython':
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm config.cache'
	    and start over
Error: Process completed with exit code 1.

https://github.com/python/cpython/actions/runs/6658472864/job/18096250159

Deleting the check_generated_files-Linux-52d68ba849d6fda1735c7031561b5102961493401ad71cfb10f4fcbca7a3c9d4 file from https://github.com/python/cpython/actions/caches and restarting the job, fixed it (the filename was shown in the "Restore config.cache" step.

The root problem is the Python version isn't part of the cache file's key.

We need to include it, so when the version changes, there'll be a new key, and so the old cache file won't be used anymore (and eventually deleted), and a new one will be generated.

So let's add ${{ env.pythonLocation }} to the key used by actions/cache.

Copy link
Contributor

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks for figuring it out and fixing!

@hugovk hugovk merged commit 9d4a1a4 into python:main Oct 28, 2023
@hugovk hugovk deleted the ci-cache.config-key branch October 28, 2023 07:23
@hugovk hugovk added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Oct 28, 2023
@miss-islington-app
Copy link

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

@miss-islington-app
Copy link

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 28, 2023
* Include Python version in cache.config key, after Python setup

* Remove EOL 3.7 from branch triggers
(cherry picked from commit 9d4a1a4)

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

bedevere-app bot commented Oct 28, 2023

GH-111421 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 Oct 28, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 28, 2023
* Include Python version in cache.config key, after Python setup

* Remove EOL 3.7 from branch triggers
(cherry picked from commit 9d4a1a4)

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

bedevere-app bot commented Oct 28, 2023

GH-111422 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 Oct 28, 2023
hugovk added a commit that referenced this pull request Oct 28, 2023
…11422)

CI: Include Python version in cache.config key (GH-111410)

* Include Python version in cache.config key, after Python setup

* Remove EOL 3.7 from branch triggers
(cherry picked from commit 9d4a1a4)

Co-authored-by: Hugo van Kemenade <[email protected]>
hugovk added a commit that referenced this pull request Oct 28, 2023
…11421)

CI: Include Python version in cache.config key (GH-111410)

* Include Python version in cache.config key, after Python setup

* Remove EOL 3.7 from branch triggers
(cherry picked from commit 9d4a1a4)

Co-authored-by: Hugo van Kemenade <[email protected]>
iritkatriel pushed a commit to iritkatriel/cpython that referenced this pull request Oct 29, 2023
* Include Python version in cache.config key, after Python setup

* Remove EOL 3.7 from branch triggers
@hugovk hugovk added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Oct 31, 2023
@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.12.
🐍🍒⛏🤖

@hugovk hugovk removed needs backport to 3.12 only security fixes needs backport to 3.11 only security fixes labels Oct 31, 2023
@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 9d4a1a480b65196c3aabbcd2d165d1fb86d0c8e5 3.11

@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 9d4a1a480b65196c3aabbcd2d165d1fb86d0c8e5 3.12

@hugovk
Copy link
Member Author

hugovk commented Oct 31, 2023

This was already backported 🙃

aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
* Include Python version in cache.config key, after Python setup

* Remove EOL 3.7 from branch triggers
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
* Include Python version in cache.config key, after Python setup

* Remove EOL 3.7 from branch triggers
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.

3 participants