From a23db50474a23a0ce2f1db8fa245e91803c79a7b Mon Sep 17 00:00:00 2001 From: Rodrigo Antunes Date: Tue, 18 Jun 2024 19:34:53 -0300 Subject: [PATCH] Fix weekly Jenkins job --- .ci/jenkins/Jenkinsfile.weekly.deploy | 16 +++++++--------- .ci/jenkins/dsl/jobs.groovy | 2 ++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.ci/jenkins/Jenkinsfile.weekly.deploy b/.ci/jenkins/Jenkinsfile.weekly.deploy index de68f0f1784..dcde5ce02e4 100644 --- a/.ci/jenkins/Jenkinsfile.weekly.deploy +++ b/.ci/jenkins/Jenkinsfile.weekly.deploy @@ -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 { @@ -74,7 +72,6 @@ pipeline { setDeployPropertyIfNeeded('git.branch', getBuildBranch()) setDeployPropertyIfNeeded('git.branchQuickstarts', getQuickStartsBranch()) setDeployPropertyIfNeeded('git.author', getGitAuthor()) - setDeployPropertyIfNeeded('project.version', getProjectVersion()) } } } @@ -83,8 +80,8 @@ pipeline { stage('Clone repositories') { steps { script { - checkoutRepo(optaplannerRepository, optaplannerFolder) - checkoutRepo(quickstartsRepository, quickstartsFolder) + checkoutRepo(optaplannerRepository, optaplannerFolder, getBuildBranch()) + checkoutRepo(quickstartsRepository, quickstartsFolder, getQuickStartsBranch()) } } } @@ -92,6 +89,7 @@ pipeline { stage('Update project version') { steps { script { + env.PROJECT_VERSION = maven.mvnGetVersionProperty(getOptaplannerMavenCommand(), 'project.version') if (getDroolsVersion()) { maven.mvnSetVersionProperty(getOptaplannerMavenCommand(), 'version.org.drools', getDroolsVersion()) } @@ -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}`" } } } diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 6d0468aafd2..b5e9d46688a 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -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 {