diff --git a/.ci/jenkins/config/branch.yaml b/.ci/jenkins/config/branch.yaml index a7a76e16e..39e526171 100644 --- a/.ci/jenkins/config/branch.yaml +++ b/.ci/jenkins/config/branch.yaml @@ -66,7 +66,11 @@ buildchain_config: file_path: .ci/pull-request-config.yaml token_credentials_id: kie-ci3-token maven: - settings_file_id: kie-release-settings + settings: + nightly: + config_file_id: kie-nightly-settings + release: + config_file_id: kie-release-settings nexus: release_url: TO_DEFINE release_repository: TO_DEFINE @@ -75,8 +79,12 @@ maven: build_promotion_profile_id: TO_DEFINE artifacts_repository: '' artifacts_upload_repository: - url: https://repository.apache.org/content/repositories/snapshots - creds_id: apache-nexus-kie-deploy-credentials + nightly: + url: https://repository.apache.org/content/repositories/snapshots + creds_id: apache-nexus-kie-deploy-credentials + release: + url: https://repository.apache.org/service/local/staging/deploy/maven2 + creds_id: jenkins-deploy-to-nexus-staging quarkus_platform_repository: url: TO_DEFINE creds_id: TO_DEFINE diff --git a/.ci/jenkins/dsl/jobs.groovy b/.ci/jenkins/dsl/jobs.groovy index 68578b345..7f063893a 100644 --- a/.ci/jenkins/dsl/jobs.groovy +++ b/.ci/jenkins/dsl/jobs.groovy @@ -213,7 +213,7 @@ void setupWeeklyCloudJob() { IMAGE_NAMESPACE: "${CLOUD_IMAGE_NAMESPACE}", BRANCH_FOR_LATEST: "${CLOUD_IMAGE_LATEST_GIT_BRANCH}", - MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}", + MAVEN_SETTINGS_CONFIG_FILE_ID: Utils.getMavenSettingsConfigFileId(this, JobType.NIGHTLY.name), ARTIFACTS_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}", ]) KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { @@ -245,7 +245,7 @@ void setupNightlyCloudJob() { IMAGE_NAMESPACE: "${CLOUD_IMAGE_NAMESPACE}", BRANCH_FOR_LATEST: "${CLOUD_IMAGE_LATEST_GIT_BRANCH}", - MAVEN_SETTINGS_CONFIG_FILE_ID: "${MAVEN_SETTINGS_FILE_ID}", + MAVEN_SETTINGS_CONFIG_FILE_ID: Utils.getMavenSettingsConfigFileId(this, JobType.NIGHTLY.name), ARTIFACTS_REPOSITORY: "${MAVEN_ARTIFACTS_REPOSITORY}", ]) KogitoJobTemplate.createPipelineJob(this, jobParams)?.with { diff --git a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/KogitoJobUtils.groovy b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/KogitoJobUtils.groovy index 7709ba70f..bdc2f6b80 100644 --- a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/KogitoJobUtils.groovy +++ b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/KogitoJobUtils.groovy @@ -261,7 +261,7 @@ class KogitoJobUtils { def jobParams = JobParamsUtils.getSeedJobParamsWithEnv(script, "${Utils.getRepositoryJobDisplayName(script, repository)}.build-and-test", JobType.NIGHTLY, envName, KogitoConstants.BUILD_CHAIN_JENKINSFILE, "Build & Test for ${repository} using the build-chain", defaultJobParamsGetter) jobParams.env.putAll(extraEnv) jobParams.triggers = jobParams.triggers ?: [ cron : '@midnight' ] // To remove once environment nightlies are managed by main nightly pipeline - return createBranchBuildChainJob(script, jobParams, repository, enableNotification, envName) + return createBranchBuildChainJob(script, JobType.NIGHTLY, jobParams, repository, enableNotification, envName) } /** @@ -280,9 +280,9 @@ class KogitoJobUtils { */ static def createNightlyBuildChainBuildAndDeployJob(def script, String envName = '', String repository, Map extraEnv = [:], boolean enableNotification = false, Closure defaultJobParamsGetter = JobParamsUtils.DEFAULT_PARAMS_GETTER) { def jobParams = JobParamsUtils.getSeedJobParamsWithEnv(script, "${Utils.getRepositoryJobDisplayName(script, repository)}.build-and-deploy", JobType.NIGHTLY, envName, KogitoConstants.BUILD_CHAIN_JENKINSFILE, "Build & Deploy for ${repository} using the build-chain", defaultJobParamsGetter) - JobParamsUtils.setupJobParamsDeployConfiguration(script, jobParams) + JobParamsUtils.setupJobParamsDeployConfiguration(script, JobType.NIGHTLY, jobParams) jobParams.env.putAll(extraEnv) - return createBranchBuildChainJob(script, jobParams, repository, enableNotification, envName) + return createBranchBuildChainJob(script, JobType.NIGHTLY, jobParams, repository, enableNotification, envName) } /** @@ -292,7 +292,7 @@ class KogitoJobUtils { * */ static def createNightlyBuildChainIntegrationJob(def script, String envName, String repository, boolean enableNotification = false, Closure defaultJobParamsGetter = JobParamsUtils.DEFAULT_PARAMS_GETTER) { - return createBuildChainIntegrationJob(script, envName, repository, enableNotification) { jenkinsScript -> + return createBuildChainIntegrationJob(script, JobType.NIGHTLY, envName, repository, enableNotification) { jenkinsScript -> def jobParams = defaultJobParamsGetter(jenkinsScript) jobParams.triggers = jobParams.triggers ?: [ cron : '@midnight' ] // To remove once environment nightlies are managed by main nightly pipeline return jobParams @@ -305,13 +305,13 @@ class KogitoJobUtils { * This job will call the build-chain with extra environment variables to allow for the creation of an integration branch * */ - static def createBuildChainIntegrationJob(def script, String envName, String repository, boolean enableNotification = false, Closure defaultJobParamsGetter = JobParamsUtils.DEFAULT_PARAMS_GETTER) { + static def createBuildChainIntegrationJob(def script, JobType jobType, String envName, String repository, boolean enableNotification = false, Closure defaultJobParamsGetter = JobParamsUtils.DEFAULT_PARAMS_GETTER) { def jobParams = JobParamsUtils.getSeedJobParamsWithEnv(script, "${Utils.getRepositoryJobDisplayName(script, repository)}.integration", JobType.NIGHTLY, envName, KogitoConstants.BUILD_CHAIN_JENKINSFILE, "Integration with Quarkus for ${repository} using the build-chain", defaultJobParamsGetter) if (!envName) { throw new RuntimeException('Please provide a non-empty environment to generate an integration branch job...') } JobParamsUtils.setupJobParamsIntegrationBranchConfiguration(script, jobParams, envName) - return createBranchBuildChainJob(script, jobParams, repository, enableNotification, envName) + return createBranchBuildChainJob(script, jobType, jobParams, repository, enableNotification, envName) } /** @@ -323,7 +323,7 @@ class KogitoJobUtils { * - enableNotification: Whether notification should be sent in case of unsuccessful pipeline * - notificationJobName: Identifier for the notification stream */ - static def createBranchBuildChainJob(def script, def jobParams, String repository, boolean enableNotification = false, String notificationJobName = '') { + static def createBranchBuildChainJob(def script, JobType jobType, def jobParams, String repository, boolean enableNotification = false, String notificationJobName = '') { JobParamsUtils.setupJobParamsBuildChainConfiguration(script, jobParams, repository, 'branch', notificationJobName) jobParams.parametersClosures.add({ @@ -340,7 +340,7 @@ class KogitoJobUtils { GIT_AUTHOR: Utils.getGitAuthor(script), - MAVEN_SETTINGS_CONFIG_FILE_ID: Utils.getBindingValue(script, 'MAVEN_SETTINGS_FILE_ID'), + MAVEN_SETTINGS_CONFIG_FILE_ID: Utils.getMavenSettingsConfigFileId(script, jobType.name), ]) return KogitoJobTemplate.createPipelineJob(script, jobParams) diff --git a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy index 85afb3a96..d75689f74 100644 --- a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy +++ b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/Utils.groovy @@ -258,12 +258,12 @@ class Utils { return getBindingValue(script, 'BUILDCHAIN_CONFIG_GIT_TOKEN_CREDENTIALS_ID') } - static String getMavenArtifactsUploadRepositoryUrl(def script) { - return getBindingValue(script, 'MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_URL') + static String getMavenArtifactsUploadRepositoryUrl(def script, String jobType = "nightly") { + return getBindingValue(script, "MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_${jobType.toUpperCase()}_URL") } - static String getMavenArtifactsUploadRepositoryCredentialsId(def script) { - return getBindingValue(script, 'MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_CREDS_ID') + static String getMavenArtifactsUploadRepositoryCredentialsId(def script, String jobType = "nightly") { + return getBindingValue(script, "MAVEN_ARTIFACTS_UPLOAD_REPOSITORY_${jobType.toUpperCase()}_CREDS_ID") } static String getMavenQuarkusPlatformRepositoryUrl(def script) { @@ -274,6 +274,10 @@ class Utils { return getBindingValue(script, 'MAVEN_QUARKUS_PLATFORM_REPOSITORY_CREDS_ID') } + static String getMavenSettingsConfigFileId(def script, String jobType = 'nightly') { + return getBindingValue(script, "MAVEN_SETTINGS_${jobType.toUpperCase()}_CONFIG_FILE_ID") + } + static String getJenkinsAgentDockerImage(def script, String imageId) { return getBindingValue(script, "JENKINS_AGENT_DOCKER_${imageId.toUpperCase()}_IMAGE") } diff --git a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy index 9758d0fe5..5ef9bf7db 100644 --- a/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy +++ b/dsl/seed/src/main/groovy/org/kie/jenkins/jobdsl/utils/JobParamsUtils.groovy @@ -186,11 +186,11 @@ class JobParamsUtils { addJobParamsEnvIfNotExisting(script, jobParams, 'INTEGRATION_BRANCH_CURRENT', "${Utils.getGenerationBranch(script)}-integration-${envName}") } - static def setupJobParamsDeployConfiguration(def script, def jobParams) { + static def setupJobParamsDeployConfiguration(def script, JobType jobType, def jobParams) { jobParams.env = jobParams.env ?: [:] jobParams.env.put('ENABLE_DEPLOY', String.valueOf(!Utils.isDeployDisabled(script))) addJobParamsEnvIfNotExisting(script, jobParams, 'MAVEN_DEPLOY_REPOSITORY', Utils.getMavenArtifactsUploadRepositoryUrl(script)) - addJobParamsEnvIfNotExisting(script, jobParams, 'MAVEN_DEPLOY_REPOSITORY_CREDS_ID', Utils.getMavenArtifactsUploadRepositoryCredentialsId(script)) + addJobParamsEnvIfNotExisting(script, jobParams, 'MAVEN_DEPLOY_REPOSITORY_CREDS_ID', Utils.getMavenArtifactsUploadRepositoryCredentialsId(script, jobType.name)) } static def setupJobParamsAgentDockerBuilderImageConfiguration(def script, def jobParams) {