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

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


The following commit(s) were added to refs/heads/10.0.x by this push:
     new e18154a274 [10.0.x] kie-issues#1397: Adjust release pipelines for the 
Apache 10 release (#6030)
e18154a274 is described below

commit e18154a2740fb55e75291925f4bfde293b075132
Author: Rodrigo Antunes <[email protected]>
AuthorDate: Wed Jul 24 16:02:50 2024 -0300

    [10.0.x] kie-issues#1397: Adjust release pipelines for the Apache 10 
release (#6030)
    
    * Adjust release pipelines for the Apache 10 release
    
    * Fix identation
---
 .ci/jenkins/Jenkinsfile.deploy          |  38 +++++-----
 .ci/jenkins/dsl/jobs.groovy             |  11 ++-
 .ci/jenkins/project/Jenkinsfile.release | 118 ++++----------------------------
 3 files changed, 36 insertions(+), 131 deletions(-)

diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy
index 22bfc61114..8f32664d19 100644
--- a/.ci/jenkins/Jenkinsfile.deploy
+++ b/.ci/jenkins/Jenkinsfile.deploy
@@ -26,7 +26,7 @@ deployProperties = [:]
 
 pipeline {
     agent {
-        docker { 
+        docker {
             image env.AGENT_DOCKER_BUILDER_IMAGE
             args env.AGENT_DOCKER_BUILDER_ARGS
             label util.avoidFaultyNodes()
@@ -87,7 +87,7 @@ pipeline {
             steps {
                 script {
                     dir(getRepoName()) {
-                        if (githubscm.isBranchExist('origin',getPRBranch())) {
+                        if (githubscm.isBranchExist('origin', getPRBranch())) {
                             githubscm.removeRemoteBranch('origin', 
getPRBranch(), getGitAuthorPushCredsId())
                         }
                         githubscm.createBranch(getPRBranch())
@@ -101,7 +101,7 @@ pipeline {
             }
             steps {
                 script {
-                    configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){
+                    configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]) {
                         maven.mvnVersionsSet(
                             
getMavenCommand().withSettingsXmlFile(MAVEN_SETTINGS_FILE),
                             getProjectVersion(),
@@ -127,18 +127,13 @@ pipeline {
                            .withProperty('maven.test.failure.ignore', true)
                            .skipTests(params.SKIP_TESTS)
 
-                        def Closure mavenRunClosure = {
-                            configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]) {
-                                
mavenCommand.withSettingsXmlFile(MAVEN_SETTINGS_FILE).run("clean 
$installOrDeploy")
-                            }
-                        }
-
                         if (isRelease()) {
                             
release.gpgImportKeyFromStringWithoutPassword(getReleaseGpgSignKeyCredsId())
                             mavenCommand.withProfiles(['apache-release'])
-                            mavenRunClosure()
-                        } else {
-                            mavenRunClosure()
+                        }
+
+                        configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]) {
+                            
mavenCommand.withSettingsXmlFile(MAVEN_SETTINGS_FILE).run("clean 
$installOrDeploy")
                         }
                     }
                 }
@@ -164,6 +159,11 @@ pipeline {
                         } else {
                             println '[WARN] no changes to commit'
                         }
+
+                        // Create a new tag
+                        
githubscm.setUserConfigFromCreds(getGitAuthorPushCredsId())
+                        githubscm.tagRepository(getGitTagName())
+                        githubscm.pushRemoteTag('origin', getGitTagName(), 
getGitAuthorPushCredsId())
                     }
                 }
             }
@@ -281,18 +281,10 @@ MavenCommand getMavenCommand(String directory = '') {
     def mvnCmd = new MavenCommand(this, ['-fae', '-ntp'])
                 .withOptions(env.BUILD_MVN_OPTS ? [ env.BUILD_MVN_OPTS ] : [])
                 .inDirectory(directory)
-    if (!isMainStream()) { // Workaround as enforcer rules may not be fixed on 
other streams
-        mvnCmd.withProperty('enforcer.skip')
-    } else {
-        mvnCmd.withProperty('full')
-    }
+                .withProperty('full')
     return mvnCmd
 }
 
-boolean isMainStream() {
-    return env.DROOLS_STREAM == 'main'
-}
-
 String getReleaseGpgSignKeyCredsId() {
     return env.RELEASE_GPG_SIGN_KEY_CREDS_ID
 }
@@ -300,3 +292,7 @@ String getReleaseGpgSignKeyCredsId() {
 String getReleaseGpgSignPassphraseCredsId() {
     return env.RELEASE_GPG_SIGN_PASSPHRASE_CREDS_ID
 }
+
+String getGitTagName() {
+    return params.GIT_TAG_NAME
+}
diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy
index 5e92426421..fc310311ec 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(JobType jobType) {
             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