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

jstastnycz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-optaplanner.git


The following commit(s) were added to refs/heads/main by this push:
     new 078ceea334 [incubator-kie-issues#732] Refactor uploading artifacts to 
deploy repository
078ceea334 is described below

commit 078ceea3346bf17d30e21c6cfa674e2ac1e5f109
Author: cimbalek <[email protected]>
AuthorDate: Tue Dec 5 10:54:04 2023 +0100

    [incubator-kie-issues#732] Refactor uploading artifacts to deploy repository
    
    use merge-maven-repos plugin
---
 .ci/jenkins/Jenkinsfile.deploy | 45 ++++++++++++++++++++++++------------------
 .ci/jenkins/dsl/jobs.groovy    |  4 +++-
 2 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy
index ef2922e592..c7a708b7e9 100644
--- a/.ci/jenkins/Jenkinsfile.deploy
+++ b/.ci/jenkins/Jenkinsfile.deploy
@@ -158,39 +158,46 @@ pipeline {
                 }
             }
         }
-
-        stage('Deploy to repository') {
-            when {
-                expression { return !shouldStageArtifacts() && 
!isSpecificArtifactsUpload() && shouldDeployToRepository() }
-            }
-            steps {
-                script {
-                    runMavenDeploy(getOptaplannerMavenCommand())
-                    
runMavenDeploy(getOptaplannerQuickstartsMavenCommand().withOptions(['-pl', 
':optaplanner-distribution']))
-                }
-            }
-        }
         stage('Deploy locally') {
-            when {
-                expression { return shouldStageArtifacts() || 
isSpecificArtifactsUpload() }
-            }
             steps {
                 script {
                     runMavenDeploy(getOptaplannerMavenCommand(), 
optaplannerRepository)
                 }
             }
         }
-        stage('Upload artifacts to given repository') {
+        stage('Deploy to repository') {
             when {
-                expression { return isSpecificArtifactsUpload() }
+                expression { return  shouldDeployToRepository() }
             }
             steps {
                 script {
-                    // Deploy to specific repository with credentials
-                    maven.uploadLocalArtifacts(env.MAVEN_REPO_CREDS_ID, 
getLocalDeploymentFolder(optaplannerRepository), getMavenRepoZipUrl())
+                    withCredentials([usernamePassword(credentialsId: 
env.MAVEN_REPO_CREDS_ID, usernameVariable: 'REPOSITORY_USER', passwordVariable: 
'REPOSITORY_TOKEN')]) {
+                        configFileProvider([configFile(fileId: 
env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]) {
+                            new MavenCommand(this)
+                                    .withSettingsXmlFile(MAVEN_SETTINGS_FILE)
+                                    .withProperty('wagon.source', 
"file://${getLocalDeploymentFolder(optaplannerRepository)}")
+                                    .withProperty('wagon.target', 
MAVEN_DEPLOY_REPOSITORY)
+                                    .withProperty('wagon.targetId', 
'apache-snapshots-repository')
+                                    
.withProperty('apache.snapshot.repository.username', REPOSITORY_USER)
+                                    
.withProperty('apache.snapshot.repository.password', REPOSITORY_TOKEN)
+                                    
.run("org.codehaus.mojo:wagon-maven-plugin:2.0.2:merge-maven-repos")
+                        }
+                    }
                 }
             }
         }
+
+//        stage('Upload artifacts to given repository') {
+//            when {
+//                expression { return isSpecificArtifactsUpload() }
+//            }
+//            steps {
+//                script {
+//                    // Deploy to specific repository with credentials
+//                    maven.uploadLocalArtifacts(env.MAVEN_REPO_CREDS_ID, 
getLocalDeploymentFolder(optaplannerRepository), getMavenRepoZipUrl())
+//                }
+//            }
+//        }
         stage('Stage artifacts') {
             when {
                 expression { return shouldStageArtifacts() }
diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy
index 04aea49c50..d6e9285ee9 100644
--- a/.ci/jenkins/dsl/jobs.groovy
+++ b/.ci/jenkins/dsl/jobs.groovy
@@ -310,7 +310,9 @@ void setupDeployJob(JobType jobType, String envName = '') {
             GIT_AUTHOR_PUSH_CREDS_ID: "${GIT_AUTHOR_PUSH_CREDENTIALS_ID}",
 
             MAVEN_DEPENDENCIES_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}",
-            MAVEN_DEPLOY_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}",
+
+            MAVEN_DEPLOY_REPOSITORY: 
"${MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_URL}",
+            MAVEN_REPO_CREDS_ID: 
"${MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_CREDS_ID}",
 
             OPERATOR_IMAGE_NAME: 'optaplanner-operator',
             MAX_REGISTRY_RETRIES: 3,


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

Reply via email to