-
Notifications
You must be signed in to change notification settings - Fork 14
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
Shift a couple of stages from Jenkinsfile into Dockerfile #364
Conversation
3bbead2
to
0736d98
Compare
0736d98
to
4041bfb
Compare
The Jenkins job on our new deployment is running Docker containers with the option `-u 1000:1000` instead of `-u 0:0` which results in permissions issues when doing administrative things such as using `apt-get` to install stuff. So this commit moves the install stages of the test run into a Dockerfile, so that the image which is all nicely configured can then be used to run the tests. Relates to NGC-1447.
4041bfb
to
890d049
Compare
This job is working on the Jenkins test instance barring the fact that the agent doesn't have multicast loopback (which I haven't configured yet on the test agent), so I guess it's a good sign? |
The test passes on old Jenkins though so that's helpful. |
The linting checks are failing on Github Actions. |
Dockerfile.CI
Outdated
# Copyright (c) 2024, National Research Foundation (SARAO) | ||
# |
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.
# Copyright (c) 2024, National Research Foundation (SARAO) | |
# | |
# Copyright 2024 National Research Foundation (SARAO) |
For consistency with other files.
Dockerfile.CI
Outdated
RUN apt-get update && apt-get -y --no-install-recommends install libpython3-dev python3-venv jq iproute2 | ||
RUN python3 -m venv /venv | ||
RUN .ci/install-sys-pkgs.sh | ||
RUN PATH="/venv/bin:$PATH" .ci/py-requirements.sh | ||
|
||
# Install Python package | ||
RUN PATH="/venv/bin:$PATH" pip install -v \ | ||
--config-settings=setup-args=--native-file=ci.ini \ | ||
--config-settings=setup-args=-Dibv=enabled \ | ||
--config-settings=setup-args=-Dibv_hw_rate_limit=enabled \ | ||
--config-settings=setup-args=-Dmlx5dv=enabled \ | ||
. | ||
|
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.
I think I'd prefer to just use the Dockerfile for the stuff that needs to be done as root. I feel like one gets better debuggability if the steps that work on the code under test are done in Jenkinsfile stages so that you can get a clear stage view of what happened, how long each stage took etc, rather than just "the Dockerfile failed to build".
RUN apt-get update && apt-get -y --no-install-recommends install libpython3-dev python3-venv jq iproute2 | |
RUN python3 -m venv /venv | |
RUN .ci/install-sys-pkgs.sh | |
RUN PATH="/venv/bin:$PATH" .ci/py-requirements.sh | |
# Install Python package | |
RUN PATH="/venv/bin:$PATH" pip install -v \ | |
--config-settings=setup-args=--native-file=ci.ini \ | |
--config-settings=setup-args=-Dibv=enabled \ | |
--config-settings=setup-args=-Dibv_hw_rate_limit=enabled \ | |
--config-settings=setup-args=-Dmlx5dv=enabled \ | |
. | |
RUN apt-get update && apt-get -y --no-install-recommends install libpython3-dev python3-venv jq iproute2 | |
RUN .ci/install-sys-pkgs.sh |
Also change COPY . .
to just copy install-sys-pkgs.sh
. At present any code change will invalidate the entire Dockerfile, so you're not going to get any caching.
Jenkinsfile
Outdated
label 'spead2' | ||
filename 'Dockerfile.CI' |
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 take my suggestions above, the Dockerfile only needs the .ci directory, so it can move to .ci/Dockerfile
and change this to
filename 'Dockerfile.CI' | |
dir '.ci' |
Bruce makes the argument that the Dockerfile should only contain things that need to be done as root. I don't have a strong opinion on the topic so I am accommodating this.
Didn't need the directory because it's in the same folder as the file it's copying.
The second one needed to be corrected too.
e9d3190
to
f97db81
Compare
Making a venv at /venv requires root permissions as well, as it turns out. Using it will be as well so we chown it.
1965cb0
to
2bf3f2e
Compare
Fair points all round, and I have addressed your feedback as far as I am able. I am now running into issues with files not being found in meson:
see here. I'm not quite clear as to which file is missing though: it looks as though it's complaining both about the |
I'll investigate. |
My guess would be that it's because install-sys-pkgs.sh is creating the ci.ini in $HOME, but $HOME during the docker build probably doesn't match the $HOME during the test. I think let me see if I can rework things to write the ci.ini in the workspace rather than somewhere in $HOME, since I'm not sure we can rely on having a $HOME in the Jenkins case (particularly if the agent doesn't use UID 1000). |
- Move venv creation back to Jenkinsfile, and create it inside the workspace - Remove native.ini for Linux and use it on MacOS only - Update Jenkins install step to use setup-flags.sh.
Rework for Jenkins testing
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.
Looks good, just some corrections to the copyright block. Feel free to merge after fixing those.
Co-authored-by: Bruce Merry <[email protected]>
The Jenkins job on our new deployment is running Docker containers with the option
-u 1000:1000
instead of-u 0:0
which results in permissions issues when doing administrative things such as usingapt-get
to install stuff.So this commit moves the install stages of the test run into a Dockerfile, so that the image which is all nicely configured can then be used to run the tests.
Relates to NGC-1447.