From f41a24ff8617c57f0e7c20218f22e6a1f2abab67 Mon Sep 17 00:00:00 2001 From: jstastny-cz Date: Fri, 26 Apr 2024 10:49:47 +0200 Subject: [PATCH 1/4] kie-issues#1123:unify maven projects configuration --- pom.xml | 78 +++++++++++++++------------------------------------------ 1 file changed, 20 insertions(+), 58 deletions(-) diff --git a/pom.xml b/pom.xml index b3a06b4206..cab173069e 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ org.apache apache - 30 + 32 org.optaplanner @@ -64,50 +64,6 @@ 3.4.1 - - - apache-release-staging-repository - Apache Release Staging Repository - https://repository.apache.org/service/local/staging/deploy/maven2 - - - apache-snapshots-repository - Apache Snapshot Repository - https://repository.apache.org/content/repositories/snapshots/ - - - - - - apache-public-repository-group - https://repository.apache.org/content/groups/public/ - - - false - - - true - - - - - - apache-public-repository-group - Apache Public Repository Group - https://repository.apache.org/content/groups/public/ - default - - - false - - - true - daily - - - - scm:git:git@github.com:apache/incubator-kie-optaplanner.git scm:git:git@github.com:apache/incubator-kie-optaplanner.git @@ -119,28 +75,34 @@ - All developers are listed on the team website - https://www.optaplanner.org/community/team.html + The Apache KIE Team + dev@kie.apache.org + https://kie.apache.org + Apache Software Foundation + http://apache.org/ - - - All contributors are listed on the team website - https://www.optaplanner.org/community/team.html - - - Development mailing list - dev@kie.apache.org + Development List dev-subscribe@kie.apache.org dev-unsubscribe@kie.apache.org + dev@kie.apache.org https://lists.apache.org/list.html?dev@kie.apache.org - setup - https://groups.google.com/forum/#!forum/optaplanner-dev - https://groups.google.com/forum/#!forum/optaplanner-dev + User List + users-subscribe@kie.apache.org + users-unsubscribe@kie.apache.org + users@kie.apache.org + https://lists.apache.org/list.html?users@kie.apache.org + + + Commits List + commits-subscribe@kie.apache.org + commits-unsubscribe@kie.apache.org + commits@kie.apache.org + https://lists.apache.org/list.html?commits@kie.apache.org From 2d8cf6375a54110b14d1c150b5f7afb2e2519f05 Mon Sep 17 00:00:00 2001 From: jstastny-cz Date: Thu, 2 May 2024 16:50:40 +0200 Subject: [PATCH 2/4] adjust deploy operation --- .ci/jenkins/Jenkinsfile.deploy | 88 ++++++---------------------------- .ci/jenkins/dsl/jobs.groovy | 8 ---- 2 files changed, 15 insertions(+), 81 deletions(-) diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index 8720e139a5..d38318ce20 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -34,8 +34,6 @@ pipeline { PR_BRANCH_HASH = "${util.generateHash(10)}" - // Maven configuration - MAVEN_DEPLOY_LOCAL_DIR = "/tmp/maven_deploy_dir" } stages { @@ -115,13 +113,21 @@ pipeline { stage('Build OptaPlanner') { steps { script { - configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){ - getOptaplannerMavenCommand() - .withProperty('maven.test.failure.ignore', true) - .withProperty('operator.image.build') - .skipTests(params.SKIP_TESTS) - .withSettingsXmlFile(MAVEN_SETTINGS_FILE) - .run('clean install') + withCredentials([usernamePassword(credentialsId: env.MAVEN_REPO_CREDS_ID, usernameVariable: 'REPOSITORY_USER', passwordVariable: 'REPOSITORY_TOKEN')]) { + def installOrDeploy + if (shouldDeployToRepository()) { + installOrDeploy = "deploy -DdeployAtEnd -Dapache.repository.username=${REPOSITORY_USER} -Dapache.repository.password=${REPOSITORY_TOKEN} -DretryFailedDeploymentCount=5" + } else { + installOrDeploy = 'install' + } + configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){ + getOptaplannerMavenCommand() + .withProperty('maven.test.failure.ignore', true) + .withProperty('operator.image.build') + .skipTests(params.SKIP_TESTS) + .withSettingsXmlFile(MAVEN_SETTINGS_FILE) + .run("clean $installOrDeploy") + } } if (isRelease()) { updateAntoraYaml(optaplannerFolder) @@ -159,46 +165,6 @@ pipeline { } } } - stage('Deploy locally') { - steps { - script { - runMavenDeploy(getOptaplannerMavenCommand(), optaplannerRepository) - } - } - } - stage('Deploy to repository') { - when { - expression { return shouldDeployToRepository() } - } - steps { - script { - 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() } @@ -431,32 +397,8 @@ String getMavenRepoZipUrl() { return "${params.MAVEN_DEPLOY_REPOSITORY.replaceAll('/content/', '/service/local/').replaceFirst('/*$', '')}/content-compressed" } -void runMavenStage(MavenCommand mvnCmd, String localDeployId) { - MavenStagingHelper stagingHelper = getStagingHelper(mvnCmd) - deployProperties.putAll(stagingHelper.stageLocalArtifacts(env.NEXUS_STAGING_PROFILE_ID, getLocalDeploymentFolder(localDeployId))) - stagingHelper.promoteStagingRepository(env.NEXUS_BUILD_PROMOTION_PROFILE_ID) -} - -MavenStagingHelper getStagingHelper(MavenCommand mvnCmd) { - return new MavenStagingHelper(this, mvnCmd) - .withNexusReleaseUrl(env.NEXUS_RELEASE_URL) - .withNexusReleaseRepositoryId(env.NEXUS_RELEASE_REPOSITORY_ID) -} - -String getLocalDeploymentFolder(String localDeployId) { - return "${env.MAVEN_DEPLOY_LOCAL_DIR}/${localDeployId}" -} - // Getters and Setters of params/properties -boolean isSpecificArtifactsUpload() { - return env.MAVEN_DEPLOY_REPOSITORY && env.MAVEN_REPO_CREDS_ID && !isDeployDisabled() -} - -boolean shouldStageArtifacts() { - return !isSpecificArtifactsUpload() && isRelease() && !env.MAVEN_DEPLOY_REPOSITORY && !isDeployDisabled() -} - boolean shouldDeployToRepository() { return (env.MAVEN_DEPLOY_REPOSITORY || isNotTestingBuild()) && !isDeployDisabled() } diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index c4f1385a9f..37622bfc1a 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -313,14 +313,6 @@ void setupDeployJob(JobType jobType, String envName = '') { OPERATOR_IMAGE_NAME: 'optaplanner-operator', MAX_REGISTRY_RETRIES: 3, ]) - if (jobType == JobType.RELEASE) { - jobParams.env.putAll([ - NEXUS_RELEASE_URL: "${MAVEN_NEXUS_RELEASE_URL}", - NEXUS_RELEASE_REPOSITORY_ID: "${MAVEN_NEXUS_RELEASE_REPOSITORY}", - NEXUS_STAGING_PROFILE_ID: "${MAVEN_NEXUS_STAGING_PROFILE_ID}", - NEXUS_BUILD_PROMOTION_PROFILE_ID: "${MAVEN_NEXUS_BUILD_PROMOTION_PROFILE_ID}", - ]) - } } KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { parameters { From 26adabc5c2896046aa9cdb449a0e55a3ee13534c Mon Sep 17 00:00:00 2001 From: jstastny-cz Date: Fri, 3 May 2024 14:32:25 +0200 Subject: [PATCH 3/4] Revert "adjust deploy operation" This reverts commit 2d8cf6375a54110b14d1c150b5f7afb2e2519f05. --- .ci/jenkins/Jenkinsfile.deploy | 88 ++++++++++++++++++++++++++++------ .ci/jenkins/dsl/jobs.groovy | 8 ++++ 2 files changed, 81 insertions(+), 15 deletions(-) diff --git a/.ci/jenkins/Jenkinsfile.deploy b/.ci/jenkins/Jenkinsfile.deploy index d38318ce20..8720e139a5 100644 --- a/.ci/jenkins/Jenkinsfile.deploy +++ b/.ci/jenkins/Jenkinsfile.deploy @@ -34,6 +34,8 @@ pipeline { PR_BRANCH_HASH = "${util.generateHash(10)}" + // Maven configuration + MAVEN_DEPLOY_LOCAL_DIR = "/tmp/maven_deploy_dir" } stages { @@ -113,21 +115,13 @@ pipeline { stage('Build OptaPlanner') { steps { script { - withCredentials([usernamePassword(credentialsId: env.MAVEN_REPO_CREDS_ID, usernameVariable: 'REPOSITORY_USER', passwordVariable: 'REPOSITORY_TOKEN')]) { - def installOrDeploy - if (shouldDeployToRepository()) { - installOrDeploy = "deploy -DdeployAtEnd -Dapache.repository.username=${REPOSITORY_USER} -Dapache.repository.password=${REPOSITORY_TOKEN} -DretryFailedDeploymentCount=5" - } else { - installOrDeploy = 'install' - } - configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){ - getOptaplannerMavenCommand() - .withProperty('maven.test.failure.ignore', true) - .withProperty('operator.image.build') - .skipTests(params.SKIP_TESTS) - .withSettingsXmlFile(MAVEN_SETTINGS_FILE) - .run("clean $installOrDeploy") - } + configFileProvider([configFile(fileId: env.MAVEN_SETTINGS_CONFIG_FILE_ID, variable: 'MAVEN_SETTINGS_FILE')]){ + getOptaplannerMavenCommand() + .withProperty('maven.test.failure.ignore', true) + .withProperty('operator.image.build') + .skipTests(params.SKIP_TESTS) + .withSettingsXmlFile(MAVEN_SETTINGS_FILE) + .run('clean install') } if (isRelease()) { updateAntoraYaml(optaplannerFolder) @@ -165,6 +159,46 @@ pipeline { } } } + stage('Deploy locally') { + steps { + script { + runMavenDeploy(getOptaplannerMavenCommand(), optaplannerRepository) + } + } + } + stage('Deploy to repository') { + when { + expression { return shouldDeployToRepository() } + } + steps { + script { + 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() } @@ -397,8 +431,32 @@ String getMavenRepoZipUrl() { return "${params.MAVEN_DEPLOY_REPOSITORY.replaceAll('/content/', '/service/local/').replaceFirst('/*$', '')}/content-compressed" } +void runMavenStage(MavenCommand mvnCmd, String localDeployId) { + MavenStagingHelper stagingHelper = getStagingHelper(mvnCmd) + deployProperties.putAll(stagingHelper.stageLocalArtifacts(env.NEXUS_STAGING_PROFILE_ID, getLocalDeploymentFolder(localDeployId))) + stagingHelper.promoteStagingRepository(env.NEXUS_BUILD_PROMOTION_PROFILE_ID) +} + +MavenStagingHelper getStagingHelper(MavenCommand mvnCmd) { + return new MavenStagingHelper(this, mvnCmd) + .withNexusReleaseUrl(env.NEXUS_RELEASE_URL) + .withNexusReleaseRepositoryId(env.NEXUS_RELEASE_REPOSITORY_ID) +} + +String getLocalDeploymentFolder(String localDeployId) { + return "${env.MAVEN_DEPLOY_LOCAL_DIR}/${localDeployId}" +} + // Getters and Setters of params/properties +boolean isSpecificArtifactsUpload() { + return env.MAVEN_DEPLOY_REPOSITORY && env.MAVEN_REPO_CREDS_ID && !isDeployDisabled() +} + +boolean shouldStageArtifacts() { + return !isSpecificArtifactsUpload() && isRelease() && !env.MAVEN_DEPLOY_REPOSITORY && !isDeployDisabled() +} + boolean shouldDeployToRepository() { return (env.MAVEN_DEPLOY_REPOSITORY || isNotTestingBuild()) && !isDeployDisabled() } diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 37622bfc1a..c4f1385a9f 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -313,6 +313,14 @@ void setupDeployJob(JobType jobType, String envName = '') { OPERATOR_IMAGE_NAME: 'optaplanner-operator', MAX_REGISTRY_RETRIES: 3, ]) + if (jobType == JobType.RELEASE) { + jobParams.env.putAll([ + NEXUS_RELEASE_URL: "${MAVEN_NEXUS_RELEASE_URL}", + NEXUS_RELEASE_REPOSITORY_ID: "${MAVEN_NEXUS_RELEASE_REPOSITORY}", + NEXUS_STAGING_PROFILE_ID: "${MAVEN_NEXUS_STAGING_PROFILE_ID}", + NEXUS_BUILD_PROMOTION_PROFILE_ID: "${MAVEN_NEXUS_BUILD_PROMOTION_PROFILE_ID}", + ]) + } } KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { parameters { From 60872f41beda6b37c0d7b9f63fd32e96cf7ba0cf Mon Sep 17 00:00:00 2001 From: jstastny-cz Date: Tue, 14 May 2024 09:39:09 +0200 Subject: [PATCH 4/4] add missing bits --- pom.xml | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index cab173069e..63aeb98626 100644 --- a/pom.xml +++ b/pom.xml @@ -43,6 +43,10 @@ https://www.optaplanner.org 2006 + + The Apache Software Foundation + https://apache.org/ + The Apache Software License, Version 2.0 @@ -51,22 +55,9 @@ - - - - ${project.groupId}:${project.artifactId} - 4.45.0 - - - 2024-01-12T00:00:00Z - 3.4.1 - - - scm:git:git@github.com:apache/incubator-kie-optaplanner.git - scm:git:git@github.com:apache/incubator-kie-optaplanner.git + scm:git:https://github.com/apache/incubator-kie-optaplanner.git + scm:git:https://github.com/apache/incubator-kie-optaplanner.git https://github.com/apache/incubator-kie-optaplanner @@ -106,6 +97,19 @@ + + + + ${project.groupId}:${project.artifactId} + 4.45.0 + + + 2024-01-12T00:00:00Z + 3.4.1 + + build/optaplanner-bom build/optaplanner-ide-config