Don't run CI jobs on pushes to branch
This commit is contained in:
parent
ab56a44a49
commit
67c4a36c96
|
@ -7,9 +7,6 @@
|
|||
name: Hibernate ORM build-Atlas
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '6.2'
|
||||
pull_request:
|
||||
branches:
|
||||
- '6.2'
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
name: Hibernate ORM build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '6.2'
|
||||
pull_request:
|
||||
branches:
|
||||
- '6.2'
|
||||
|
|
|
@ -63,6 +63,12 @@ if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) {
|
|||
currentBuild.result = 'NOT_BUILT'
|
||||
return
|
||||
}
|
||||
// This is a limited maintenance branch, so don't run this on pushes to the branch, only on PRs
|
||||
if ( !env.CHANGE_ID ) {
|
||||
print "INFO: Build skipped because this job should only run for pull request, not for branch pushes"
|
||||
currentBuild.result = 'NOT_BUILT'
|
||||
return
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
Map<String, Closure> executions = [:]
|
||||
|
|
|
@ -6,6 +6,12 @@ if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) {
|
|||
currentBuild.result = 'NOT_BUILT'
|
||||
return
|
||||
}
|
||||
// This is a limited maintenance branch, so don't run this on pushes to the branch, only on PRs
|
||||
if ( !env.CHANGE_ID ) {
|
||||
print "INFO: Build skipped because this job should only run for pull request, not for branch pushes"
|
||||
currentBuild.result = 'NOT_BUILT'
|
||||
return
|
||||
}
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
|
|
|
@ -6,6 +6,12 @@ if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) {
|
|||
currentBuild.result = 'NOT_BUILT'
|
||||
return
|
||||
}
|
||||
// This is a limited maintenance branch, so don't run this on pushes to the branch, only on PRs
|
||||
if ( !env.CHANGE_ID ) {
|
||||
print "INFO: Build skipped because this job should only run for pull request, not for branch pushes"
|
||||
currentBuild.result = 'NOT_BUILT'
|
||||
return
|
||||
}
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* See https://github.com/hibernate/hibernate-jenkins-pipeline-helpers
|
||||
*/
|
||||
@Library('hibernate-jenkins-pipeline-helpers@1.5') _
|
||||
|
||||
// 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 'Fedora'
|
||||
}
|
||||
tools {
|
||||
jdk 'OpenJDK 11 Latest'
|
||||
}
|
||||
options {
|
||||
rateLimitBuilds(throttle: [count: 1, durationName: 'hour', userBoost: true])
|
||||
buildDiscarder(logRotator(numToKeepStr: '3', artifactNumToKeepStr: '3'))
|
||||
disableConcurrentBuilds(abortPrevious: true)
|
||||
}
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
stage('Publish') {
|
||||
steps {
|
||||
withCredentials([
|
||||
usernamePassword(credentialsId: 'ossrh.sonatype.org', usernameVariable: 'hibernatePublishUsername', passwordVariable: 'hibernatePublishPassword'),
|
||||
usernamePassword(credentialsId: 'plugins.gradle.org', usernameVariable: 'hibernatePluginPortalUsername', passwordVariable: 'hibernatePluginPortalPassword'),
|
||||
string(credentialsId: 'ge.hibernate.org-access-key', variable: 'GRADLE_ENTERPRISE_ACCESS_KEY'),
|
||||
string(credentialsId: 'release.gpg.passphrase', variable: 'SIGNING_PASS'),
|
||||
file(credentialsId: 'release.gpg.private-key', variable: 'SIGNING_KEYRING')
|
||||
]) {
|
||||
sh '''./gradlew clean publish \
|
||||
-PhibernatePublishUsername=$hibernatePublishUsername \
|
||||
-PhibernatePublishPassword=$hibernatePublishPassword \
|
||||
-Pgradle.publish.key=$hibernatePluginPortalUsername \
|
||||
-Pgradle.publish.secret=$hibernatePluginPortalPassword \
|
||||
--no-scan \
|
||||
-DsigningPassword=$SIGNING_PASS \
|
||||
-DsigningKeyFile=$SIGNING_KEYRING \
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
configFileProvider([configFile(fileId: 'job-configuration.yaml', variable: 'JOB_CONFIGURATION_FILE')]) {
|
||||
notifyBuildResult maintainers: (String) readYaml(file: env.JOB_CONFIGURATION_FILE).notification?.email?.recipients
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue