Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Commit b01b170

Browse files
committed
updated release script for Jenkins
1 parent f54b99b commit b01b170

File tree

3 files changed

+43
-18
lines changed

3 files changed

+43
-18
lines changed

build-release.jenkins

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,45 @@
1-
node {
2-
stage('Prepare Environment') {
3-
def mvnHome = tool 'Maven 3.3.9'
4-
def javaHome = tool 'Oracle JDK 8'
5-
env.JAVA_HOME="${javaHome}"
6-
env.MAVEN_HOME="${mvnHome}"
7-
env.PATH="${env.JAVA_HOME}/bin:${env.MAVEN_HOME}/bin:${env.PATH}"
8-
}
1+
// must be executed on a docker-enabled node
2+
node('docker-based-builds') {
3+
4+
// check out branch that triggered the build
95
stage('Checkout SCM') {
106
checkout scm
117
}
12-
stage('Set Version to $VERSION') {
13-
dir('webtester-build-tools') {
8+
9+
// load build environment docker container
10+
def container = docker.image('caaqe/webtester2-build-environment:latest')
11+
container.pull()
12+
container.inside {
13+
14+
stage('Log Tool Versions') {
15+
sh 'java -version'
16+
sh 'git --version'
17+
sh 'mvn --version'
18+
sh 'gpg --version'
19+
}
20+
21+
stage('Set Version to $VERSION') {
22+
sh 'cd webtester-build-tools && mvn versions:set versions:commit -DnewVersion=$VERSION'
1423
sh 'mvn versions:set versions:commit -DnewVersion=$VERSION'
1524
}
16-
sh 'mvn versions:set versions:commit -DnewVersion=$VERSION'
17-
}
18-
stage('Build & Deploy to Sonatype OSS') {
19-
withCredentials([string(credentialsId: 'webtester-gpg-passphrase', variable: 'GPG_PASSPHRASE')]) {
20-
def skipTests = "-DskipUnitTests=true -DskipIntegrationTests=true"
21-
def gpgPassphrase = "-Dgpg.passphrase=$GPG_PASSPHRASE"
22-
def profiles = "-P documentation,release,maven-central"
23-
sh "mvn clean deploy ${skipTests} ${gpgPassphrase} ${profiles}"
25+
26+
stage('Build & Deploy to Sonatype OSS') {
27+
// credentials for the repository are stored in Jenkins
28+
withCredentials([usernamePassword(credentialsId: 'ossrh-credentials', passwordVariable: 'ossrhPassword', usernameVariable: 'ossrhUsername')]) {
29+
// credentials for the GPG certificates are stored in Jenkins
30+
withCredentials([string(credentialsId: 'webtester-gpg-passphrase', variable: 'gpgPassphrase')]) {
31+
32+
def skipTests = "-DskipUnitTests=true -DskipIntegrationTests=true"
33+
def gpgPassphrase = "-Dgpg.passphrase=${gpgPassphrase}"
34+
def repositoryCredentials = "-Dossrh.username=${ossrhUsername} -Dossrh.password=${ossrhPassword}"
35+
def profiles = "-P documentation,release,maven-central"
36+
37+
sh "mvn clean deploy ${skipTests} ${gpgPassphrase} ${repositoryCredentials} ${profiles}"
38+
39+
}
40+
}
2441
}
42+
2543
}
44+
2645
}

build-snapshot.jenkins

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ node('docker-based-builds') {
3535
}
3636

3737
}
38+
3839
}

webtester-build-tools/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<maven.compiler.source>1.7</maven.compiler.source>
3030
<maven.compiler.target>1.7</maven.compiler.target>
3131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
32+
<gpg.keyname>WebTester</gpg.keyname>
3233
<version.maven.javadoc.plugin>2.10.3</version.maven.javadoc.plugin>
3334
<version.maven.source.plugin>3.0.0</version.maven.source.plugin>
3435
<version.maven.gpg.plugin>1.6</version.maven.gpg.plugin>
@@ -78,6 +79,10 @@
7879
<goals>
7980
<goal>sign</goal>
8081
</goals>
82+
<configuration>
83+
<keyname>${gpg.keyname}</keyname>
84+
<passphrase>${gpg.passphrase}</passphrase>
85+
</configuration>
8186
</execution>
8287
</executions>
8388
</plugin>

0 commit comments

Comments
 (0)