Skip to content

Commit

Permalink
[packaging][beats-tester] use commit id binaries (elastic#22027)
Browse files Browse the repository at this point in the history
# Conflicts:
#	.ci/packaging.groovy
#	Jenkinsfile
  • Loading branch information
v1v committed Nov 2, 2020
1 parent b82d12b commit ad78b80
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 12 deletions.
30 changes: 21 additions & 9 deletions .ci/beats-tester.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@ pipeline {
options { skipDefaultCheckout() }
when { branch 'master' }
steps {
// TODO: to use the git commit that triggered the upstream build
runBeatsTesterJob(version: "${env.VERSION}-SNAPSHOT")
}
}
stage('Build *.x branch') {
options { skipDefaultCheckout() }
when { branch '*.x' }
steps {
// TODO: to use the git commit that triggered the upstream build
runBeatsTesterJob(version: "${env.VERSION}-SNAPSHOT")
}
}
Expand All @@ -79,7 +77,7 @@ pipeline {
options { skipDefaultCheckout() }
when {
not {
allOf {
anyOf {
branch comparator: 'REGEXP', pattern: '(master|.*x)'
changeRequest()
}
Expand All @@ -96,14 +94,28 @@ pipeline {
}

def runBeatsTesterJob(Map args = [:]) {
if (args.apm && args.beats) {
def apm = args.get('apm', '')
def beats = args.get('beats', '')
def version = args.version

if (isUpstreamTrigger()) {
copyArtifacts(filter: 'beats-tester.properties',
flatten: true,
projectName: "Beats/packaging/${env.JOB_BASE_NAME}",
selector: upstream(fallbackToLastSuccessful: true))
def props = readProperties(file: 'beats-tester.properties')
apm = props.get('APM_URL_BASE', '')
beats = props.get('BEATS_URL_BASE', '')
version = props.get('VERSION', '8.0.0-SNAPSHOT')
}
if (apm?.trim() || beats?.trim()) {
build(job: env.BEATS_TESTER_JOB, propagate: false, wait: false,
parameters: [
string(name: 'APM_URL_BASE', value: args.apm),
string(name: 'BEATS_URL_BASE', value: args.beats),
string(name: 'VERSION', value: args.version)
string(name: 'APM_URL_BASE', value: apm),
string(name: 'BEATS_URL_BASE', value: beats),
string(name: 'VERSION', value: version)
])
} else {
build(job: env.BEATS_TESTER_JOB, propagate: false, wait: false, parameters: [ string(name: 'VERSION', value: args.version) ])
build(job: env.BEATS_TESTER_JOB, propagate: false, wait: false, parameters: [ string(name: 'VERSION', value: version) ])
}
}
}
4 changes: 2 additions & 2 deletions .ci/jobs/beats-tester.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
- job:
name: Beats/beats-tester
display-name: Beats Tester
description: Run the beats-tester
display-name: Beats Tester orchestrator
description: Orchestrate the beats-tester when packaging finished successfully
view: Beats
disabled: false
project-type: multibranch
Expand Down
2 changes: 1 addition & 1 deletion .ci/packaging.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def publishPackages(baseDir){
uploadPackages("${bucketUri}/${beatsFolderName}", baseDir)

// Copy those files to another location with the sha commit to test them
// aftewords.
// afterward.
bucketUri = "gs://${JOB_GCS_BUCKET}/commits/${env.GIT_BASE_COMMIT}"
uploadPackages("${bucketUri}/${beatsFolderName}", baseDir)
}
Expand Down
6 changes: 6 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ pipeline {
}
}
post {
success {
writeFile(file: 'packaging.properties', text: """## To be consumed by the packaging pipeline
COMMIT=${env.GIT_BASE_COMMIT}
VERSION=${env.VERSION}-SNAPSHOT""")
archiveArtifacts artifacts: 'packaging.properties'
}
always {
deleteDir()
unstashV2(name: 'source', bucket: "${JOB_GCS_BUCKET}", credentialsId: "${JOB_GCS_CREDENTIALS}")
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ python-env:
test-apm:
sh ./script/test_apm.sh

## get-version : Get the libbeat version
.PHONY: get-version
get-version:
@mage dumpVariables | grep 'beat_version' | cut -d"=" -f 2 | tr -d " "

### Packaging targets ####

## snapshot : Builds a snapshot release.
Expand Down

0 comments on commit ad78b80

Please sign in to comment.