Add Cron Trigger to Pipeline
Some checks failed
andreas-personal/AndysAdguardHomeBlockList/pipeline/head There was a failure building this commit
Some checks failed
andreas-personal/AndysAdguardHomeBlockList/pipeline/head There was a failure building this commit
This commit is contained in:
parent
1b1264fcad
commit
b0a5af4cf1
9
Jenkinsfile
vendored
9
Jenkinsfile
vendored
@ -4,6 +4,9 @@ pipeline {
|
||||
agent {
|
||||
label 'linux'
|
||||
}
|
||||
triggers {
|
||||
cron('H 0 12,0 * * *')
|
||||
}
|
||||
stages {
|
||||
stage('Checkout') {
|
||||
when {
|
||||
@ -21,8 +24,10 @@ pipeline {
|
||||
}
|
||||
steps {
|
||||
script {
|
||||
// Replace 'Jenkins' with the name Jenkins uses to commit
|
||||
if (sh(script: 'git log -1 --pretty=format:"%an"', returnStdout: true).trim() == 'Jenkins') {
|
||||
def causedByScmEvent = currentBuild.rawBuild.getCause(hudson.triggers.SCMTrigger.SCMTriggerCause)
|
||||
if (causedByScmEvent == null) {
|
||||
echo 'Not triggered by SCM, continuing build'
|
||||
} else if (sh(script: 'git log -1 --pretty=format:"%an"', returnStdout: true).trim() == 'Jenkins') {
|
||||
currentBuild.result = 'ABORTED'
|
||||
error('Last commit was by Jenkins, skipping build')
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user