-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-60537] Fix support of pod templates with multiple labels
- Loading branch information
Showing
2 changed files
with
30 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/test/java/org/csanchez/jenkins/plugins/kubernetes/PodTemplateJenkinsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.csanchez.jenkins.plugins.kubernetes; | ||
|
||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.jvnet.hudson.test.Issue; | ||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
public class PodTemplateJenkinsTest { | ||
@Rule | ||
public JenkinsRule j = new JenkinsRule(); | ||
|
||
@Test | ||
@Issue("JENKINS-60537") | ||
public void singleLabel() { | ||
PodTemplate podTemplate = new PodTemplate(); | ||
podTemplate.setLabel("foo"); | ||
assertEquals("foo" , podTemplate.getLabelsMap().get("jenkins/label")); | ||
} | ||
|
||
@Test | ||
@Issue("JENKINS-60537") | ||
public void multiLabel() { | ||
PodTemplate podTemplate = new PodTemplate(); | ||
podTemplate.setLabel("foo bar"); | ||
assertEquals("foo bar", podTemplate.getLabelsMap().get("jenkins/label")); | ||
} | ||
} |
89d6282
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.
Hello.
Have you tried this fix on kubernetes?
API is complaining
Error from server (BadRequest): Unable to find "/v1, Resource=pods" that match label selector "jenkins=slave,jenkins/label=base linux", field selector "": found 'linux', expected: ',' or 'end of string'
Basically kubernetes api is not able to handle labels separated by blank space.
Best.