Skip to content
Permalink
main
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
@mchyzer
Latest commit 4ddedf5 Aug 10, 2022 History
3 contributors

Users who have contributed to this file

@credman @chubing @mchyzer
def repo = 'https://github.com/Internet2/grouper.git'
def jdk_id = 'Corretto-JDK8'
def java_home = '/home/centos/agent/tools/hudson.model.JDK/Corretto-JDK8/amazon-corretto-8.342.07.4-linux-x64'
def maven_id = 'maven'
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 ) {
environment {
JAVA_HOME=java_home
}
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 'echo $JAVA_HOME'
sh 'java --version'
}
}
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}'"
sh 'echo JAVA_HOME=$JAVA_HOME'
withMaven(
maven: maven_id,
mavenSettingsFilePath: "travis/mvn.settings.xml",
jdk: jdk_id
) {
sh "JAVA_HOME=${java_home} mvn -f grouper-parent versions:set -DnewVersion=${grouper_version}"
}
}
stage('Build') {
sh 'echo JAVA_HOME=$JAVA_HOME'
withMaven(
maven: maven_id,
mavenSettingsFilePath: "travis/mvn.settings.xml",
mavenOpts: '-Xmx2048m',
jdk: jdk_id
) {
sh "JAVA_HOME=${java_home} mvn -f grouper-parent clean compile package"
}
}
stage('Release') {
withCredentials([usernamePassword(credentialsId: sonatype_cred_id, usernameVariable: 'SONATYPE_USER', passwordVariable: 'SONATYPE_PWD')]) {
sh 'echo JAVA_HOME=$JAVA_HOME'
withMaven(
maven: maven_id,
mavenSettingsFilePath: "travis/mvn.settings.xml",
mavenOpts: '-Xmx2048m',
jdk: jdk_id
) {
sh "JAVA_HOME=${java_home} 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}'"
}
}