diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 28a80019059..4a3b8b88458 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -30,7 +30,7 @@ pipeline { environment { // Static env is defined into ./dsl/jobs.groovy file - KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") + DROOLS_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") // Keep here for visitibility MAVEN_OPTS = '-Xms1024m -Xmx4g' @@ -201,7 +201,7 @@ void commitAndCreatePR() { void sendNotification() { if (params.SEND_NOTIFICATION) { - mailer.sendMarkdownTestSummaryNotification('Deploy', "[${getBuildBranch()}] Drools", [env.KOGITO_CI_EMAIL_TO]) + mailer.sendMarkdownTestSummaryNotification('Deploy', "[${getBuildBranch()}] Drools", [env.DROOLS_CI_EMAIL_TO]) } else { echo 'No notification sent per configuration' } diff --git a/.ci/jenkins/Jenkinsfile.promote b/.ci/jenkins/Jenkinsfile.promote index db15d29af7d..85b09b1ab3f 100644 --- a/.ci/jenkins/Jenkinsfile.promote +++ b/.ci/jenkins/Jenkinsfile.promote @@ -21,16 +21,8 @@ pipeline { timeout(time: 180, unit: 'MINUTES') } - // parameters { - // For parameters, check into ./dsl/jobs.groovy file - // } - environment { - // Static env is defined into ./dsl/jobs.groovy file - - KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") - - PR_BRANCH_HASH = "${util.generateHash(10)}" + DROOLS_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") } stages { @@ -45,18 +37,12 @@ pipeline { readDeployProperties() - if (isRelease()) { - // Verify version is set and if on right release branch - assert getProjectVersion() - assert getBuildBranch() == util.getReleaseBranchFromVersion(getProjectVersion()) - } + assert getProjectVersion() + assert getBuildBranch() == util.getReleaseBranchFromVersion(getProjectVersion()) } } } stage('Merge deploy PR and tag') { - when { - expression { return isRelease() } - } steps { script { dir(getRepoName()) { @@ -68,42 +54,29 @@ pipeline { } } - stage('Upload drools binaries and documentation') { - when { - expression { return isRelease() && isStream8() } - } + stage('Create release') { steps { script { - getMavenCommand().inDirectory(getRepoName()).skipTests(true).withProperty('full').run('clean install') - uploadFileMgmt(getRepoName()) + dir(getRepoName()) { + checkoutRepo() + if(githubscm.isReleaseExist(getGitTag(), getGitAuthorCredsID())) { + githubscm.deleteRelease(getGitTag(), getGitAuthorCredsID()) + } + githubscm.createReleaseWithGeneratedReleaseNotes(getGitTag(), getBuildBranch(), githubscm.getPreviousTag(getGitTag()), getGitAuthorCredsID()) + githubscm.updateReleaseBody(getGitTag(), getGitAuthorCredsID()) + } } } } - stage('Set next snapshot version') { + stage('Upload drools binaries and documentation') { when { - expression { return isRelease() } + expression { return isStream8() } } 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' - } - } + getMavenCommand().inDirectory(getRepoName()).skipTests(true).withProperty('full').run('clean install') + uploadFileMgmt(getRepoName()) } } } @@ -122,7 +95,7 @@ pipeline { void sendNotification() { if (params.SEND_NOTIFICATION) { - mailer.sendMarkdownTestSummaryNotification('Promote', "[${getBuildBranch()}] Drools", [env.KOGITO_CI_EMAIL_TO]) + mailer.sendMarkdownTestSummaryNotification('Promote', "[${getBuildBranch()}] Drools", [env.DROOLS_CI_EMAIL_TO]) } else { echo 'No notification sent per configuration' } @@ -167,14 +140,6 @@ String getParamOrDeployProperty(String paramKey, String deployPropertyKey) { // Getter / Setter ////////////////////////////////////////////////////////////////////////////// -boolean shouldDeployToRepository() { - return env.MAVEN_DEPLOY_REPOSITORY || getGitAuthor() == 'kiegroup' -} - -boolean isRelease() { - return env.RELEASE ? env.RELEASE.toBoolean() : false -} - String getRepoName() { return env.REPO_NAME } @@ -183,10 +148,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() } @@ -207,18 +168,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 ////////////////////////////////////////////////////////////////////////////// @@ -243,15 +192,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}") @@ -261,14 +201,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}" diff --git a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone index 26182984f62..8d2fa7ba6ed 100644 --- a/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone +++ b/.ci/jenkins/Jenkinsfile.quarkus-3.rewrite.standalone @@ -21,7 +21,7 @@ pipeline { } environment { - KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") + DROOLS_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") PR_BRANCH_HASH = "${util.generateHash(10)}" } @@ -113,13 +113,13 @@ void clean() { } void sendErrorNotification() { - mailer.sendMarkdownTestSummaryNotification('quarkus-3', "[${getBuildBranch()}] Drools", [env.KOGITO_CI_EMAIL_TO]) + mailer.sendMarkdownTestSummaryNotification('quarkus-3', "[${getBuildBranch()}] Drools", [env.DROOLS_CI_EMAIL_TO]) } void sendNotification(String body) { emailext body: "${body}", subject: "[${getBuildBranch()}] Drools - quarkus-3", - to: env.KOGITO_CI_EMAIL_TO + to: env.DROOLS_CI_EMAIL_TO } void checkoutRepo(String repository, String branch) { diff --git a/.ci/jenkins/Jenkinsfile.setup-branch b/.ci/jenkins/Jenkinsfile.setup-branch index e00cc151829..4b8bd5900ed 100644 --- a/.ci/jenkins/Jenkinsfile.setup-branch +++ b/.ci/jenkins/Jenkinsfile.setup-branch @@ -25,7 +25,7 @@ pipeline { environment { // Static env is defined into ./dsl/jobs.groovy file - KOGITO_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") + DROOLS_CI_EMAIL_TO = credentials("${JENKINS_EMAIL_CREDS_ID}") // Keep here for visitibility MAVEN_OPTS = '-Xms1024m -Xmx4g' @@ -101,7 +101,7 @@ pipeline { void sendNotification() { if (params.SEND_NOTIFICATION) { - mailer.sendMarkdownTestSummaryNotification('Setup branch', "[${getBuildBranch()}] Drools", [env.KOGITO_CI_EMAIL_TO]) + mailer.sendMarkdownTestSummaryNotification('Setup branch', "[${getBuildBranch()}] Drools", [env.DROOLS_CI_EMAIL_TO]) } else { echo 'No notification sent per configuration' } diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index cabb8fb2d33..22bf185da25 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -63,7 +63,7 @@ void createProjectSetupBranchJob() { KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { parameters { stringParam('DROOLS_VERSION', '', 'Drools version') - booleanParam('DEPLOY_ARTIFACTS', true, 'Deploy artifacts') + booleanParam('DEPLOY', true, 'Deploy artifacts') } } } diff --git a/.ci/jenkins/project/Jenkinsfile.release b/.ci/jenkins/project/Jenkinsfile.release index c86d1e0db84..914f6392e7b 100644 --- a/.ci/jenkins/project/Jenkinsfile.release +++ b/.ci/jenkins/project/Jenkinsfile.release @@ -113,6 +113,16 @@ pipeline { } } } + + stage('Setup next snapshot version') { + steps { + script { + def buildParams = [] + addStringParam(buildParams, 'DROOLS_VERSION', util.getNextVersion(getDroolsVersion(), 'micro')) + build(job: '../setup-branch/0-setup-branch', wait: false, parameters: buildParams, propagate: false) + } + } + } } post { always { diff --git a/.ci/jenkins/project/Jenkinsfile.setup-branch b/.ci/jenkins/project/Jenkinsfile.setup-branch index dcf8a9cf499..5609f8621b6 100644 --- a/.ci/jenkins/project/Jenkinsfile.setup-branch +++ b/.ci/jenkins/project/Jenkinsfile.setup-branch @@ -65,13 +65,13 @@ pipeline { // Launch the nightly to deploy all artifacts from the branch stage('Launch the nightly') { when { - expression { return params.DEPLOY_ARTIFACTS } + expression { return params.DEPLOY } } steps { script { def buildParams = getDefaultBuildParams() addBooleanParam(buildParams, 'SKIP_TESTS', true) - buildJob('../nightly/0-nightly', buildParams, 'nightly', false) + build(job: '../nightly/0-nightly', wait: false, parameters: buildParams, propagate: false) } } post {