You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by ra...@apache.org on 2024/04/10 19:40:32 UTC

(incubator-kie-kogito-images) 01/01: Debug kie_issues_1082

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

rantunes pushed a commit to branch kie_issues_1082
in repository https://gitbox.apache.org/repos/asf/incubator-kie-kogito-images.git

commit 651c2789f429d31a76b41070595842986928323f
Author: Rodrigo Antunes <co...@rodrigoantunes.com.br>
AuthorDate: Wed Apr 10 16:40:14 2024 -0300

    Debug kie_issues_1082
---
 .ci/jenkins/Jenkinsfile.build-image   | 33 +++++++++++++++++++++++++++++++++
 .ci/jenkins/Jenkinsfile.weekly.deploy |  3 +++
 .ci/jenkins/dsl/jobs.groovy           |  2 ++
 3 files changed, 38 insertions(+)

diff --git a/.ci/jenkins/Jenkinsfile.build-image b/.ci/jenkins/Jenkinsfile.build-image
index 892c0343..91f1e17e 100644
--- a/.ci/jenkins/Jenkinsfile.build-image
+++ b/.ci/jenkins/Jenkinsfile.build-image
@@ -91,9 +91,25 @@ pipeline {
                         echo "Setup Repository url to '${getMavenArtifactRepository()}'"
                         runPythonCommand("python scripts/update-repository.py  --repo-url ${getMavenArtifactRepository()}")
                     }
+                    // Set current project version
+                    if (params.UPDATE_KOGITO_VERSION) {
+                        env.PROJECT_VERSION = runPythonCommand("python scripts/retrieve_version.py", true).trim()
+                    }
+                }
+            }
+        }
+
+        stage('Update project version') {
+            when {
+                expression { params.UPDATE_KOGITO_VERSION }
+            }
+            steps {
+                script {
+                    runPythonCommand("python scripts/manage-kogito-version.py --bump-to ${getProjectVersion()} --confirm")
                 }
             }
         }
+
         // Commented as we cannot fully rely on Quarkus platform
         // Should be uncommmented once https://issues.redhat.com/browse/KOGITO-9120 is implemented
         // stage('Setup Quarkus platform') {
@@ -415,3 +431,20 @@ String getTriggeringProjectName() {
     }
     return ""
 }
+
+String getCheckoutDatetime() {
+    return params.GIT_CHECKOUT_DATETIME
+}
+
+String getProjectVersionDate() {
+    def projectVersionDate = (getCheckoutDatetime() =~ /(\d{4}-\d{2}-\d{2})/)[0][0]
+    return projectVersionDate.replace('-', '')
+}
+
+String getProjectVersion(boolean keepSnapshotSuffix = true) {
+    def projectVersion = env.PROJECT_VERSION
+    if (keepSnapshotSuffix) {
+        return projectVersion.replace("-SNAPSHOT", "-${getProjectVersionDate()}-SNAPSHOT")
+    }
+    return projectVersion.replace("-SNAPSHOT", "-${getProjectVersionDate()}")
+}
diff --git a/.ci/jenkins/Jenkinsfile.weekly.deploy b/.ci/jenkins/Jenkinsfile.weekly.deploy
index cf648e8a..bb8313c2 100644
--- a/.ci/jenkins/Jenkinsfile.weekly.deploy
+++ b/.ci/jenkins/Jenkinsfile.weekly.deploy
@@ -194,6 +194,7 @@ void createBuildAndTestStageClosure(String image) {
             buildParams.add(string(name: 'BUILD_IMAGE_NAME', value: image))
             buildParams.add(string(name: 'SOURCE_AUTHOR', value: getGitAuthor()))
             buildParams.add(string(name: 'SOURCE_BRANCH', value: getBuildBranch()))
+            buildParams.add(string(name: 'GIT_CHECKOUT_DATETIME', value: getCheckoutDatetime()))
 
             buildParams.add(string(name: 'MAVEN_ARTIFACTS_REPOSITORY', value: env.MAVEN_ARTIFACT_REPOSITORY))
             buildParams.add(string(name: 'BUILD_KOGITO_APPS_URI', value: params.APPS_URI))
@@ -202,6 +203,8 @@ void createBuildAndTestStageClosure(String image) {
             buildParams.add(string(name: 'TESTS_KOGITO_EXAMPLES_URI', value: params.EXAMPLES_URI))
             buildParams.add(string(name: 'TESTS_KOGITO_EXAMPLES_REF', value: params.EXAMPLES_REF))
 
+            buildParams.add(booleanParam(name: 'UPDATE_KOGITO_VERSION', value: true))
+
             buildParams.add(booleanParam(name: 'DEPLOY_IMAGE', value: true))
             buildParams.add(booleanParam(name: 'DEPLOY_IMAGE_USE_OPENSHIFT_REGISTRY', value: isDeployImageInOpenshiftRegistry()))
             buildParams.add(string(name: 'DEPLOY_IMAGE_REGISTRY_CREDENTIALS', value: getDeployImageRegistryCredentials()))
diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy
index 5ed082bb..ec24e08d 100644
--- a/.ci/jenkins/dsl/jobs.groovy
+++ b/.ci/jenkins/dsl/jobs.groovy
@@ -180,12 +180,14 @@ void setupBuildImageJob(JobType jobType) {
             stringParam('SOURCE_AUTHOR', Utils.getGitAuthor(this), 'Build author')
             stringParam('SOURCE_BRANCH', Utils.getGitBranch(this), 'Build branch name')
             stringParam('TARGET_BRANCH', '', '(Optional) In case of a PR to merge with target branch, please provide the target branch')
+            stringParam('GIT_CHECKOUT_DATETIME', '', '(Optional) Git checkout date and time - (Y-m-d H:i), required to update kogito version')
 
             // Build information
             stringParam('MAVEN_ARTIFACTS_REPOSITORY', "${MAVEN_ARTIFACTS_REPOSITORY}")
             stringParam('BUILD_KOGITO_APPS_URI', '', '(Optional) Git uri to the kogito-apps repository to use for tests.')
             stringParam('BUILD_KOGITO_APPS_REF', '', '(Optional) Git reference (branch/tag) to the kogito-apps repository to use for building. Default to BUILD_BRANCH_NAME.')
             stringParam('QUARKUS_PLATFORM_URL', Utils.getMavenQuarkusPlatformRepositoryUrl(this), 'URL to the Quarkus platform to use. The version to use will be guessed from artifacts.')
+            booleanParam('UPDATE_KOGITO_VERSION', false, '(Optional) Update Kogito Version')
 
             // Test information
             booleanParam('SKIP_TESTS', false, 'Skip tests')


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org