Merge pull request #7 from gresham-computing/releaseImprovements

DWN-33428 : Release improvements
pull/1601/head
Harry Smith 2020-06-10 13:34:51 +01:00 committed by GitHub
commit 57556d9182
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 116 additions and 52 deletions

146
Jenkinsfile vendored
View File

@ -1,12 +1,16 @@
//
// CTC Auth Jenkins Pipeline
//
pipeline {
agent any
agent any
tools {
maven 'Maven 3.3.9'
jdk 'Java 8'
}
environment {
VERSION = ''
NEW_VERSION = ''
}
parameters {
booleanParam(name: 'RELEASE', defaultValue: false, description: 'Release a new version of the open id connect component')
}
options {
// Only keep 10 builds in total
buildDiscarder(logRotator(numToKeepStr:'10', daysToKeepStr:'2'))
@ -15,53 +19,109 @@ pipeline {
timestamps()
// Prevent concurrent builds
disableConcurrentBuilds();
disableConcurrentBuilds()
}
stages {
stage ('1.3.3 Build') {
when {
branch "1.3.x"
}
steps {
sh "mvn versions:set -DnewVersion=1.3.3.GRESHAM-19"
sh "mvn -N versions:update-child-modules"
timeout(time: 10, unit: 'MINUTES') {
sh "mvn -B -V -U -T4 clean deploy -DaltReleaseDeploymentRepository=releases::default::https://nexus.greshamtech.com/content/repositories/thirdparty/"
}
}
post {
always{
archiveArtifacts caseSensitive: false, onlyIfSuccessful: true, allowEmptyArchive: true, artifacts: 'openid-connect-server-webapp/target/*.war'
}
}
}
stage ('Build') {
when {
not {
branch "1.3.x"
}
}
stage ('Discover Version Number') {
steps {
sh "mvn versions:set -DnewVersion=${env.BRANCH_NAME}.GRESHAM-SNAPSHOT"
sh "mvn -N versions:update-child-modules"
script {
def pom = readMavenPom file: 'pom.xml'
def currentVersion = pom.getVersion()
VERSION = currentVersion.substring(0, currentVersion.indexOf('-SNAPSHOT'))
def parts = VERSION.tokenize('-')
def currentGreshamVersion = parts[1].toInteger()
parts.remove(1)
NEW_VERSION = parts.join('-') + '-' + (currentGreshamVersion + 1)
}
}
}
stage ('1.3.3 Release Build') {
when {
expression {
return BRANCH_NAME == "1.3.x" && params.RELEASE
}
}
steps {
sh "mvn versions:set -B -DnewVersion=$VERSION"
sh "mvn -N -B versions:update-child-modules"
script {
sh "git commit --all --message 'Creating Release $VERSION'"
sh "git tag --annotate v$VERSION --message 'Creating Release $VERSION'"
sh "git push origin HEAD:${BRANCH_NAME} --tags"
}
timeout(time: 10, unit: 'MINUTES') {
sh "mvn -B -V -U -T4 clean deploy -DaltSnapshotDeploymentRepository=snapshots::default::https://nexus.greshamtech.com/content/repositories/third-party-snapshots/"
}
withMaven(options: [jUnitPublisher(disabled: true)]) {
sh "mvn -B -V -U -T4 clean deploy -DaltReleaseDeploymentRepository=releases::default::https://nexus.greshamtech.com/repository/thirdparty-maven-releases/"
}
}
}
post {
always{
archiveArtifacts caseSensitive: false, onlyIfSuccessful: true, allowEmptyArchive: true, artifacts: 'openid-connect-server-webapp/target/*.war'
}
success {
junit '**/target/surefire-reports/**/*.xml'
}
success {
junit '**/target/surefire-reports/**/*.xml'
}
}
}
stage ('1.3.3 Snapshot Build') {
when {
expression {
return BRANCH_NAME == "1.3.x" && !params.RELEASE
}
}
steps {
timeout(time: 10, unit: 'MINUTES') {
withMaven(options: [jUnitPublisher(disabled: true)]) {
sh "mvn -B -V -U -T4 clean deploy -DaltSnapshotDeploymentRepository=snapshots::default::https://nexus.greshamtech.com/repository/thirdparty-maven-snapshots/"
}
}
}
post {
success {
junit '**/target/surefire-reports/**/*.xml'
}
}
}
stage ('Feature Branch Build') {
when {
not {
branch "1.3.x"
}
}
steps {
timeout(time: 10, unit: 'MINUTES') {
withMaven(options: [junitPublisher(disabled: true)]) {
sh "mvn versions:set -B -DnewVersion=${env.BRANCH_NAME}.GRESHAM-SNAPSHOT"
sh "mvn -N -B versions:update-child-modules"
sh "mvn -B -V -U -T4 clean deploy -DaltSnapshotDeploymentRepository=snapshots::default::https://nexus.greshamtech.com/repository/thirdparty-maven-snapshots/"
}
}
}
post {
success {
junit '**/target/surefire-reports/**/*.xml'
}
}
}
stage ('Bump Development Version') {
when {
expression {
return BRANCH_NAME == '1.3.x' && params.RELEASE
}
}
steps {
script {
sh "mvn versions:set -DnewVersion=${NEW_VERSION}-SNAPSHOT --batch-mode"
sh "git commit --all --message 'New Development Version $NEW_VERSION-SNAPSHOT'"
sh "git push origin HEAD:${BRANCH_NAME}"
}
}
}
}
post {
always {
deleteDir()
}
}
always {
deleteDir()
}
}
}

