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

Commit

Permalink
added Jenkins build files for snapshot and release
Browse files Browse the repository at this point in the history
  • Loading branch information
slu-it committed Mar 16, 2017
1 parent 911edd1 commit 1f3370b
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
45 changes: 45 additions & 0 deletions build-release.jenkins
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// must be executed on a docker-enabled node
node('docker-based-builds') {

// check out branch that triggered the build
stage('Checkout SCM') {
checkout scm
}

// load build environment docker container
def container = docker.image('caaqe/webtester2-build-environment:latest')
container.pull()
container.inside {

stage('Log Tool Versions') {
sh 'java -version'
sh 'git --version'
sh 'mvn --version'
sh 'gpg --version'
}

stage('Set Version to $VERSION') {
sh 'cd webtester-build-tools && mvn versions:set versions:commit -DnewVersion=$VERSION'
sh 'mvn versions:set versions:commit -DnewVersion=$VERSION'
}

stage('Build & Deploy to Sonatype OSS') {
// credentials for the repository are stored in Jenkins
withCredentials([usernamePassword(credentialsId: 'ossrh-credentials', passwordVariable: 'ossrhPassword', usernameVariable: 'ossrhUsername')]) {
// credentials for the GPG certificates are stored in Jenkins
withCredentials([string(credentialsId: 'webtester-gpg-passphrase', variable: 'gpgPassphrase')]) {

def skipTests = "-DskipTests=true"
def gpgPassphrase = "-Dgpg.passphrase=${gpgPassphrase}"
def repositoryCredentials = "-Dossrh.username=${ossrhUsername} -Dossrh.password=${ossrhPassword}"
def profiles = "-P documentation,release,maven-central"

sh "mvn clean deploy ${skipTests} ${gpgPassphrase} ${repositoryCredentials} ${profiles}"

}
}
}

}

}
39 changes: 39 additions & 0 deletions build-snapshot.jenkins
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// must be executed on a docker-enabled node
node('docker-based-builds') {

// check out branch that triggered the build
stage('Checkout SCM') {
checkout scm
}

// load build environment docker container
def container = docker.image('caaqe/webtester2-build-environment:latest')
container.pull()
container.inside {

stage('Log Tool Versions') {
sh 'java -version'
sh 'git --version'
sh 'mvn --version'
sh 'gpg --version'
}

stage('Build & Deploy to Sonatype OSS') {

// credentials for the repository are stored in Jenkins
withCredentials([usernamePassword(credentialsId: 'ossrh-credentials', passwordVariable: 'ossrhPassword', usernameVariable: 'ossrhUsername')]) {

def skipTests = "-DskipTests=true"
def targetRepository = "-DaltDeploymentRepository=ossrh::default::https://oss.sonatype.org/content/repositories/snapshots"
def repositoryCredentials = "-Dossrh.username=${ossrhUsername} -Dossrh.password=${ossrhPassword}"
def profiles = "-P documentation"

sh "mvn clean deploy ${skipTests} ${targetRepository} ${repositoryCredentials} ${profiles}"

}

}

}

}

0 comments on commit 1f3370b

Please sign in to comment.