Skip to content

Commit

Permalink
CI: enable nightly jobs for the Macos on a weekly basis and support f…
Browse files Browse the repository at this point in the history
…or the latest release branch (#28432)
  • Loading branch information
v1v committed Oct 14, 2021
1 parent 568fd05 commit 57bf866
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 4 deletions.
27 changes: 27 additions & 0 deletions .ci/jobs/beats-schedule-daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
- job:
name: beats-schedule-daily
display-name: Jobs scheduled daily (weekdays)
description: Jobs scheduled daily (weekdays)
view: Beats
project-type: pipeline
parameters:
- string:
name: branch_specifier
default: master
description: the Git branch specifier to build
pipeline-scm:
script-path: .ci/schedule-daily.groovy
scm:
- git:
url: git@github.com:elastic/beats.git
refspec: +refs/heads/*:refs/remotes/origin/*
wipe-workspace: 'True'
name: origin
shallow-clone: true
credentials-id: f6c7695a-671e-4f4f-a331-acdce44ff9ba
reference-repo: /var/lib/jenkins/.git-references/beats.git
branches:
- $branch_specifier
triggers:
- timed: 'H H(2-3) * * 1-5'
2 changes: 1 addition & 1 deletion .ci/jobs/beats-schedule-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
branches:
- $branch_specifier
triggers:
- timed: 'H H(1-4) * * 0'
- timed: 'H H(1-2) * * 0'
43 changes: 43 additions & 0 deletions .ci/schedule-daily.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@Library('apm@current') _

pipeline {
agent none
environment {
NOTIFY_TO = credentials('notify-to')
PIPELINE_LOG_LEVEL = 'INFO'
}
options {
timeout(time: 1, unit: 'HOURS')
buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20'))
timestamps()
ansiColor('xterm')
disableResume()
durabilityHint('PERFORMANCE_OPTIMIZED')
}
triggers {
cron('H H(2-3) * * 1-5')
}
stages {
stage('Nighly beats builds') {
steps {
runBuild(quietPeriod: 0, job: 'Beats/beats/master')
runBuild(quietPeriod: 2000, job: 'Beats/beats/7.x')
runBuild(quietPeriod: 4000, job: 'Beats/beats/7.<minor>')
}
}
}
post {
cleanup {
notifyBuildResult(prComment: false)
}
}
}

def runBuild(Map args = [:]) {
def jobName = args.job
if (jobName.contains('7.<minor>')) {
def parts = stackVersions.release().split('\\.')
jobName = args.job.replaceAll('<minor>', parts[1])
}
build(quietPeriod: args.quietPeriod, job: jobName, parameters: [booleanParam(name: 'macosTest', value: true)], wait: false, propagate: false)
}
17 changes: 14 additions & 3 deletions .ci/schedule-weekly.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ pipeline {
durabilityHint('PERFORMANCE_OPTIMIZED')
}
triggers {
cron('H H(1-4) * * 0')
cron('H H(1-2) * * 0')
}
stages {
stage('Nighly beats builds') {
steps {
build(quietPeriod: 0, job: 'Beats/beats/master', parameters: [booleanParam(name: 'awsCloudTests', value: true), booleanParam(name: 'macosTest', value: true)], wait: false, propagate: false)
build(quietPeriod: 1000, job: 'Beats/beats/7.x', parameters: [booleanParam(name: 'awsCloudTests', value: true), booleanParam(name: 'macosTest', value: true)], wait: false, propagate: false)
runBuild(quietPeriod: 0, job: 'Beats/beats/master')
runBuild(quietPeriod: 1000, job: 'Beats/beats/7.x')
// <minor> is an alias to be replaced with the latest release branch
runBuild(quietPeriod: 2000, job: 'Beats/beats/7.<minor>')
}
}
}
Expand All @@ -31,3 +33,12 @@ pipeline {
}
}
}

def runBuild(Map args = [:]) {
def jobName = args.job
if (jobName.contains('7.<minor>')) {
def parts = stackVersions.release().split('\\.')
jobName = args.job.replaceAll('<minor>', parts[1])
}
build(quietPeriod: args.quietPeriod, job: jobName, parameters: [booleanParam(name: 'awsCloudTests', value: true)], wait: false, propagate: false)
}

0 comments on commit 57bf866

Please sign in to comment.