Skip to content

Commit

Permalink
ci: apm-server-update trigered only on upstream, comments, and manual…
Browse files Browse the repository at this point in the history
… triggered (elastic#19590)
  • Loading branch information
kuisathaverat authored and melchiormoulin committed Oct 14, 2020
1 parent 2f493e2 commit 11f8e66
Showing 1 changed file with 51 additions and 47 deletions.
98 changes: 51 additions & 47 deletions .ci/apm-beats-update.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@Library('apm@current') _

pipeline {
agent { label 'linux && immutable' }
agent none
environment {
REPO = 'apm-server'
BASE_DIR = "src/github.com/elastic/${env.REPO}"
Expand All @@ -27,63 +27,67 @@ pipeline {
}
triggers {
issueCommentTrigger('(?i).*/run\\s+(?:apm-beats-update\\W+)?.*')
upstream("Beats/beats-beats-mbp/${ env.JOB_BASE_NAME.startsWith('PR-') ? 'none' : env.JOB_BASE_NAME }")
}
stages {
/**
Checkout the code and stash it, to use it on other stages.
*/
stage('Checkout') {
options { skipDefaultCheckout() }
steps {
deleteDir()
gitCheckout(basedir: "${BEATS_DIR}", githubNotifyFirstTimeContributor: false)
script {
dir("${BEATS_DIR}"){
env.GO_VERSION = readFile(".go-version").trim()
def regexps =[
"^devtools/mage.*",
"^libbeat/scripts/Makefile",
]
env.BEATS_UPDATED = isGitRegionMatch(patterns: regexps)
// Skip all the stages except docs for PR's with asciidoc changes only
env.ONLY_DOCS = isGitRegionMatch(patterns: [ '.*\\.asciidoc' ], comparator: 'regexp', shouldMatchAll: true)
}
}
}
}
/**
updates beats updates the framework part and go parts of beats.
Then build and test.
Finally archive the results.
*/
stage('Update Beats') {
options { skipDefaultCheckout() }
stage('Filter build') {
agent { label 'ubuntu && immutable' }
when {
beforeAgent true
anyOf {
branch 'master'
branch "\\d+\\.\\d+"
branch "v\\d?"
tag "v\\d+\\.\\d+\\.\\d+*"
allOf {
expression { return env.BEATS_UPDATED != "false" || isCommentTrigger() }
changeRequest()
expression {
return isCommentTrigger() || isUserTrigger()
}
}
/**
Checkout the code and stash it, to use it on other stages.
*/
stage('Checkout') {
steps {
deleteDir()
gitCheckout(basedir: "${BEATS_DIR}", githubNotifyFirstTimeContributor: false)
script {
dir("${BEATS_DIR}"){
env.GO_VERSION = readFile(".go-version").trim()
def regexps =[
"^devtools/mage.*",
"^libbeat/scripts/Makefile",
]
env.BEATS_UPDATED = isGitRegionMatch(patterns: regexps)
// Skip all the stages except docs for PR's with asciidoc changes only
env.ONLY_DOCS = isGitRegionMatch(patterns: [ '.*\\.asciidoc' ], comparator: 'regexp', shouldMatchAll: true)
}
}

}
}
steps {
withGithubNotify(context: 'Check Apm Server Beats Update') {
beatsUpdate()
/**
updates beats updates the framework part and go parts of beats.
Then build and test.
Finally archive the results.
*/
stage('Update Beats') {
options { skipDefaultCheckout() }
when {
beforeAgent true
anyOf {
branch 'master'
branch "\\d+\\.\\d+"
branch "v\\d?"
tag "v\\d+\\.\\d+\\.\\d+*"
allOf {
expression { return env.BEATS_UPDATED != "false" || isCommentTrigger() }
changeRequest()
}

}
}
steps {
withGithubNotify(context: 'Check Apm Server Beats Update') {
beatsUpdate()
}
}
}
}
}
// post {
// cleanup {
// notifyBuildResult()
// }
// }
}

def beatsUpdate() {
Expand Down

0 comments on commit 11f8e66

Please sign in to comment.