-
Notifications
You must be signed in to change notification settings - Fork 37.7k
CI: Bump CI Lint base image from bionic to jammy #26581
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
Conversation
Bump lint task base image from bionic to jammy
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
CC @hebasto & @MarcoFalke |
( | ||
# Temporary workaround for https://github.com/bitcoin/bitcoin/pull/26130#issuecomment-1260499544 | ||
# Can be removed once the underlying image is bumped to something that includes git2.34 or later | ||
sed -i -e 's/bionic/jammy/g' /etc/apt/sources.list | ||
${CI_RETRY_EXE} apt-get update | ||
${CI_RETRY_EXE} apt-get install -y --reinstall git | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this removal be a part of the first commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, as the first commit just addresses bumping the version. This addresses actually removing the sources for making way for pyenv
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removed lines were a workaround to deal with an old/broken git version in Ubuntu Bionic. After bumping to Bionic, it is no longer required. And it has nothing to do with pyenv. That's why I still believe this change belongs to the first commit.
This patch: - Sets up a cache in .cirrus.yml for pyenv's building of python 3.6.15 at the location /tmp/python-build/ - Uses Operating System ($CIRRUS_OS), .python-version and checks the contents of the install scripts for calculating the hash of the cache - Installs necessary build libraries for building python with pyenv - Installs pyenv, runs init scripts and adds it to the path - Checks if a python cache is available and copies it to pyenv's version directories. If not, install it - And copies the python version in pyenv to the intermediary cache directory (It's up to Cirrus to decide if to cache it or not)
Just quickly amended my commit as I forgot pyenv complains about python versions being already present |
- cat ./ci/lint_run_all.sh | ||
- cat ./ci/lint/*.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you change the lint scripts (which might change how you interact with the cache), you'd want to be able to test that no? And if you do end up changing how caching works. You'd want a new cache uploaded wouldn't you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still trying to understand you, but we don't want to consume resources to rebuild python after every change in linter scripts. What kind of such changes could lead to different python binaries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consume? I wouldn't say so, 2 cores and 4G of RAM are small amounts nowadays. If you really want to be specific, then I could put the python build scripts into a separate file and cat only that. Or if you really really want to make sure you don't waist any resources, then a separate task which builds python in the Cirrus CI is needed
This:
does not look correct, does it? |
Here is an alternative implementation, which:
@robigan Feel free to cherry-pick it into this PR. NOTE: To test the lint CI task in a personal Cirrus account, the patch from #20728 is required. For example: |
Both implementations are just as good. But I'll provide further comment in the morning, it's late and I am tipsy so I need some good sleep before I do anything |
Yes I noticed this, I ignored it because it wasn't affecting the linting process in any way, but is worth addressing. Clang could be a good alternative. And we can skip using python-build from pyenv and set the flags right from the pyenv install script. Although it doesn't address the fact that it seems it has got to do with openssl instead of fixing it with clang, as pointed out by the issue you linked. |
Python-build can be used if we so wish, as I have said, using pyenv executable just makes maintaining this easier. And if we so wish to use clang, we can still use pyenv. And what do you mean by it doesn't use other tools? It's all the same thing. |
Copying of the cache is hardly an issue, copy takes less than a second. That's if you're coming from a resource waste point of view. If it's for simplicity's sake, then yes I agree. And for the record it was @MarcoFalke's idea to bump resources used by the linting task. If we want to do this the right way, then the building of python itself should be done in a separate Cirrus CI Task, and then by using caches, deploy the caches as needed to other tasks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we have a self-compiled Python, the python3-pip
package can be dropped now, right?
After the first commit, the lint task uses the system Python which is not v3.6.15. It is the reason to re-order commits.
Regarding resources, I'll try to clarify my statement. It is not about resources actually consumed by a task. Rather about the requested amount of resources, because they do affect the scheduling time when using Cirrus Community Cluster. See: https://cirrus-ci.org/guide/linux/
${CI_RETRY_EXE} apt-get install -y make build-essential libssl-dev zlib1g-dev \ | ||
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \ | ||
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming that those packages are required to build the Python, why are they installed every time, regardless of using of the cached Python?
The curl
package was installed two lines above.
Why are llvm
, xz-utils
and libffi-dev
packages required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The packages listed there is an exact copy as detailed by the pyenv docs. As I have said, my concern is making it as maintainable as possible
Going to re-run the lint task manually, to check it with the cached Python. |
Then in that case I do strongly believe that making a separate task which only builds python is the best way |
Are you still working on this? See also #26637 |
No response here, so closing in favour of #26716. |
Yeah no haven't been able to work on this given that I have family |
123043e ci: Bump lint task image to Ubuntu Jammy (Hennadii Stepanov) 9b86114 ci: Use pyenv's `python-build` to install Python in lint task (Hennadii Stepanov) Pull request description: This PR: - is an alternative to #26581 and #26637 - closes #26548 Key advantages of this PR over others: - it uses pyenv's `python-build` [standalone](https://github.com/pyenv/pyenv/tree/master/plugins/python-build#using-python-build-standalone) - requires no additional computational resources Note for testing. The lint task must success regardless of whether the `python_cache` is populated or invalidated. ACKs for top commit: MarcoFalke: ACK 123043e fanquake: ACK 123043e Tree-SHA512: ba0fcdd4f2939a59692b173dcd1f5704444cfcfbb8111538c6f8160056d0536bba250e4f9b0f8c66f8b454e52034bf36ffe6afae76cdc0f7cc5b58b576d790ba
123043e ci: Bump lint task image to Ubuntu Jammy (Hennadii Stepanov) 9b86114 ci: Use pyenv's `python-build` to install Python in lint task (Hennadii Stepanov) Pull request description: This PR: - is an alternative to bitcoin#26581 and bitcoin#26637 - closes bitcoin#26548 Key advantages of this PR over others: - it uses pyenv's `python-build` [standalone](https://github.com/pyenv/pyenv/tree/master/plugins/python-build#using-python-build-standalone) - requires no additional computational resources Note for testing. The lint task must success regardless of whether the `python_cache` is populated or invalidated. ACKs for top commit: MarcoFalke: ACK 123043e fanquake: ACK 123043e Tree-SHA512: ba0fcdd4f2939a59692b173dcd1f5704444cfcfbb8111538c6f8160056d0536bba250e4f9b0f8c66f8b454e52034bf36ffe6afae76cdc0f7cc5b58b576d790ba
As the title says, this PR aims to address #26548 by switching the lint CI job from ubuntu's bionic base image which has python 3.6.5 to ubuntu jammy and use pyenv to install the correct python version as dictated in the project's .python-version file.
DISCLAIMER: This PR is a copy of #26572 as there were issues with that PR and how merging and squashing from the master branch were done