-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-17904] allow to configure labels per node
in certain cases one doesn't want to have all the generated labels one certain nodes. Additionally add a global configuration for the labels This might also fix JENKINS-17615. The problem might be that the Node object gets detroyed and recreated when a node config changes while the associated Computer is untouched when the connection itself is unchanged (e.g. just a label change). I noticed that when chaning the nodeproperty my changes didn't get reflected. Only after caching the computer it started working.
- Loading branch information
1 parent
3445016
commit 738cd2b
Showing
24 changed files
with
531 additions
and
114 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
80 changes: 80 additions & 0 deletions
80
src/main/java/org/jvnet/hudson/plugins/platformlabeler/LabelConfig.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,80 @@ | ||
package org.jvnet.hudson.plugins.platformlabeler; | ||
|
||
import hudson.Extension; | ||
import hudson.model.AbstractDescribableImpl; | ||
import hudson.model.Descriptor; | ||
import org.jenkinsci.Symbol; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
import org.kohsuke.stapler.DataBoundSetter; | ||
|
||
/** Stores configuration about labels to generate */ | ||
public class LabelConfig extends AbstractDescribableImpl<LabelConfig> { | ||
|
||
private boolean architecture = true; | ||
private boolean name = true; | ||
private boolean version = true; | ||
private boolean architectureName = true; | ||
private boolean nameVersion = true; | ||
private boolean architectureNameVersion = true; | ||
|
||
@DataBoundConstructor | ||
public LabelConfig() {} | ||
|
||
public boolean isArchitecture() { | ||
return architecture; | ||
} | ||
|
||
@DataBoundSetter | ||
public void setArchitecture(boolean arch) { | ||
this.architecture = arch; | ||
} | ||
|
||
public boolean isName() { | ||
return name; | ||
} | ||
|
||
@DataBoundSetter | ||
public void setName(boolean name) { | ||
this.name = name; | ||
} | ||
|
||
public boolean isVersion() { | ||
return version; | ||
} | ||
|
||
@DataBoundSetter | ||
public void setVersion(boolean version) { | ||
this.version = version; | ||
} | ||
|
||
public boolean isArchitectureName() { | ||
return architectureName; | ||
} | ||
|
||
@DataBoundSetter | ||
public void setArchitectureName(boolean archName) { | ||
this.architectureName = archName; | ||
} | ||
|
||
public boolean isNameVersion() { | ||
return nameVersion; | ||
} | ||
|
||
@DataBoundSetter | ||
public void setNameVersion(boolean nameVersion) { | ||
this.nameVersion = nameVersion; | ||
} | ||
|
||
public boolean isArchitectureNameVersion() { | ||
return architectureNameVersion; | ||
} | ||
|
||
@DataBoundSetter | ||
public void setArchitectureNameVersion(boolean archNameVersion) { | ||
this.architectureNameVersion = archNameVersion; | ||
} | ||
|
||
@Extension | ||
@Symbol("platformlabelerconfig") | ||
public static class DescriptorImpl extends Descriptor<LabelConfig> {} | ||
} |
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
49 changes: 49 additions & 0 deletions
49
src/main/java/org/jvnet/hudson/plugins/platformlabeler/PlatformDetails.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,49 @@ | ||
package org.jvnet.hudson.plugins.platformlabeler; | ||
|
||
import java.io.Serializable; | ||
|
||
/** Stores the platform details of a node */ | ||
public class PlatformDetails implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
private final String name; | ||
private final String architecture; | ||
private final String version; | ||
private final String architectureNameVersion; | ||
private final String architectureName; | ||
private final String nameVersion; | ||
|
||
public PlatformDetails(String name, String architecture, String version) { | ||
this.name = name; | ||
this.architecture = architecture; | ||
this.version = version; | ||
architectureNameVersion = architecture + "-" + name + "-" + version; | ||
architectureName = architecture + "-" + name; | ||
nameVersion = name + "-" + version; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getArchitecture() { | ||
return architecture; | ||
} | ||
|
||
public String getVersion() { | ||
return version; | ||
} | ||
|
||
public String getArchitectureNameVersion() { | ||
return architectureNameVersion; | ||
} | ||
|
||
public String getArchitectureName() { | ||
return architectureName; | ||
} | ||
|
||
public String getNameVersion() { | ||
return nameVersion; | ||
} | ||
} |
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
Oops, something went wrong.