diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0a430370b60..fb77523cf3e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -507,7 +507,6 @@ For primary branches, it may also re-execute the same build in different environ See [this section](#building-from-source) for information on how to execute similar builds from the commandline. The job can be triggered manually, which is particularly useful to test more environments on a pull request. - ### Release pipeline https://ci.hibernate.org/job/hibernate-search/ diff --git a/Jenkinsfile b/Jenkinsfile index 3437a197351..f60a92c073f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -51,15 +51,6 @@ import org.hibernate.jenkins.pipeline.helpers.alternative.AlternativeMultiMap * * ### Integrations * - * #### Nexus deployment - * - * This job is only able to deploy snapshot artifacts, - * for every non-PR build on "primary" branches (main and maintenance branches), - * but the name of a Maven settings file must be provided in the job configuration file - * (see below). - * - * For actual releases, see jenkins/release.groovy. - * * #### AWS * * This job will trigger integration tests against an Elasticsearch service hosted on AWS. @@ -140,11 +131,6 @@ import org.hibernate.jenkins.pipeline.helpers.alternative.AlternativeMultiMap * # See https://docs.gradle.com/enterprise/gradle-plugin/#via_environment_variable * # WARNING: These credentials should not give write access to the build cache! * pr: ... - * deployment: - * maven: - * # String containing the ID of a Maven settings file registered using the config-file-provider Jenkins plugin. - * # The settings must provide credentials to the server with ID 'ossrh'. - * settingsId: ... */ @Field final String DEFAULT_JDK_TOOL = 'OpenJDK 21 Latest' @@ -162,7 +148,6 @@ import org.hibernate.jenkins.pipeline.helpers.alternative.AlternativeMultiMap @Field boolean enableDefaultBuild = false @Field boolean enableDefaultBuildIT = false -@Field boolean deploySnapshot = false @Field boolean incrementalBuild = false this.helper = new JobHelper(this) @@ -372,15 +357,6 @@ Some useful filters: 'default', 'jdk', 'jdk-10', 'eclipse', 'postgresql', 'elast ]) ]) - if (helper.scmSource.branch.primary && !helper.scmSource.pullRequest) { - if (helper.configuration.file?.deployment?.maven?.settingsId) { - deploySnapshot = true - } - else { - echo "Missing deployment configuration in job configuration file - snapshot deployment will be skipped." - } - } - if (params.ENVIRONMENT_FILTER) { keepOnlyEnvironmentsMatchingFilter(params.ENVIRONMENT_FILTER) } @@ -399,8 +375,7 @@ Some useful filters: 'default', 'jdk', 'jdk-10', 'eclipse', 'postgresql', 'elast enableDefaultBuild = enableDefaultBuildIT || - environments.content.any { key, envSet -> envSet.enabled.any { buildEnv -> buildEnv.requiresDefaultBuildArtifacts() } } || - deploySnapshot + environments.content.any { key, envSet -> envSet.enabled.any { buildEnv -> buildEnv.requiresDefaultBuildArtifacts() } } if (helper.scmSource.pullRequest) { incrementalBuild = true @@ -415,7 +390,6 @@ Resulting execution plan: enableDefaultBuild=$enableDefaultBuild enableDefaultBuildIT=$enableDefaultBuildIT environments=${environments.enabledAsString} - deploySnapshot=$deploySnapshot incrementalBuild=$incrementalBuild """ } @@ -427,7 +401,7 @@ stage('Default build') { return } runBuildOnNode( NODE_PATTERN_BASE, [time: 2, unit: 'HOURS'] ) { - withMavenWorkspace(mavenSettingsConfig: deploySnapshot ? helper.configuration.file.deployment.maven.settingsId : null) { + withMavenWorkspace { String commonMavenArgs = """ \ --fail-at-end \ -Pcoverage \ @@ -440,12 +414,7 @@ stage('Default build') { -Pdist \ -Pjqassistant -Pci-build \ -DskipITs \ - clean \ - ${deploySnapshot ? "\ - deploy \ - " : "\ - install \ - "} \ + clean install \ """ dir(helper.configuration.maven.localRepositoryPath) { stash name:'default-build-result', includes:"org/hibernate/search/**" diff --git a/MAINTAINERS.md b/MAINTAINERS.md index cd75a9e59b9..546482b2014 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -40,6 +40,17 @@ For primary branches, it may also re-execute the same build in different environ See [CONTRIBUTING.md](CONTRIBUTING.md#building-from-source) for information about how to execute similar builds from the commandline. +### Snapshot publishing pipeline + +https://ci.hibernate.org/job/hibernate-search-publish-snapshot/ + +This job takes care of publishing snapshots for primary branches. + +It is triggered automatically on push to each branch, but throttled +to avoid problems when multiple PRs get merged in short span of time. + +See [ci/snapshot-publish/Jenkinsfile](ci/snapshot-publish/Jenkinsfile) for the job definition. + ### Release pipeline https://ci.hibernate.org/job/hibernate-search-release/ diff --git a/ci/release/Jenkinsfile b/ci/release/Jenkinsfile index bf09aa0bd2e..b3788d27db9 100644 --- a/ci/release/Jenkinsfile +++ b/ci/release/Jenkinsfile @@ -9,7 +9,7 @@ import org.hibernate.jenkins.pipeline.helpers.version.Version pipeline { agent { - label 'Worker&&Containers' + label 'Release' } tools { maven 'Apache Maven 3.9' diff --git a/ci/snapshot-publish/Jenkinsfile b/ci/snapshot-publish/Jenkinsfile new file mode 100644 index 00000000000..cc58dda587b --- /dev/null +++ b/ci/snapshot-publish/Jenkinsfile @@ -0,0 +1,53 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * Copyright Red Hat Inc. and Hibernate Authors + */ + +@Library('hibernate-jenkins-pipeline-helpers') _ + +// Avoid running the pipeline on branch indexing +if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) { + print "INFO: Build skipped due to trigger being Branch Indexing" + currentBuild.result = 'NOT_BUILT' + return +} + +pipeline { + agent { + label 'Release' + } + tools { + maven 'Apache Maven 3.9' + jdk 'OpenJDK 21 Latest' + } + options { + // Wait for 1h before publishing snapshots, in case there's more commits. + quietPeriod 3600 + // In any case, never publish snapshots more than once per hour. + rateLimitBuilds(throttle: [count: 1, durationName: 'hour', userBoost: true]) + + buildDiscarder(logRotator(numToKeepStr: '3', artifactNumToKeepStr: '3')) + disableConcurrentBuilds(abortPrevious: false) + } + stages { + stage('Publish') { + steps { + script { + withMaven(mavenSettingsConfig: 'ci-hibernate.deploy.settings.maven', + mavenLocalRepo: env.WORKSPACE_TMP + '/.m2repository') { + sh """mvn \ + -Pci-build \ + -DskipTests \ + clean deploy \ + """ + } + } + } + } + } + post { + always { + notifyBuildResult notifySuccessAfterSuccess: false, maintainers: 'marko@hibernate.org' + } + } +}