Skip to content
Permalink
541e0b2a91
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
@chubing
Latest commit 541e0b2 Feb 16, 2022 History
2 contributors

Users who have contributed to this file

@credman @chubing
79 lines (70 sloc) 2.75 KB
def repo = 'https://github.com/Internet2/grouper.git'
def jdk_id = 'Corretto-JDK8'
def maven_id = 'Maven-3.8.4'
def gpg_cred_id = 'grouper-gpg-key'
def sonatype_cred_id = 'grouper-sonatype-login'
def gpg_key = '30C7F312'
def git_tag = env.TAG_NAME ?: env.BRANCH_NAME
def tag_pattern = /^(\d+\.\d+\.\w+)$/
def grouper_src_branch = "GROUPER_RELEASE_${git_tag}"
node('docker') {
if (git_tag ==~ tag_pattern ) {
stage("PgpImport") {
withCredentials([file(credentialsId: gpg_cred_id, variable: 'GPG_KEYS')]) {
sh 'gpg --version'
sh 'gpg --keyring=pubring.gpg --no-default-keyring --import $GPG_KEYS || true'
sh 'java --version'
sh 'ls /tmp'
}
}
stage("Checkout") {
checkout_result = checkout([
$class: 'GitSCM',
branches: [[name: grouper_src_branch]],
extensions: [
[$class: 'LocalBranch'],
[$class: 'WipeWorkspace'],
[$class: 'CloneOption', noTags: false, shallow: true],
],
userRemoteConfigs: [[url: repo]]
]
)
}
stage('Version') {
def grouper_version = (git_tag =~ tag_pattern)[0][1]
println "Extracted grouper version '${grouper_version}' from input '${git_tag}'"
withMaven(
maven: maven_id,
mavenSettingsFilePath: "travis/mvn.settings.xml",
jdk: jdk_id
) {
sh "mvn -f grouper-parent versions:set -DnewVersion=${grouper_version}"
}
}
stage('Build') {
withMaven(
maven: maven_id,
mavenSettingsFilePath: "travis/mvn.settings.xml",
mavenOpts: '-Xmx2048m',
jdk: jdk_id
) {
sh "mvn -f grouper-parent clean compile package"
}
}
stage('Release') {
withCredentials([usernamePassword(credentialsId: sonatype_cred_id, usernameVariable: 'SONATYPE_USER', passwordVariable: 'SONATYPE_PWD')]) {
withMaven(
maven: maven_id,
mavenSettingsFilePath: "travis/mvn.settings.xml",
mavenOpts: '-Xmx2048m',
jdk: jdk_id
) {
sh "mvn -f grouper-parent deploy -Prelease -Dgpg.keyname=$GPG_KEY"
}
}
}
} else {
currentBuild.result = 'ABORTED'
error "Aborting build since tag doesn't match pattern '${tag_pattern}'"
}
}