[JIRA] (JENKINS-57830) Better default for PodTemplateStep.label

14 views
Skip to first unread message

jglick@cloudbees.com (JIRA)

unread,
Jun 3, 2019, 10:27:01 PM6/3/19
to jenkinsc...@googlegroups.com
Jesse Glick created an issue
 
Jenkins / Improvement JENKINS-57830
Better default for PodTemplateStep.label
Issue Type: Improvement Improvement
Assignee: Carlos Sanchez
Components: kubernetes-plugin
Created: 2019-06-04 02:26
Labels: ux
Priority: Major Major
Reporter: Jesse Glick

Various examples in documentation and tests either set a hard-coded label for the podTemplate step, which is a race condition waiting to happen, or use ugly Groovy scripting with UUID.randomUUID(). These would better be simplified to use the standard Jenkins environment variable BUILD_TAG, which is unique per build and is also meaningful to humans trying to debug label assignments and node provisioning:

podTemplate(label: BUILD_TAG, containers: [containerTemplate(name: 'ubuntu', image: 'ubuntu', command: 'sleep', args: 'infinity')]) {
    node (BUILD_TAG) {
        container('ubuntu') {
            sh 'whoami'
        }
    }
}

For Declarative, there is no good reason to force the user to define the label at all (see Declarative tests using label: '...'); KubernetesDeclarativeAgent.label could simply be defaulted to something such as BUILD_TAG.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jglick@cloudbees.com (JIRA)

unread,
Jun 4, 2019, 6:21:02 PM6/4/19
to jenkinsc...@googlegroups.com
Jesse Glick commented on Improvement JENKINS-57830
 
Re: Better default for PodTemplateStep.label

BUILD_TAG will not work, however, in cases where the job name is not a label K8s label.

jglick@cloudbees.com (JIRA)

unread,
Jun 6, 2019, 8:01:01 PM6/6/19
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Jun 12, 2019, 3:53:01 PM6/12/19
to jenkinsc...@googlegroups.com

jglick@cloudbees.com (JIRA)

unread,
Jul 9, 2019, 4:09:20 PM7/9/19
to jenkinsc...@googlegroups.com
Jesse Glick assigned an issue to Jesse Glick
Change By: Jesse Glick
Assignee: Carlos Sanchez Jesse Glick

jglick@cloudbees.com (JIRA)

unread,
Jul 9, 2019, 4:09:20 PM7/9/19
to jenkinsc...@googlegroups.com
Jesse Glick started work on Improvement JENKINS-57830
 
Change By: Jesse Glick
Status: Open In Progress

jglick@cloudbees.com (JIRA)

unread,
Jul 9, 2019, 6:02:03 PM7/9/19
to jenkinsc...@googlegroups.com

vincent@latombe.net (JIRA)

unread,
Jul 10, 2019, 5:38:02 AM7/10/19
to jenkinsc...@googlegroups.com
Change By: Vincent Latombe
Status: In Review Fixed but Unreleased
Resolution: Fixed

vincent@latombe.net (JIRA)

unread,
Jul 10, 2019, 8:07:05 AM7/10/19
to jenkinsc...@googlegroups.com
Change By: Vincent Latombe
Status: Fixed but Unreleased Resolved
Released As: 1.17.0
Reply all
Reply to author
Forward
0 new messages