-
Notifications
You must be signed in to change notification settings - Fork 5k
ci: add apm beats update pipeline multibranch job #15631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kuisathaverat
merged 6 commits into
elastic:master
from
kuisathaverat:apma-servert-beats-update
Jan 23, 2020
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b41b60e
ci: add apm beats update pipeline multibranch job
kuisathaverat 41da564
fix: force execution on comment trigger
kuisathaverat 8500780
Update .ci/apm-beats-update.groovy
kuisathaverat 606e13a
Update .ci/apm-beats-update.groovy
kuisathaverat dfc8c21
Update .ci/apm-beats-update.groovy
kuisathaverat daa7dd1
Delete apm-server-update-beats.sh
kuisathaverat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| #!/usr/bin/env groovy | ||
| @Library('apm@current') _ | ||
|
|
||
| pipeline { | ||
| agent { label 'linux && immutable' } | ||
| environment { | ||
| REPO = 'apm-server' | ||
| BASE_DIR = "src/github.com/elastic/${env.REPO}" | ||
| NOTIFY_TO = credentials('notify-to') | ||
| GITHUB_CHECK_ITS_NAME = 'APM Server Beats update' | ||
| PATH = "${env.PATH}:${env.WORKSPACE}/bin" | ||
| HOME = "${env.WORKSPACE}" | ||
| GOPATH = "${env.WORKSPACE}" | ||
| } | ||
| options { | ||
| timeout(time: 2, unit: 'HOURS') | ||
| buildDiscarder(logRotator(numToKeepStr: '100', artifactNumToKeepStr: '30', daysToKeepStr: '30')) | ||
| timestamps() | ||
| ansiColor('xterm') | ||
| disableResume() | ||
| durabilityHint('PERFORMANCE_OPTIMIZED') | ||
| rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true]) | ||
| quietPeriod(10) | ||
| } | ||
| triggers { | ||
| issueCommentTrigger('(?i).*/run\\s+(?:apm-beats-update\\W+)?.*') | ||
| } | ||
| stages { | ||
| /** | ||
| Checkout the code and stash it, to use it on other stages. | ||
| */ | ||
| stage('Checkout') { | ||
| options { skipDefaultCheckout() } | ||
| steps { | ||
| deleteDir() | ||
| gitCheckout(basedir: "beats") | ||
| script { | ||
| dir("beats"){ | ||
| 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() } | ||
| 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') { | ||
| deleteDir() | ||
| gitCheckout(basedir: "${BASE_DIR}", | ||
| repo: "git@github.com:elastic/${REPO}.git", | ||
| branch: 'master', | ||
| credentialsId: 'credentials-id', | ||
| githubNotifyFirstTimeContributor: false, | ||
| depth: 1, | ||
| reference: "/var/lib/jenkins/.git-references/${REPO}.git" | ||
| ) | ||
| dir("${BASE_DIR}"){ | ||
| sh(label: 'Update Beats script', script: """ | ||
| export BEATS_VERSION=${env.GIT_BASE_COMMIT} | ||
| git config --global --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*" | ||
| script/jenkins/update-beats.sh | ||
| """) | ||
| } | ||
|
kuisathaverat marked this conversation as resolved.
|
||
| } | ||
| } | ||
| post { | ||
| always { | ||
| catchError(buildResult: 'SUCCESS', message: 'Failed to grab test results tar files', stageResult: 'SUCCESS') { | ||
| tar(file: "update-beats-system-tests-linux-files.tgz", archive: true, dir: "system-tests", pathPrefix: "${BASE_DIR}/build") | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| post { | ||
| cleanup { | ||
| notifyBuildResult() | ||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.