Skip to content
Permalink
a40d3e139e
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
1 contributor

Users who have contributed to this file

76 lines (67 sloc) 2.66 KB
def repo = 'git@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 = '1D3F3E9E30C7F312'
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') {
sh 'env | sort'
if (git_tag ==~ tag_pattern ) {
stage("PgpImport") {
withCredentials([file(credentialsId: gpg_cred_id, variable: 'GPG_KEYS')]) {
sh 'gpg --keyring=pubring.gpg --no-default-keyring --import $GPG_KEYS'
}
}
stage("Checkout") {
checkout_result = checkout([
$class: 'GitSCM',
branches: [[name: grouper_src_branch]],
extensions: [
[$class: 'LocalBranch'], [$class: 'WipeWorkspace'],
[$class: 'CloneOption', depth: 1, noTags: false, reference: '', 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}'"
}
}