-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[JENKINS-57548] Explicit inheritance should override implicit inheritance #480
Conversation
question, why would you nest two |
In declarative pipeline pipeline {
agent {
kubernetes {
label "foo-${UUID.randomUUID().toString()}"
yamlFile 'k8s/KubernetesLinuxPod.yaml'
}
}
stages {
...
# Other stages using parent container
...
stage('windows-openjdk8') {
agent {
kubernetes {
label "foo-ojdk8-${UUID.randomUUID().toString()}"
yamlFile 'k8s/KubernetesWindowsPod.yaml'
}
}
steps {
...
}
}
}
}
In this situation,
What do you think ? |
gotcha, makes sense. Maybe you want to also add a test for that declarative pipeline? |
7a06e4d
to
65bc651
Compare
Test added for declarative pipeline. |
65bc651
to
f50891f
Compare
Added README notice. |
yes, the empty |
Changing the default behaviour may be a migration problem for existing pod templates defined through pipeline. If we have a way to ensure this migration can be done smoothly, why not. |
I'm not sure how to proceed with changing the default behavior. It will be a breaking change that might impact existing pipeline. |
Hi all, Any idea on this ? Thanks |
Considering the current declarative syntax, I think it should be implicit that the kubernetes pod template definition shouldn't be inherited in this case. |
d521fd4
to
3ba8352
Compare
…ance. Declarative k8s template do not inherit from parent pod template by default.
3ba8352
to
02a0759
Compare
@Vlatombe the default behavior is now set for declarative agent templates. |
I have a use case that doesn't involve declarative either. I know this is OT on this PR. I need to start a new pod within another def withOtherPod(Closure body) {
def podLabel = "other-pod-${UUID.randomUUID()}"
podTemplate(
name: podLabel,
label: podLabel,
// Enough to re-enter the `node` in the parallel step
idleMinutes: 1,
yaml: '..'
) {
node(podLabel) {
// Set up the new pod
}
def finishedToken = 'finished'
try {
parallel(
'keepalive': {
node(podLabel) {
// Sleep essentially for forever, to keep this pod active
sleep(time: 100, unit: 'DAYS')
}
},
'work': {
body()
throw new Exception(finishedToken)
},
failFast: true
)
} catch(Exception e) {
if (e.getMessage() != finishedToken) {
throw e
}
}
}
} |
LGTM. @carlossg is it okay for you as well? |
No description provided.