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

Commit f54b99b

Browse files
committed
changed Jenkins build to docker-based environment
1 parent d380a4a commit f54b99b

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

build-snapshot.jenkins

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
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('Build & Deploy to Sonatype OSS') {
13-
def skipTests = "-DskipUnitTests=true -DskipIntegrationTests=true"
14-
def targetRepository = "-DaltDeploymentRepository=ossrh::default::https://oss.sonatype.org/content/repositories/snapshots"
15-
def profiles = "-P documentation"
16-
sh "mvn clean deploy ${skipTests} ${targetRepository} ${profiles}"
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 = "-DskipUnitTests=true -DskipIntegrationTests=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+
1737
}
1838
}

0 commit comments

Comments
 (0)