Skip to content

The Unified and Autonomous Development Platform

feat: additional options for docker image build step (#1386)

Robin Shen14df332df035
diff --git a/pom.xml b/pom.xml
index eafcb25997..d0c6fe2579 100644
--- a/pom.xml
+++ b/pom.xml
@@ -615,7 +615,7 @@
</repositories>
<properties>
<commons.version>2.7.15</commons.version>
- <agent.version>1.8.8</agent.version>
+ <agent.version>1.8.9</agent.version>
<slf4j.version>1.7.36</slf4j.version>
<logback.version>1.2.11</logback.version>
<antlr.version>4.7.2</antlr.version>
diff --git a/server-core/src/main/java/io/onedev/server/buildspec/step/BuildImageStep.java b/server-core/src/main/java/io/onedev/server/buildspec/step/BuildImageStep.java
index 0963168dc1..5784111051 100644
--- a/server-core/src/main/java/io/onedev/server/buildspec/step/BuildImageStep.java
+++ b/server-core/src/main/java/io/onedev/server/buildspec/step/BuildImageStep.java
@@ -28,6 +28,8 @@ public class BuildImageStep extends Step {
private String tags;
private boolean publish;
+
+ private String moreOptions;
@Editable(order=100, description="Optionally specify build path relative to <a href='https://docs.onedev.io/concepts#job-workspace' target='_blank'>job workspace</a>. "
+ "Leave empty to use job workspace itself")
@@ -65,7 +67,15 @@ public class BuildImageStep extends Step {
public void setTags(String tags) {
this.tags = tags;
}
-
+
+ @Editable(order=350, description="Optionally specify additional options to build image. " +
+ "Different options should be separated by spaces, and single option containing " +
+ "spaces should be quoted")
+ @Interpolative(variableSuggester="suggestVariables")
+ public String getMoreOptions() {
+ return moreOptions;
+ }
+
@Editable(order=400, name="Publish After Build", description="Whether or not to publish built image to docker registry")
public boolean isPublish() {
return publish;
@@ -75,13 +85,18 @@ public class BuildImageStep extends Step {
this.publish = publish;
}
+ public void setMoreOptions(String moreOptions) {
+ this.moreOptions = moreOptions;
+ }
+
+
static List<InputSuggestion> suggestVariables(String matchWith) {
return BuildSpec.suggestVariables(matchWith, true, true, false);
}
@Override
public StepFacade getFacade(Build build, String jobToken, ParamCombination paramCombination) {
- return new BuildImageFacade(getBuildPath(), getDockerfile(), getTags(), isPublish());
+ return new BuildImageFacade(getBuildPath(), getDockerfile(), getTags(), getMoreOptions(), isPublish());
}
}