diff --git a/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java b/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java index 1eb2f725c5..30d4190e4c 100755 --- a/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java +++ b/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStep.java @@ -68,6 +68,9 @@ public class PodTemplateStep extends Step implements Serializable { private Boolean showRawYaml; + private String runAsUser; + private String runAsGroup; + @DataBoundConstructor public PodTemplateStep() {} @@ -273,7 +276,7 @@ public void setImagePullSecrets(List imagePullSecrets) { } } - + public String getYaml() { return yaml; } @@ -305,6 +308,24 @@ public void setShowRawYaml(boolean showRawYaml) { this.showRawYaml = Boolean.valueOf(showRawYaml); } + public String getRunAsUser(){ + return this.runAsUser; + } + + @DataBoundSetter + public void setRunAsUser(String runAsUser) { + this.runAsUser = runAsUser; + } + + public String getRunAsGroup(){ + return this.runAsGroup; + } + + @DataBoundSetter + public void setRunAsGroup(String runAsGroup) { + this.runAsGroup = runAsGroup; + } + @Extension public static class DescriptorImpl extends StepDescriptor { diff --git a/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStepExecution.java b/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStepExecution.java index 5b480f2ac0..0cafd0c94e 100755 --- a/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStepExecution.java +++ b/src/main/java/org/csanchez/jenkins/plugins/kubernetes/pipeline/PodTemplateStepExecution.java @@ -113,6 +113,8 @@ public boolean start() throws Exception { newTemplate.setNodeSelector(step.getNodeSelector()); newTemplate.setNodeUsageMode(step.getNodeUsageMode()); newTemplate.setServiceAccount(step.getServiceAccount()); + newTemplate.setRunAsUser(step.getRunAsUser()); + newTemplate.setRunAsGroup(step.getRunAsGroup()); if (step.getHostNetwork() != null) { newTemplate.setHostNetwork(step.getHostNetwork()); }