Skip to content

Commit

Permalink
NO-ISSUE: Fix weekly deploy Jenkins job (#3101)
Browse files Browse the repository at this point in the history
Fix weekly Jenkins job
  • Loading branch information
rodrigonull authored Jun 20, 2024
1 parent 18f29cf commit 9e978e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 7 additions & 9 deletions .ci/jenkins/Jenkinsfile.weekly.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ pipeline {

checkout scm // To make sure the repository containing the script is available on the Jenkins node.
imageUtils = load '.ci/jenkins/scripts/imageUtils.groovy'

env.PROJECT_VERSION = maven.mvnGetVersionProperty(getMavenCommand(), 'project.version')
}
}
post {
Expand All @@ -74,7 +72,6 @@ pipeline {
setDeployPropertyIfNeeded('git.branch', getBuildBranch())
setDeployPropertyIfNeeded('git.branchQuickstarts', getQuickStartsBranch())
setDeployPropertyIfNeeded('git.author', getGitAuthor())
setDeployPropertyIfNeeded('project.version', getProjectVersion())
}
}
}
Expand All @@ -83,15 +80,16 @@ pipeline {
stage('Clone repositories') {
steps {
script {
checkoutRepo(optaplannerRepository, optaplannerFolder)
checkoutRepo(quickstartsRepository, quickstartsFolder)
checkoutRepo(optaplannerRepository, optaplannerFolder, getBuildBranch())
checkoutRepo(quickstartsRepository, quickstartsFolder, getQuickStartsBranch())
}
}
}

stage('Update project version') {
steps {
script {
env.PROJECT_VERSION = maven.mvnGetVersionProperty(getOptaplannerMavenCommand(), 'project.version')
if (getDroolsVersion()) {
maven.mvnSetVersionProperty(getOptaplannerMavenCommand(), 'version.org.drools', getDroolsVersion())
}
Expand Down Expand Up @@ -214,15 +212,15 @@ void archiveJUnitTestResults() {
}
}

void checkoutRepo(String repo, String dirName) {
void checkoutRepo(String repo, String dirName, String branchName) {
dir(dirName) {
deleteDir()
checkout(githubscm.resolveRepository(repo, getGitAuthor(), getBuildBranch(), false, getGitAuthorCredsId()))
checkout(githubscm.resolveRepository(repo, getGitAuthor(), branchName, false, getGitAuthorCredsId()))
// need to manually checkout branch since on a detached branch after checkout command
sh "git checkout ${getBuildBranch()}"
sh "git checkout ${branchName}"
checkoutDatetime = getCheckoutDatetime()
if (checkoutDatetime) {
sh "git checkout `git rev-list -n 1 --before=\"${checkoutDatetime}\" ${getBuildBranch()}`"
sh "git checkout `git rev-list -n 1 --before=\"${checkoutDatetime}\" ${branchName}`"
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions .ci/jenkins/dsl/jobs.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,8 @@ void setupWeeklyDeployJob() {
MAVEN_DEPENDENCIES_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}",
MAVEN_DEPLOY_REPOSITORY: "${MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_URL}",
MAVEN_REPO_CREDS_ID: "${MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_CREDS_ID}",

DISABLE_DEPLOY: Utils.isDeployDisabled(this),
])
KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
parameters {
Expand Down

0 comments on commit 9e978e9

Please sign in to comment.