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 3d64fe05ff7bd43709860178f0eec75b657187ec
Author: Rodrigo Antunes <[email protected]>
AuthorDate: Wed Jul 24 16:02:50 2024 -0300

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

diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy
index 4d4cca2928..60d233340d 100644
--- a/.ci/jenkins/Jenkinsfile.deploy
+++ b/.ci/jenkins/Jenkinsfile.deploy
@@ -82,7 +82,7 @@ pipeline {
         }
         stage('Prepare for PR') {
             when {
-                expression { return isCreatePr() }
+                expression { return isRelease() || isCreatePr() }
             }
             steps {
                 script {
@@ -129,9 +129,8 @@ 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')]) {
@@ -151,7 +150,7 @@ pipeline {
         }
         stage('Create PR') {
             when {
-                expression { return isCreatePr() }
+                expression { return isRelease() || isCreatePr() }
             }
             steps {
                 script {
@@ -161,6 +160,11 @@ pipeline {
                         } else {
                             println '[WARN] no changes to commit'
                         }
+
+                        // Create a new tag
+                        
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
+                        githubscm.tagRepository(getGitTagName())
+                        githubscm.pushRemoteTag('origin', getGitTagName(), 
getGitAuthorPushCredsId())
                     }
                 }
             }
@@ -175,29 +179,6 @@ 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 131579fbdb..4d2a510a27 100644
--- a/.ci/jenkins/dsl/jobs.groovy
+++ b/.ci/jenkins/dsl/jobs.groovy
@@ -126,17 +126,14 @@ 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('DROOLS_VERSION', '', 'Drools version to release as 
Major.minor.micro')
+            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')
 
             booleanParam('SKIP_TESTS', false, 'Skip all tests')
         }
@@ -338,6 +335,8 @@ 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 030dbeb6b7..2f8d96ed50 100644
--- a/.ci/jenkins/project/Jenkinsfile.release
+++ b/.ci/jenkins/project/Jenkinsfile.release
@@ -22,10 +22,8 @@ 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'
@@ -54,22 +52,17 @@ pipeline {
                         echo "Release properties imported from previous job: 
${releaseProperties}"
                     }
 
-                    assert getDroolsVersion()
+                    assert getReleaseVersion()
 
                     currentBuild.displayName = getDisplayName()
 
-                    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'
-                    }
+                    sendNotification("Release Pipeline has started...\nDrools 
version = ${getReleaseVersion()}\n=> ${env.BUILD_URL}")
                 }
             }
             post {
                 always {
-                    setReleasePropertyIfneeded('drools.version', 
getDroolsVersion())
+                    setReleasePropertyIfneeded('release.version', 
getReleaseVersion())
+                    setReleasePropertyIfneeded('git.tag.name', getGitTagName())
                 }
             }
         }
@@ -79,89 +72,21 @@ 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. You 
can find them here: ${getStagingRepository()}")
+                        sendNotification('All artifacts have been staged.')
                     }
                     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 {
@@ -232,10 +157,6 @@ String getDeployJobName(String repository) {
     return "${repository}-deploy"
 }
 
-String getPromoteJobName(String repository) {
-    return "${repository}-promote"
-}
-
 String getJobPropertySuffix(String jobName) {
     return "${JOB_PROPERTY_PREFIX}.${jobName}"
 }
@@ -330,9 +251,10 @@ def readPropertiesFromUrl(String url, String 
propsFilename) {
 
 List getDefaultBuildParams() {
     List buildParams = []
-    addDisplayNameParam(buildParams, getDisplayName(getDroolsVersion()))
-    addStringParam(buildParams, 'PROJECT_VERSION', getDroolsVersion())
-    addStringParam(buildParams, 'DROOLS_PR_BRANCH', 
"drools-${getDroolsVersion()}")
+    addDisplayNameParam(buildParams, getDisplayName(getReleaseVersion()))
+    addStringParam(buildParams, 'PROJECT_VERSION', getReleaseVersion())
+    addStringParam(buildParams, 'DROOLS_PR_BRANCH', 
"drools-${getReleaseVersion()}")
+    addStringParam(buildParams, 'GIT_TAG_NAME', getGitTagName())
     return buildParams
 }
 
@@ -367,26 +289,18 @@ void addBooleanParam(List buildParams, String key, 
boolean value) {
 }
 
 String getDisplayName(version = '') {
-    version = version ?: getDroolsVersion()
+    version = version ?: getReleaseVersion()
     return "Release ${version}"
 }
 
-String getDroolsVersion() {
-    return params.DROOLS_VERSION ?: getReleaseProperty('drools.version')
+String getReleaseVersion() {
+    return params.RELEASE_VERSION ?: getReleaseProperty('release.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
@@ -415,10 +329,6 @@ void setArtifactsStaged() {
     setReleasePropertyIfneeded(ARTIFACTS_STAGING_STAGE, true)
 }
 
-boolean areArtifactsReleased() {
-    return hasReleaseProperty(ARTIFACTS_RELEASE_STAGE)
-}
-
-void setArtifactsReleased() {
-    setReleasePropertyIfneeded(ARTIFACTS_RELEASE_STAGE, true)
+String getGitTagName() {
+    return params.GIT_TAG_NAME ?: getReleaseProperty('git.tag.name')
 }


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

Reply via email to