From 1510f46fb01bbc514c78f85b24574f6fc5cfcdd2 Mon Sep 17 00:00:00 2001 From: rick <1450685+LinuxSuRen@users.noreply.github.com> Date: Tue, 14 Sep 2021 10:17:12 +0800 Subject: [PATCH] Add two more maven related env MAVEN_MIRROR_URL and MAVEN_CLEAR_REPO are useful when users want to use a mirror Nexus --- config/templates/java.yaml | 17 +++++++++++------ config/templates/tomcat.yaml | 17 +++++++++++------ .../devops/v1alpha1/s2ibuildertemplate_types.go | 2 +- pkg/controller/s2irun/ksbuilder_jobs.go | 2 +- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/config/templates/java.yaml b/config/templates/java.yaml index 47ce4c56..d5720a99 100644 --- a/config/templates/java.yaml +++ b/config/templates/java.yaml @@ -34,6 +34,16 @@ spec: description: "Additional Maven arguments, useful for temporary adding arguments like -X or -am -pl ." required: false defaultValue: "" + - key: MAVEN_MIRROR_URL + type: string + description: "With Repositories you specify from which locations you want to download certain artifacts, such as dependencies and maven-plugins." + required: false + defaultValue: "" + - key: MAVEN_CLEAR_REPO + type: boolean + description: "If set then the Maven repository is removed after the artifact is built. This is useful for keeping the created application image small, but prevents incremental builds. The default is false" + required: false + defaultValue: "" - key: ARTIFACT_DIR type: string description: "Path to target/ where the jar files are created for multi module builds. These are added to ${MAVEN_ARGS}" @@ -44,11 +54,6 @@ spec: description: "Arguments to use when copying artifacts from the output dir to the application dir. Useful to specify which artifacts will be part of the image. It defaults to -r hawt-app/* when a hawt-app dir is found on the build directory, otherwise jar files only will be included (*.jar)." required: false defaultValue: "" - - key: MAVEN_CLEAR_REPO - type: boolean - description: "If set then the Maven repository is removed after the artifact is built. This is useful for keeping the created application image small, but prevents incremental builds. The default is false" - required: false - defaultValue: "" - key: JAVA_APP_DIR type: string description: "the directory where the application resides. All paths in your application are relative to this directory. By default it is the same directory where this startup script resides." @@ -141,6 +146,6 @@ spec: defaultValue: "" codeFramework: java defaultBaseImage: kubespheredev/java-8-centos7:latest - version: 0.0.1 + version: 0.0.2 description: "This is a builder template for Java builds whose result can be run directly without any further application server.It's suited ideally for microservices with a flat classpath (including \"far jars\")." iconPath: assets/java.png diff --git a/config/templates/tomcat.yaml b/config/templates/tomcat.yaml index 600294a4..36e62a37 100644 --- a/config/templates/tomcat.yaml +++ b/config/templates/tomcat.yaml @@ -34,6 +34,16 @@ spec: description: "Additional Maven arguments, useful for temporary adding arguments like -X or -am -pl ." required: false defaultValue: "" + - key: MAVEN_MIRROR_URL + type: string + description: "With Repositories you specify from which locations you want to download certain artifacts, such as dependencies and maven-plugins." + required: false + defaultValue: "" + - key: MAVEN_CLEAR_REPO + type: boolean + description: "If set then the Maven repository is removed after the artifact is built. This is useful for keeping the created application image small, but prevents incremental builds. The default is false" + required: false + defaultValue: "" - key: ARTIFACT_DIR type: string description: "Path to target/ where the jar files are created for multi module builds. These are added to ${MAVEN_ARGS}" @@ -44,11 +54,6 @@ spec: description: "Arguments to use when copying artifacts from the output dir to the application dir. Useful to specify which artifacts will be part of the image. It defaults to -r hawt-app/* when a hawt-app dir is found on the build directory, otherwise jar files only will be included (*.jar)." required: false defaultValue: "" - - key: MAVEN_CLEAR_REPO - type: boolean - description: "If set then the Maven repository is removed after the artifact is built. This is useful for keeping the created application image small, but prevents incremental builds. The default is false" - required: false - defaultValue: "" - key: JAVA_APP_DIR type: string description: "the directory where the application resides. All paths in your application are relative to this directory. By default it is the same directory where this startup script resides." @@ -141,6 +146,6 @@ spec: defaultValue: "" codeFramework: java defaultBaseImage: kubespheredev/tomcat85-java8-centos7:latest - version: 0.0.1 + version: 0.0.2 description: "This is a builder template for Java builds whose result can be run directly with Tomcat application server." iconPath: assets/tomcat.png diff --git a/pkg/apis/devops/v1alpha1/s2ibuildertemplate_types.go b/pkg/apis/devops/v1alpha1/s2ibuildertemplate_types.go index dfb5ef17..fb5c3834 100644 --- a/pkg/apis/devops/v1alpha1/s2ibuildertemplate_types.go +++ b/pkg/apis/devops/v1alpha1/s2ibuildertemplate_types.go @@ -36,7 +36,7 @@ type Parameter struct { Value string `json:"value,omitempty"` } -func (p *Parameter) ToEnvonment() *EnvironmentSpec { +func (p *Parameter) ToEnvironment() *EnvironmentSpec { var v string if p.Value == "" && p.DefaultValue != "" { v = p.DefaultValue diff --git a/pkg/controller/s2irun/ksbuilder_jobs.go b/pkg/controller/s2irun/ksbuilder_jobs.go index b47da0ef..b385144f 100644 --- a/pkg/controller/s2irun/ksbuilder_jobs.go +++ b/pkg/controller/s2irun/ksbuilder_jobs.go @@ -88,7 +88,7 @@ func (r *ReconcileS2iRun) NewConfigMap(instance *devopsv1alpha1.S2iRun, config d } if len(template.Parameters) > 0 { for _, p := range template.Parameters { - e := p.ToEnvonment() + e := p.ToEnvironment() if e != nil { config.Environment = append(config.Environment, *e) }