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

Commit 1f3370b

Browse files
committed
added Jenkins build files for snapshot and release
1 parent 911edd1 commit 1f3370b

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

build-release.jenkins

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// must be executed on a docker-enabled node
2+
node('docker-based-builds') {
3+
4+
// check out branch that triggered the build
5+
stage('Checkout SCM') {
6+
checkout scm
7+
}
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'
23+
sh 'mvn versions:set versions:commit -DnewVersion=$VERSION'
24+
}
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 = "-DskipTests=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+
}
41+
}
42+
43+
}
44+
45+
}

build-snapshot.jenkins

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// must be executed on a docker-enabled node
2+
node('docker-based-builds') {
3+
4+
// check out branch that triggered the build
5+
stage('Checkout SCM') {
6+
checkout scm
7+
}
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('Build & Deploy to Sonatype OSS') {
22+
23+
// credentials for the repository are stored in Jenkins
24+
withCredentials([usernamePassword(credentialsId: 'ossrh-credentials', passwordVariable: 'ossrhPassword', usernameVariable: 'ossrhUsername')]) {
25+
26+
def skipTests = "-DskipTests=true"
27+
def targetRepository = "-DaltDeploymentRepository=ossrh::default::https://oss.sonatype.org/content/repositories/snapshots"
28+
def repositoryCredentials = "-Dossrh.username=${ossrhUsername} -Dossrh.password=${ossrhPassword}"
29+
def profiles = "-P documentation"
30+
31+
sh "mvn clean deploy ${skipTests} ${targetRepository} ${repositoryCredentials} ${profiles}"
32+
33+
}
34+
35+
}
36+
37+
}
38+
39+
}

0 commit comments

Comments
 (0)