This is an automated email from the ASF dual-hosted git repository.

porcelli pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git

commit 0fab521c148ef91cb52a1f83658dc6b4353256dc
Author: Alex Porcelli <[email protected]>
AuthorDate: Wed Mar 26 12:04:27 2025 -0400

    Revert "10.1.0 release hard requirement: cherry-pick release pipeline 
changes (including conflict resolution)"
    
    This reverts commit de51ac81173448896f0fed9ab052291af04073b1.
---
 .ci/jenkins/Jenkinsfile.deploy          |  37 +++++++---
 .ci/jenkins/dsl/jobs.groovy             |  11 +--
 .ci/jenkins/project/Jenkinsfile.release | 118 ++++++++++++++++++++++++++++----
 3 files changed, 138 insertions(+), 28 deletions(-)

diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy
index 60d233340d..4d4cca2928 100644
--- a/.ci/jenkins/Jenkinsfile.deploy
+++ b/.ci/jenkins/Jenkinsfile.deploy
@@ -82,7 +82,7 @@ pipeline {
         }
         stage('Prepare for PR') {
             when {
-                expression { return isRelease() || isCreatePr() }
+                expression { return isCreatePr() }
             }
             steps {
                 script {
@@ -129,8 +129,9 @@ pipeline {
 
                         if (isRelease()) {
                             
releaseUtils.gpgImportKeyFromStringWithoutPassword(getReleaseGpgSignKeyCredsId())
-                            mavenCommand.withProfiles(['apache-release'])
-                                        .withProperty('only.reproducible')
+                            mavenCommand
+                            .withProfiles(['apache-release'])
+                            .withProperty('only.reproducible')
                         }
 
                         configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]) {
@@ -150,7 +151,7 @@ pipeline {
         }
         stage('Create PR') {
             when {
-                expression { return isRelease() || isCreatePr() }
+                expression { return isCreatePr() }
             }
             steps {
                 script {
@@ -160,11 +161,6 @@ pipeline {
                         } else {
                             println '[WARN] no changes to commit'
                         }
-
-                        // Create a new tag
-                        
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
-                        githubscm.tagRepository(getGitTagName())
-                        githubscm.pushRemoteTag('origin', getGitTagName(), 
getGitAuthorPushCredsId())
                     }
                 }
             }
@@ -179,6 +175,29 @@ pipeline {
                 }
             }
         }
+        stage('Commit and Create Tag') {
+            when {
+                expression { return isRelease() }
+            }
+            steps {
+                script {
+                    dir(getRepoName()) {
+                        if (githubscm.isThereAnyChanges()) {
+                            def commitMsg = "[${getBuildBranch()}] Update 
version to ${getProjectVersion()}"
+                            
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
+                            githubscm.commitChanges(commitMsg, {
+                                
githubscm.findAndStageNotIgnoredFiles('pom.xml')
+                                
githubscm.findAndStageNotIgnoredFiles('antora.yml')
+                            })
+                        } else {
+                            println '[WARN] no changes to commit'
+                        }
+                        githubscm.tagRepository(getGitTagName())
+                        githubscm.pushRemoteTag('origin', getGitTagName(), 
getGitAuthorPushCredsId())
+                    }
+                }
+            }
+        }
     }
     post {
         always {
diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy
index 4d2a510a27..131579fbdb 100644
--- a/.ci/jenkins/dsl/jobs.groovy
+++ b/.ci/jenkins/dsl/jobs.groovy
@@ -126,14 +126,17 @@ void setupProjectReleaseJob() {
 
         GIT_BRANCH_NAME: "${GIT_BRANCH}",
         GIT_AUTHOR: "${GIT_AUTHOR_NAME}",
+
+        DEFAULT_STAGING_REPOSITORY: "${MAVEN_NEXUS_STAGING_PROFILE_URL}",
+        ARTIFACTS_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}",
+
+        DROOLS_STREAM: Utils.getStream(this),
     ])
     KogitoJobTemplate.createPipelineJob(this, jobParams)?.with {
         parameters {
             stringParam('RESTORE_FROM_PREVIOUS_JOB', '', 'URL to a previous 
stopped release job which needs to be continued')
 
-            stringParam('RELEASE_VERSION', '', 'Drools version to release as 
Major.minor.micro')
-
-            stringParam('GIT_TAG_NAME', '', 'Git tag to create. i.e.: 
10.0.0-rc1')
+            stringParam('DROOLS_VERSION', '', 'Drools version to release as 
Major.minor.micro')
 
             booleanParam('SKIP_TESTS', false, 'Skip all tests')
         }
@@ -335,8 +338,6 @@ void setupDeployJob() {
             stringParam('PROJECT_VERSION', '', 'Optional if not RELEASE. If 
RELEASE, cannot be empty.')
             stringParam('DROOLS_PR_BRANCH', '', 'PR branch name')
 
-            stringParam('GIT_TAG_NAME', '', 'Optional if not RELEASE. Tag to 
be created in the repository')
-
             booleanParam('SEND_NOTIFICATION', false, 'In case you want the 
pipeline to send a notification on CI channel for this run.')
         }
     }
diff --git a/.ci/jenkins/project/Jenkinsfile.release 
b/.ci/jenkins/project/Jenkinsfile.release
index 2f8d96ed50..030dbeb6b7 100644
--- a/.ci/jenkins/project/Jenkinsfile.release
+++ b/.ci/jenkins/project/Jenkinsfile.release
@@ -22,8 +22,10 @@ import org.jenkinsci.plugins.workflow.libs.Library
 @Library('jenkins-pipeline-shared-libraries')_
 
 droolsRepo = 'drools'
+// kieJpmmlIntegrationRepo = 'kie-jpmml-integration' // Commented as not 
migrated for now
 
 ARTIFACTS_STAGING_STAGE = 'stage.artifacts.staging'
+ARTIFACTS_RELEASE_STAGE = 'stage.artifacts.release'
 
 JOB_PROPERTY_PREFIX = 'build'
 JOB_RESULT_PROPERTY_KEY = 'result'
@@ -52,17 +54,22 @@ pipeline {
                         echo "Release properties imported from previous job: 
${releaseProperties}"
                     }
 
-                    assert getReleaseVersion()
+                    assert getDroolsVersion()
 
                     currentBuild.displayName = getDisplayName()
 
-                    sendNotification("Release Pipeline has started...\nDrools 
version = ${getReleaseVersion()}\n=> ${env.BUILD_URL}")
+                    sendNotification("Release Pipeline has started...\nDrools 
version = ${getDroolsVersion()}\n=> ${env.BUILD_URL}")
+
+                    // Safety measure to not publish to main JBoss
+                    if (getGitAuthor() != 'apache' && 
!getArtifactsRepositoryParam()) {
+                        sendNotification("Git Author is different from 
`apache` and no `ARTIFACTS_REPOSITORY` parameter has been provided. Are you 
sure you want to continue ? => ${env.BUILD_URL}input")
+                        input message: 'Should the pipeline continue with no 
`ARTIFACTS_REPOSITORY` defined ?', ok: 'Yes'
+                    }
                 }
             }
             post {
                 always {
-                    setReleasePropertyIfneeded('release.version', 
getReleaseVersion())
-                    setReleasePropertyIfneeded('git.tag.name', getGitTagName())
+                    setReleasePropertyIfneeded('drools.version', 
getDroolsVersion())
                 }
             }
         }
@@ -72,21 +79,89 @@ pipeline {
                 script {
                     def buildParams = getDefaultBuildParams()
                     addSkipTestsParam(buildParams)
+
                     buildJob(getDeployJobName(droolsRepo), buildParams)
                 }
             }
         }
 
+        // stage('Build & Deploy KIE jpmml integration') {
+        //     steps {
+        //         script {
+        //             def buildParams = getDefaultBuildParams()
+        //             addSkipTestsParam(buildParams)
+
+        //             buildJob(getDeployJobName(kieJpmmlIntegrationRepo), 
buildParams)
+        //         }
+        //     }
+        // }
+
         stage('Artifacts\' staging finalization') {
             steps {
                 script {
                     if (!areArtifactsStaged()) {
-                        sendNotification('All artifacts have been staged.')
+                        sendNotification("All artifacts have been staged. You 
can find them here: ${getStagingRepository()}")
                     }
                     setArtifactsStaged()
                 }
             }
         }
+
+        stage('Are staged artifacts released?') {
+            when {
+                // Execute only if artifacts repository was not given, which 
means the staging repository has been created
+                expression { return !getArtifactsRepositoryParam() && 
!areArtifactsReleased() }
+            }
+            steps {
+                script {
+                    String body = "${getDroolsVersion()} artifacts are ready 
for release.\n" +
+                                 "Please release the staging repositories and 
then confirm here: ${env.BUILD_URL}input"
+                    sendNotification(body)
+                    input message: 'Has the staging repository been released 
?', ok: 'Yes'
+
+                    sendNotification('Artifacts have been released. Finalizing 
now the release ...')
+                    setArtifactsReleased()
+                }
+            }
+        }
+
+        stage('Promote Drools') {
+            when {
+                expression { return 
isJobConsideredOk(getDeployJobName(droolsRepo)) }
+            }
+            steps {
+                script {
+                    def buildParams = getDefaultBuildParams()
+                    addDeployBuildUrlParam(buildParams, 
getDeployJobName(droolsRepo))
+
+                    buildJob(getPromoteJobName(droolsRepo), buildParams)
+                }
+            }
+        }
+
+        // stage('Promote KIE jpmml integration') {
+        //     when {
+        //         expression { return 
isJobConsideredOk(getDeployJobName(kieJpmmlIntegrationRepo)) }
+        //     }
+        //     steps {
+        //         script {
+        //             def buildParams = getDefaultBuildParams()
+        //             addDeployBuildUrlParam(buildParams, 
getDeployJobName(kieJpmmlIntegrationRepo))
+
+        //             buildJob(getPromoteJobName(kieJpmmlIntegrationRepo), 
buildParams)
+        //         }
+        //     }
+        // }
+
+        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 {
@@ -157,6 +232,10 @@ String getDeployJobName(String repository) {
     return "${repository}-deploy"
 }
 
+String getPromoteJobName(String repository) {
+    return "${repository}-promote"
+}
+
 String getJobPropertySuffix(String jobName) {
     return "${JOB_PROPERTY_PREFIX}.${jobName}"
 }
@@ -251,10 +330,9 @@ def readPropertiesFromUrl(String url, String 
propsFilename) {
 
 List getDefaultBuildParams() {
     List buildParams = []
-    addDisplayNameParam(buildParams, getDisplayName(getReleaseVersion()))
-    addStringParam(buildParams, 'PROJECT_VERSION', getReleaseVersion())
-    addStringParam(buildParams, 'DROOLS_PR_BRANCH', 
"drools-${getReleaseVersion()}")
-    addStringParam(buildParams, 'GIT_TAG_NAME', getGitTagName())
+    addDisplayNameParam(buildParams, getDisplayName(getDroolsVersion()))
+    addStringParam(buildParams, 'PROJECT_VERSION', getDroolsVersion())
+    addStringParam(buildParams, 'DROOLS_PR_BRANCH', 
"drools-${getDroolsVersion()}")
     return buildParams
 }
 
@@ -289,18 +367,26 @@ void addBooleanParam(List buildParams, String key, 
boolean value) {
 }
 
 String getDisplayName(version = '') {
-    version = version ?: getReleaseVersion()
+    version = version ?: getDroolsVersion()
     return "Release ${version}"
 }
 
-String getReleaseVersion() {
-    return params.RELEASE_VERSION ?: getReleaseProperty('release.version')
+String getDroolsVersion() {
+    return params.DROOLS_VERSION ?: getReleaseProperty('drools.version')
 }
 
 String getGitAuthor() {
     return env.GIT_AUTHOR
 }
 
+String getArtifactsRepositoryParam() {
+    return env['ARTIFACTS_REPOSITORY'] ?: ''
+}
+
+String getStagingRepository() {
+    return getArtifactsRepositoryParam() ?: env.DEFAULT_STAGING_REPOSITORY
+}
+
 void setReleasePropertyIfneeded(String key, def value) {
     if (value) {
         releaseProperties[key] = value
@@ -329,6 +415,10 @@ void setArtifactsStaged() {
     setReleasePropertyIfneeded(ARTIFACTS_STAGING_STAGE, true)
 }
 
-String getGitTagName() {
-    return params.GIT_TAG_NAME ?: getReleaseProperty('git.tag.name')
+boolean areArtifactsReleased() {
+    return hasReleaseProperty(ARTIFACTS_RELEASE_STAGE)
+}
+
+void setArtifactsReleased() {
+    setReleasePropertyIfneeded(ARTIFACTS_RELEASE_STAGE, true)
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to