Skip to content

Commit

Permalink
KOGITO-9676 CI: Promote call setup-branch job
Browse files Browse the repository at this point in the history
  • Loading branch information
radtriste committed Aug 3, 2023
1 parent 49d7331 commit a3e7f51
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 61 deletions.
61 changes: 0 additions & 61 deletions .ci/jenkins/Jenkinsfile.promote
Original file line number Diff line number Diff line change
Expand Up @@ -79,34 +79,6 @@ pipeline {
}
}
}

stage('Set next snapshot version') {
when {
expression { return isRelease() }
}
steps {
script {
dir('pr') {
checkoutRepo()
githubscm.createBranch(getSnapshotBranch())

maven.mvnVersionsSet(getMavenCommand(), getSnapshotVersion(), true)

commitAndCreatePR()
}
dir(getRepoName()) {
sh "git checkout ${getBuildBranch()}"
mergeAndPush(getPipelinePrLink())

if (shouldDeployToRepository()) {
runMavenDeploy()
} else {
echo 'Testing environment and no specific deploy repository given => no deployment'
}
}
}
}
}
}
post {
unsuccessful {
Expand Down Expand Up @@ -183,10 +155,6 @@ String getProjectVersion() {
return getParamOrDeployProperty('PROJECT_VERSION', 'project.version')
}

String getSnapshotVersion() {
return util.getNextVersion(getProjectVersion(), 'micro')
}

String getGitTag() {
return params.GIT_TAG != '' ? params.GIT_TAG : getProjectVersion()
}
Expand All @@ -207,18 +175,6 @@ String getDeployPrLink() {
return getDeployProperty("${getRepoName()}.pr.link")
}

String getPipelinePrLink() {
return pipelineProperties["${getRepoName()}.pr.link"]
}

void setPipelinePrLink(String value) {
pipelineProperties["${getRepoName()}.pr.link"] = value
}

String getSnapshotBranch() {
return "${getSnapshotVersion().toLowerCase()}-${env.PR_BRANCH_HASH}"
}

//////////////////////////////////////////////////////////////////////////////
// Git
//////////////////////////////////////////////////////////////////////////////
Expand All @@ -243,15 +199,6 @@ void tagLatest() {
}
}

void commitAndCreatePR() {
def commitMsg = "[${getBuildBranch()}] Update project version to ${getSnapshotVersion()}"
def prBody = "Generated by build ${BUILD_TAG}: ${BUILD_URL}.\nPlease do not merge, it should be merged automatically."

githubscm.commitChanges(commitMsg, { githubscm.findAndStageNotIgnoredFiles('pom.xml') })
githubscm.pushObject('origin', getSnapshotBranch(), getGitAuthorCredsID())
setPipelinePrLink(githubscm.createPR(commitMsg, prBody, getBuildBranch(), getGitAuthorCredsID()))
}

MavenCommand getMavenCommand() {
mvnCmd = new MavenCommand(this, ['-fae', '-ntp'])
.withSettingsXmlId("${env.MAVEN_SETTINGS_CONFIG_FILE_ID}")
Expand All @@ -261,14 +208,6 @@ MavenCommand getMavenCommand() {
return mvnCmd
}

void runMavenDeploy() {
mvnCmd = getMavenCommand()
if (env.MAVEN_DEPLOY_REPOSITORY) {
mvnCmd.withDeployRepository(env.MAVEN_DEPLOY_REPOSITORY)
}
mvnCmd.skipTests(true).withProperty('enforcer.skip').run('clean deploy')
}

void uploadFileMgmt(String directory) {
if (isNotTestingBuild()) {
echo "upload binaries and docs for ${directory}"
Expand Down
10 changes: 10 additions & 0 deletions .ci/jenkins/project/Jenkinsfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@ pipeline {
}
}
}

stage('Setup next snapshot version') {
steps {
script {
def buildParams = []
addStringParam(buildParams, 'DROOLS_VERSION', util.getNextVersion(getDroolsVersion(), 'micro'))
buildJob('../setup-branch/0-setup-branch', buildParams, false)
}
}
}
}
post {
always {
Expand Down

0 comments on commit a3e7f51

Please sign in to comment.