Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 3 additions & 34 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,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.
*
* ### Job configuration
*
* This Jenkinsfile gets its configuration from four sources:
Expand All @@ -82,11 +73,6 @@ import org.hibernate.jenkins.pipeline.helpers.alternative.AlternativeMultiMap
*
* Below is the additional structure specific to this Jenkinsfile:
*
* 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 17 Latest'
Expand All @@ -104,7 +90,6 @@ import org.hibernate.jenkins.pipeline.helpers.alternative.AlternativeMultiMap

@Field boolean enableDefaultBuild = false
@Field boolean enableDefaultBuildIT = false
@Field boolean deploySnapshot = false

this.helper = new JobHelper(this)

Expand Down Expand Up @@ -193,15 +178,6 @@ Some useful filters: 'default', 'jdk', 'jdk-10', 'eclipse'.
])
])

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)
}
Expand All @@ -225,8 +201,7 @@ Some useful filters: 'default', 'jdk', 'jdk-10', 'eclipse'.

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() } }

echo """Branch: ${helper.scmSource.branch.name}
PR: ${helper.scmSource.pullRequest?.id}
Expand All @@ -237,7 +212,6 @@ Resulting execution plan:
enableDefaultBuild=$enableDefaultBuild
enableDefaultBuildIT=$enableDefaultBuildIT
environments=${environments.enabledAsString}
deploySnapshot=$deploySnapshot
"""
}

Expand All @@ -248,15 +222,10 @@ stage('Default build') {
return
}
runBuildOnNode {
withMavenWorkspace(mavenSettingsConfig: deploySnapshot ? helper.configuration.file.deployment.maven.settingsId : null) {
withMavenWorkspace {
mvn """ \
clean \
clean install \
--fail-at-end \
${deploySnapshot ? "\
deploy -DdeployAtEnd=true \
" : "\
install \
"} \
-Pdist \
-Pcoverage \
-Pjqassistant -Pci-build \
Expand Down
4 changes: 2 additions & 2 deletions jenkins/release.groovy → jenkins/release/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -87,7 +87,7 @@ pipeline {
}
post {
always {
notifyBuildResult notifySuccessAfterSuccess: true, maintainers: 'guillaume.smet@hibernate.org'
notifyBuildResult notifySuccessAfterSuccess: true, maintainers: 'marko@hibernate.org'
}
}
}
53 changes: 53 additions & 0 deletions jenkins/snapshot-publish/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -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 17 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'
}
}
}
Loading