Skip to content

Commit

Permalink
Merge pull request #418 from sthaha/improve-mvn-ci-release
Browse files Browse the repository at this point in the history
CI/Release: Allow overriding mvn goal and profile
  • Loading branch information
Hrishikesh Shinde committed Aug 10, 2018
2 parents d733ee0 + 9dfcb32 commit c6231c0
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
26 changes: 24 additions & 2 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,35 @@ __WARNING this function is deprecated. Please change to use getDeploymentResour

- creates a release branch
- sets the maven pom versions using versions-maven-plugin
- version can be overridden as follows
```groovy
mavenCanaryRelease{
version = canaryVersion
}
```
- runs `mvn deploy docker:build`
- generates maven site and deploys it to the content repository

- default `goal` of `"install"` can overridden
```groovy
mavenCanaryRelease{
goal = "deploy" # executes `mvn deploy` instead of `mvn install`
}
```
- default `profile` - `"openshift"` can overridden
```groovy
mavenCanaryRelease{
version = canaryVersion
profile = "osio" # executes `mvn install -P osio`
}
```

- mvn cmd can be overriden by setting `cmd` variable.
```groovy
mavenCanaryRelease{
cmd = "mvn clean -B -e -U deploy -Dmaven.test.skip=true -P profile"
}
```
NOTE: if `cmd` is set, `goal`, `profile`, `skipTests` will have no effect.

- auto updates fabric8 maven plugin in applications `pom.xml`; `true` by default.
```groovy
mavenCanaryRelease{
Expand Down
5 changes: 4 additions & 1 deletion vars/mavenCI.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ def call(body) {
flow.searchAndReplaceMavenVersionProperty(v.key, v.value)
}

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

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

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

def s2iMode = utils.supportsOpenShiftS2I()
Expand Down
6 changes: 5 additions & 1 deletion vars/mavenCanaryRelease.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ def call(body) {
}
}

sh "mvn clean -B -e -U deploy -Dmaven.test.skip=${skipTests} ${spaceLabelArg} -P openshift"

profile = config.profile ?: "openshift"
goal = config.goal ?: "install"
cmd = config.cmd ?: "mvn clean -B -e -U ${goal} -Dmaven.test.skip=${skipTests} ${spaceLabelArg} -P ${profile}"
sh cmd


junitResults(body);
Expand Down

0 comments on commit c6231c0

Please sign in to comment.