Skip to content

Commit

Permalink
Allow runAsUser and runAsGroup to be set from the PodTemplateStep (#643)
Browse files Browse the repository at this point in the history
Allow runAsUser and runAsGroup to be set from the PodTemplateStep
  • Loading branch information
Vlatombe authored Nov 12, 2019
2 parents e8564e3 + 3f91dcd commit c2dd015
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public class PodTemplateStep extends Step implements Serializable {

private Boolean showRawYaml;

private String runAsUser;
private String runAsGroup;

@DataBoundConstructor
public PodTemplateStep() {}

Expand Down Expand Up @@ -273,7 +276,7 @@ public void setImagePullSecrets(List<String> imagePullSecrets) {
}
}


public String getYaml() {
return yaml;
}
Expand Down Expand Up @@ -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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down

0 comments on commit c2dd015

Please sign in to comment.