From: Jessica Wagantall Date: Wed, 13 Mar 2019 01:08:21 +0000 (-0700) Subject: Add set version conditional step X-Git-Tag: v0.34.0~5 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=2f4787c32e8e6a8404054eea3eda8c918562d4b5;p=releng%2Fglobal-jjb.git Add set version conditional step Add conditional step for gerrit-maven-stage to optionally run the versions maven plugin using the versions.properties file. Issue: RELENG-1860 Change-Id: I4bea0ae911a79db7ef238f5ece619be6270e2256 Signed-off-by: Jessica Wagantall --- diff --git a/.jjb-test/lf-maven-jobs/lf-maven-versions-plugin.yaml b/.jjb-test/lf-maven-jobs/lf-maven-versions-plugin.yaml new file mode 100644 index 00000000..147bc9ba --- /dev/null +++ b/.jjb-test/lf-maven-jobs/lf-maven-versions-plugin.yaml @@ -0,0 +1,14 @@ +--- +- project: + name: gerrit-maven-versions-plugin-jobs + jobs: + - gerrit-maven-stage: + maven-versions-plugin: true + maven-versions-plugin-set-version: 2.0.0 + mvn-pom: location/pom.xml + + project-name: gerrit-maven-versions-plugin + staging-profile-id: uuddlrlrba + mvn-settings: gerrit-maven-project-settings + mvn-snapshot-id: fakeproject-snapshots + nexus-snapshot-repo: fakeproject-snapshots diff --git a/docs/jjb/lf-maven-jobs.rst b/docs/jjb/lf-maven-jobs.rst index d4e3370c..60976693 100644 --- a/docs/jjb/lf-maven-jobs.rst +++ b/docs/jjb/lf-maven-jobs.rst @@ -61,6 +61,19 @@ lf-maven-deploy Calls the maven deploy script to push artifacts to Nexus. +lf-maven-versions-plugin +------------------------ + +Conditionally calls Maven versions plugin to set, update and commit the maven `versions:set`. + +:Required Parameters: + + :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false) + :mvn-version: Version of Maven to execute Sonar with. + :mvn-pom: Location of pom.xml. + :maven-versions-plugin-set-version: Version number to upgrade to. + :mvn-settings: Maven settings.xml file containing credentials to use. + lf-maven-stage --------------- @@ -329,11 +342,13 @@ directory is then used later to deploy to Nexus. :deploy-path: The path in Nexus to deploy javadoc to. (default: $PROJECT/$STREAM) :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) :java-version: Version of Java to use for the build. (default: openjdk8) + :maven-versions-plugin: Whether to call Maven versions plugin or not. (default: false) :mvn-global-settings: The name of the Maven global settings to use for Maven configuration. (default: global-settings) :mvn-opts: Sets MAVEN_OPTS. (default: '') :mvn-params: Additional mvn parameters to pass to the cli. (default: '') :mvn-version: Version of maven to use. (default: mvn35) + :maven-versions-plugin-set-version: New version to use in Maven versions plugin. (default: '') :sign-artifacts: Sign artifacts with Sigul. (default: false) :stream: Keyword that can be used to represent a release code-name. Often the same as the branch. (default: master) diff --git a/jjb/lf-maven-jobs.yaml b/jjb/lf-maven-jobs.yaml index 0c5abf69..eec378af 100644 --- a/jjb/lf-maven-jobs.yaml +++ b/jjb/lf-maven-jobs.yaml @@ -21,6 +21,26 @@ - ../shell/common-variables.sh - ../shell/maven-deploy.sh +- builder: + name: lf-maven-versions-plugin + builders: + - conditional-step: + condition-kind: boolean-expression + condition-expression: '{maven-versions-plugin}' + steps: + - inject: + properties-file: version.properties + - maven-target: + maven-version: '{mvn-version}' + pom: '{mvn-pom}' + goals: 'versions:set versions:update-child-modules versions:commit -B' + properties: + - 'newVersion=${{maven-versions-plugin-set-version}}' + settings: '{mvn-settings}' + settings-type: cfp + global-settings: 'global-settings' + global-settings-type: cfp + - builder: name: lf-maven-stage builders: @@ -671,6 +691,8 @@ git-url: '$GIT_URL/$PROJECT' github-url: 'https://github.com' java-version: openjdk8 + maven-versions-plugin: false + maven-versions-plugin-set-version: '' mvn-central: false mvn-global-settings: global-settings mvn-goals: clean deploy @@ -678,6 +700,7 @@ mvn-params: '' mvn-version: mvn35 ossrh-profile-id: '' + mvn-pom: '' sign-artifacts: false sign-mode: serial stream: master @@ -724,6 +747,12 @@ global-settings-file: '{mvn-global-settings}' settings-file: '{mvn-settings}' - shell: !include-raw-escape: ../shell/maven-patch-release.sh + - lf-maven-versions-plugin: + maven-versions-plugin: '{maven-versions-plugin}' + mvn-version: '{mvn-version}' + mvn-pom: '{mvn-pom}' + maven-versions-plugin-set-version: '{maven-versions-plugin-set-version}' + mvn-settings: '{mvn-settings}' - lf-maven-build: mvn-goals: '{mvn-goals}' - lf-sigul-sign-dir: diff --git a/releasenotes/notes/set-version-condition-dfdbd31461c99e5d.yaml b/releasenotes/notes/set-version-condition-dfdbd31461c99e5d.yaml new file mode 100644 index 00000000..3c2bd4f0 --- /dev/null +++ b/releasenotes/notes/set-version-condition-dfdbd31461c99e5d.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + lf-maven-set-version conditional step for lf-maven-stage to allow + teams to run Maven versions plugin to update their artifact versions. + Step will run if maven-versions-plugin is set to true.