Skip to content

Commit 9dfcb32

Browse files
committed
CI/Release: Allow overriding mvn goal and profile
This patch allows the `mvn` goal and profile of the mavenCI and mavenCanaryRelease steps to be overridden. User can override the entire command by setting the `cmd` variable or the goal and the profile by setting `goal` and `profile` respectively. See ReadMe.md for details Related to: openshiftio/openshift.io#4151
1 parent d733ee0 commit 9dfcb32

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

ReadMe.md

+24-2
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,35 @@ __WARNING this function is deprecated. Please change to use getDeploymentResour
166166

167167
- creates a release branch
168168
- sets the maven pom versions using versions-maven-plugin
169+
- version can be overridden as follows
170+
```groovy
171+
mavenCanaryRelease{
172+
version = canaryVersion
173+
}
174+
```
169175
- runs `mvn deploy docker:build`
170-
- generates maven site and deploys it to the content repository
176+
177+
- default `goal` of `"install"` can overridden
178+
```groovy
179+
mavenCanaryRelease{
180+
goal = "deploy" # executes `mvn deploy` instead of `mvn install`
181+
}
182+
```
183+
- default `profile` - `"openshift"` can overridden
171184
```groovy
172185
mavenCanaryRelease{
173-
version = canaryVersion
186+
profile = "osio" # executes `mvn install -P osio`
174187
}
175188
```
189+
190+
- mvn cmd can be overriden by setting `cmd` variable.
191+
```groovy
192+
mavenCanaryRelease{
193+
cmd = "mvn clean -B -e -U deploy -Dmaven.test.skip=true -P profile"
194+
}
195+
```
196+
NOTE: if `cmd` is set, `goal`, `profile`, `skipTests` will have no effect.
197+
176198
- auto updates fabric8 maven plugin in applications `pom.xml`; `true` by default.
177199
```groovy
178200
mavenCanaryRelease{

vars/mavenCI.groovy

+4-1
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ def call(body) {
2626
flow.searchAndReplaceMavenVersionProperty(v.key, v.value)
2727
}
2828

29+
def goal = config.goal ?: "install"
30+
def profile = config.profile ?: "openshift"
2931
def skipTests = config.skipTests ?: false
32+
def cmd = config.cmd ?: "mvn clean -B -e -U ${goal} -Dmaven.test.skip=${skipTests} -P ${profile}"
3033

3134
def version = 'PR-' + getNewVersion {} + "-${env.BUILD_NUMBER}"
3235

3336
stage('Build + Unit test') {
3437
// set a unique temp version so we can download artifacts from nexus and run acceptance tests
3538
sh "mvn -U versions:set -DnewVersion=${version}"
36-
sh "mvn clean -B -e -U deploy -Dmaven.test.skip=${skipTests} -P openshift"
39+
sh cmd
3740
}
3841

3942
def s2iMode = utils.supportsOpenShiftS2I()

vars/mavenCanaryRelease.groovy

+5-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ def call(body) {
5555
}
5656
}
5757

58-
sh "mvn clean -B -e -U deploy -Dmaven.test.skip=${skipTests} ${spaceLabelArg} -P openshift"
58+
59+
profile = config.profile ?: "openshift"
60+
goal = config.goal ?: "install"
61+
cmd = config.cmd ?: "mvn clean -B -e -U ${goal} -Dmaven.test.skip=${skipTests} ${spaceLabelArg} -P ${profile}"
62+
sh cmd
5963

6064

6165
junitResults(body);

0 commit comments

Comments
 (0)