-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
fix(buildPlugin) ensure the custom label is passed to node when adding custom platform #658
fix(buildPlugin) ensure the custom label is passed to node when adding custom platform #658
Conversation
…g custom platform Signed-off-by: Damien Duportal <[email protected]>
@@ -58,8 +58,8 @@ def call(Map params = [:]) { | |||
label = 'vm && linux' | |||
break | |||
default: | |||
echo "WARNING: Unknown platform '${platform}'. Agent label set to fallback value 'linux'" | |||
label = 'linux' | |||
echo "WARNING: Unknown Virtual Machine platform '${platform}'. Set useContainerAgent to 'true' unless you want to be in uncharted territory." |
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.
this still seems at odds with the documentation (ie this is supposed to support labels - so using a label (even a label expression if I read this doc correct) should be ok here and not produce a warning?)
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.
yep, updating the documentation is the next step 👍 thanks for pointing out, I would have forgotten to be honest.
We are trying to update the label models because the current one is not usable in 2023. Some examples:
- Should you expect
docker
to be available when specifyingmaven-windows
(no obvious answer of course :D). Which JDK should you have? - When you say
linux
, do you meanx86
orarm64
? With or without Docker Engine?
=> our current strategy is to move to explicit tags, #522 was driven by this idea. Becasue most of the labels are specified by the pipeline library, only edge cases uses custom labels.
=> a takeaway, I strongly suggest to change
buildPlugin(platforms: ['linux','windows'])
by
buildPlugin(
useContainerAgent: true,
configurations: [
[platform: 'linux', jdk: 11],
[platform: 'windows', jdk: 11],
])
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.
When you say linux, do you mean x86 or arm64? With or without Docker Engine?
I mean I do not care :) (currently as it was restricted - linux is ambiguos and the useage of it in this library has not helped plugin authors)..
But in reality it may depend on if this is actually allowing a label, or a label expression. If it would be a label expression then a developer could say linux && docker && x64
Would that pick up highmen
- as is very likely - but we should be able to make highmen
(and other expensive options) only available if a specific label is actually given. This may require a plugin (not sure off hand) but would seem like a useful thing to have to the wider community.
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.
Absolutely, our analysis matches yours! That would be the road to a (breaking) change in the provided labels on ci.jenkins.io.
The behavior in label matching you describe is the reason why, in 2021, for 2 months, we used ARM VM agents for a lot of builds without even knowing it, because linux
was resolved by both ARM and x86 machines.
=> As soon as Jenkins find an agent template matching the labels, it uses it.
We are thinking about a policy with looooong tags such as <os>-<cpu>-<qualifier>
but still note sure where to put the cursor with or without too much details as we have different dimensions but it might not be needed (or event wanted) to provide all of them:
- OS (Linux Ubuntu, Windows Core Server)
- OS version (22.04 for Ubuntu, 2019/2022 for Windows Core Server)
- size (such as
highmem
) - Compute type: VM, container
- Tools (
docker
,maven
,jdk17
) - Feature:
jdk-next
(for edge non stable JDK),experiemental
, etc. - Cloud/Location (
aws
,azure
, etc.) - Infrastructure (such as cluster name or region name:
doks
, etc.)
We though about the platform labeler plugin, but haven't look or tried closely. Any idea or tip is welcome.
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 correct - not sure about the warning given the documentation around this case.
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 am still unclear on the takeaway for plugins—what should they specify to build on
- A Linux VM with Docker available.
- A Windows container (without Docker).
?
Ideally, container agents (linux or windows) should be the default unless Docker engine is required. The function |
Right, my question is what |
I thought setting Good point! Short term (modulo the JDK version you might want to change):
would ensure that VM are used:
=> got plenty of feedback for improvement thanks! |
But the above will build on a Windows VM, right? So if the Windows branch can run fine in a container, then you can still specify |
Yes, absolutely (haven't thought about it). WDYT about an "explicit" docker request, something like
|
as for what if I do want to run the docker (linux containers) tests on windows (and such support was available)?
and for things that want windows containers
see how and this does not discuss |
* origin/master: Bump `hashicorp-tools` docker image to 0.5.163 (jenkins-infra#659) fix(buildPlugin) ensure the custom label is passed to node when adding custom platform (jenkins-infra#658) feat(buildPluginWithGradle) Add quality checks (jenkins-infra#652) hotfix(terraform) add spot toleration hotfix(terraform) add nodeselector Update updatecli version to v0.49.2 (jenkins-infra#657) fix(terraform): add toleration to use infracipool (jenkins-infra#655) Bump `hashicorp-tools` docker image to 0.5.162 (jenkins-infra#651)
…g custom platform (jenkins-infra#658) Signed-off-by: Damien Duportal <[email protected]>
As pointed out by @jglick and @jtnord (thanks folks 🍯 ) #522 introduced an issue to the
buildPlugin()
function when a custom platform is defined: https://github.com/jenkins-infra/pipeline-library/pull/522/files#r1177751286.For instance, if you call
buildPlugin(platforms['maven-windows'])
, it will spawn a node with thelinux
label (as fallback) while you should have a (Windows) node withmaven-windows
label.This PR fixes the behavior by using the values passed to the
platform
collection instead of fallbacking tolinux
but keeps a warning message to end users.It also adds unit test to catch this behavior (and improve existing unit tests around the default labels and usage of
useContainerAgent
in the hope that we would switch to container by default in the future)Note about the effect of this as it was surfaced by unwanted behaviors when dealing with Docker.
Jenkins infrastructure provides:
=> but some integration tests (using the jenkinsci/docker-fixture project) are trying to run linux containers if the
docker
CLI is detected. Running such tests on the Windows VMs of the infrastructure fails, because Windows Server only support Docker CE with Windows containers.