View File

@ -30,6 +30,10 @@ The authors and key contributors of the project include:
Copyright ©2017, [MIT Internet Trust Consortium](http://www.trust.mit.edu/). Licensed under the Apache 2.0 license, for details see `LICENSE.txt`.
## Note for releasing
## Release Process
Releases are made off of branch 1.3.x - the version released used to depend on the Jenkins build number but this is ineffective as the Jenkins history can vanish leaving you back at build number 1. Therefore, in the Jenkinsfile, the version to be released needs altering on line 26 and incrementing by 1.
Here at Gresham, we use this component for a base for the auth server, our developing branch is 1.3.x and any feature branches should be made off of that branch.
In order to release a new version of the open-id-connect component, run the `Build with Parameters` on Jenkins ticking the release checkbox as part of the build.
This will release the next release version (the current version less the -SNAPSHOT), run a build with the tests and then bump the 1.3.x branch to the next snapshot version of the repository

View File

@ -22,7 +22,7 @@
<parent>
<artifactId>openid-connect-parent</artifactId>
<groupId>org.mitre</groupId>
<version>1.3.3-SNAPSHOT</version>
<version>1.3.3.GRESHAM-20-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>openid-connect-client</artifactId>

View File

@ -22,7 +22,7 @@
<parent>
<artifactId>openid-connect-parent</artifactId>
<groupId>org.mitre</groupId>
<version>1.3.3-SNAPSHOT</version>
<version>1.3.3.GRESHAM-20-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>openid-connect-common</artifactId>

View File

@ -21,7 +21,7 @@
<parent>
<groupId>org.mitre</groupId>
<artifactId>openid-connect-parent</artifactId>
<version>1.3.3-SNAPSHOT</version>
<version>1.3.3.GRESHAM-20-SNAPSHOT</version>
</parent>
<artifactId>openid-connect-server-webapp</artifactId>
<packaging>war</packaging>

View File

@ -23,7 +23,7 @@
<parent>
<groupId>org.mitre</groupId>
<artifactId>openid-connect-parent</artifactId>
<version>1.3.3-SNAPSHOT</version>
<version>1.3.3.GRESHAM-20-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<build>

View File

@ -20,7 +20,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.mitre</groupId>
<artifactId>openid-connect-parent</artifactId>
<version>1.3.3-SNAPSHOT</version>
<version>1.3.3.GRESHAM-20-SNAPSHOT</version>
<name>MITREid Connect</name>
<packaging>pom</packaging>
<parent>

View File

@ -19,7 +19,7 @@
<parent>
<groupId>org.mitre</groupId>
<artifactId>openid-connect-parent</artifactId>
<version>1.3.3-SNAPSHOT</version>
<version>1.3.3.GRESHAM-20-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>uma-server-webapp</artifactId>

View File

@ -19,7 +19,7 @@
<parent>
<groupId>org.mitre</groupId>
<artifactId>openid-connect-parent</artifactId>
<version>1.3.3-SNAPSHOT</version>
<version>1.3.3.GRESHAM-20-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>uma-server</artifactId>