-
Notifications
You must be signed in to change notification settings - Fork 207
[Jenkins] Go Agent Pipeline version 0 #292
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
Merged
Changes from 48 commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
44c5803
pipeline version 0
kuisathaverat 17396ee
Merge branch 'master' of github.com:elastic/apm-agent-go into pipeline
kuisathaverat 26e3b41
Update Jenkinsfile
axw 0c77133
Update Jenkinsfile
axw ece290f
Update Jenkinsfile
axw 4023751
Update scripts/jenkins/docker-test.sh
axw ba1a532
order dependencies
kuisathaverat c588d82
some test changes
kuisathaverat 7fc5752
Update scripts/jenkins/test.sh
axw c211729
adjustments in tests
kuisathaverat a31786f
disable integration test, and remove tags creation
kuisathaverat 67e94a9
use immutable nodes
kuisathaverat fc40307
use runbld
kuisathaverat 3aac405
check and install go
kuisathaverat a08ceca
check and install go
kuisathaverat b312193
do not forget to set permissions
kuisathaverat 99e31fd
set the GO version
kuisathaverat d34a3e0
set the GO version as parameter
kuisathaverat b14d3e2
import goimports
kuisathaverat 556e499
import goint
kuisathaverat 09955f9
typo
kuisathaverat 77d6af0
Merge branch 'master' of github.com:elastic/apm-agent-go into pipeline
kuisathaverat 83adaec
merge master changes
kuisathaverat 06ca118
exit 0 on bench.sh
kuisathaverat 99f5628
testing bench.sh
kuisathaverat 397ffa5
testing bench.sh
kuisathaverat 8f5e104
no report library changes, useless variables
kuisathaverat 4b3615f
disable ansiColor, test should return 0 as exit code
kuisathaverat e0d7b31
stash .git folder
kuisathaverat 79316bb
test
kuisathaverat b482928
test
kuisathaverat f2b6139
test
kuisathaverat 27d5dc0
test
kuisathaverat 687823b
test
kuisathaverat 9179ac2
test
kuisathaverat f3de2b9
test
kuisathaverat 41c9055
test
kuisathaverat ecb46b8
test
kuisathaverat e4de08d
test
kuisathaverat df54a97
Merge branch 'master' of github.com:elastic/apm-agent-go into pipeline
kuisathaverat ebd794a
typo
kuisathaverat fe1b3e6
suggested changes
kuisathaverat 84fdbb2
Merge branch 'master' of github.com:elastic/apm-agent-go into pipeline
kuisathaverat 5f46c49
move test stage
kuisathaverat 59372f4
remove old style github integration, we will use pipeline multibranch…
kuisathaverat d53b105
remove covertura on test stage, add trick to see the full logs in col…
kuisathaverat d099649
remove cobertura from the test script
kuisathaverat bbdaa72
simplify script
kuisathaverat eaf0aa1
improvements
kuisathaverat 690be06
Merge branch 'master' of github.com:elastic/apm-agent-go into pipeline
kuisathaverat 04921d8
run it only on PRs
kuisathaverat a6506bc
add skipDefaultCheckout
kuisathaverat f35e324
codecov changes
kuisathaverat 06f339b
Merge branch 'master' of github.com:elastic/apm-agent-go into pipeline
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,336 @@ | ||
| #!/usr/bin/env groovy | ||
|
|
||
| library identifier: 'apm@master', | ||
| changelog: false, | ||
| retriever: modernSCM( | ||
| [$class: 'GitSCMSource', | ||
| credentialsId: 'f6c7695a-671e-4f4f-a331-acdce44ff9ba', | ||
| remote: 'git@github.com:elastic/apm-pipeline-library.git']) | ||
|
|
||
| pipeline { | ||
| agent any | ||
| environment { | ||
| HOME = "${env.HUDSON_HOME}" | ||
| BASE_DIR="src/go.elastic.co/apm" | ||
| JOB_GIT_CREDENTIALS = "f6c7695a-671e-4f4f-a331-acdce44ff9ba" | ||
| } | ||
| triggers { | ||
| cron('0 0 * * 1-5') | ||
| } | ||
| options { | ||
| timeout(time: 1, unit: 'HOURS') | ||
| buildDiscarder(logRotator(numToKeepStr: '3', artifactNumToKeepStr: '2', daysToKeepStr: '30')) | ||
| timestamps() | ||
| preserveStashes() | ||
| //ansiColor('xterm') | ||
| disableResume() | ||
| durabilityHint('PERFORMANCE_OPTIMIZED') | ||
| } | ||
| parameters { | ||
| string(name: 'branch_specifier', defaultValue: "", description: "the Git branch specifier to build (<branchName>, <tagName>, <commitId>, etc.)") | ||
| string(name: 'GO_VERSION', defaultValue: "1.10.3", description: "Go version to use.") | ||
| booleanParam(name: 'linux_ci', defaultValue: true, description: 'Enable Linux build') | ||
| booleanParam(name: 'test_ci', defaultValue: true, description: 'Enable test') | ||
| booleanParam(name: 'integration_test_ci', defaultValue: true, description: 'Enable run integration test') | ||
| booleanParam(name: 'integration_test_pr_ci', defaultValue: false, description: 'Enable run integration test') | ||
| booleanParam(name: 'integration_test_master_ci', defaultValue: false, description: 'Enable run integration test') | ||
| booleanParam(name: 'bench_ci', defaultValue: true, description: 'Enable benchmarks') | ||
| booleanParam(name: 'doc_ci', defaultValue: true, description: 'Enable build documentation') | ||
| } | ||
|
|
||
| stages { | ||
| /** | ||
| Checkout the code and stash it, to use it on other stages. | ||
| */ | ||
| stage('Checkout') { | ||
| agent { label 'master || linux' } | ||
| environment { | ||
| PATH = "${env.PATH}:${env.HUDSON_HOME}/go/bin/:${env.WORKSPACE}/bin" | ||
| GOPATH = "${env.WORKSPACE}" | ||
| } | ||
| steps { | ||
| withEnvWrapper() { | ||
| dir("${BASE_DIR}"){ | ||
| script{ | ||
| if(!env?.branch_specifier){ | ||
| echo "Checkout SCM" | ||
| checkout scm | ||
| } else { | ||
| echo "Checkout ${branch_specifier}" | ||
| checkout([$class: 'GitSCM', branches: [[name: "${branch_specifier}"]], | ||
| doGenerateSubmoduleConfigurations: false, | ||
| extensions: [], | ||
| submoduleCfg: [], | ||
| userRemoteConfigs: [[credentialsId: "${JOB_GIT_CREDENTIALS}", | ||
| url: "${GIT_URL}"]]]) | ||
| } | ||
| env.JOB_GIT_COMMIT = getGitCommitSha() | ||
| env.JOB_GIT_URL = "${GIT_URL}" | ||
|
|
||
| github_enterprise_constructor() | ||
axw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| on_change{ | ||
| echo "build cause a change (commit or PR)" | ||
axw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| on_commit { | ||
| echo "build cause a commit" | ||
| } | ||
|
|
||
| on_merge { | ||
| echo "build cause a merge" | ||
| } | ||
|
|
||
| on_pull_request { | ||
| echo "build cause PR" | ||
| } | ||
| } | ||
| } | ||
| stash allowEmpty: true, name: 'source', useDefaultExcludes: false | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| Build on a linux environment. | ||
| */ | ||
| stage('build') { | ||
| agent { label 'linux && immutable' } | ||
| environment { | ||
| PATH = "${env.PATH}:${env.HUDSON_HOME}/go/bin/:${env.WORKSPACE}/bin" | ||
| GOPATH = "${env.WORKSPACE}" | ||
| } | ||
|
|
||
| when { | ||
| beforeAgent true | ||
| environment name: 'linux_ci', value: 'true' | ||
| } | ||
| steps { | ||
| withEnvWrapper() { | ||
| unstash 'source' | ||
| dir("${BASE_DIR}"){ | ||
| sh """#!/bin/bash | ||
| ./scripts/jenkins/build.sh | ||
| """ | ||
| } | ||
| } | ||
| } | ||
| } | ||
| stage('test') { | ||
| agent { label 'linux && immutable' } | ||
| environment { | ||
| PATH = "${env.PATH}:${env.HUDSON_HOME}/go/bin/:${env.WORKSPACE}/bin" | ||
| GOPATH = "${env.WORKSPACE}" | ||
| } | ||
|
|
||
| when { | ||
| beforeAgent true | ||
| environment name: 'test_ci', value: 'true' | ||
| } | ||
| steps { | ||
| withEnvWrapper() { | ||
| unstash 'source' | ||
| dir("${BASE_DIR}"){ | ||
| sh """#!/bin/bash | ||
| ./scripts/jenkins/test.sh | ||
| """ | ||
| } | ||
| } | ||
| } | ||
| post { | ||
| always { | ||
| junit(allowEmptyResults: true, | ||
| keepLongStdio: true, | ||
| testResults: "${BASE_DIR}/build/junit-*.xml") | ||
| } | ||
| } | ||
| } | ||
| stage('Parallel stages') { | ||
| failFast true | ||
| parallel { | ||
| stage('Benchmarks') { | ||
| agent { label 'linux && immutable' } | ||
| environment { | ||
| PATH = "${env.PATH}:${env.HUDSON_HOME}/go/bin/:${env.WORKSPACE}/bin" | ||
| GOPATH = "${env.WORKSPACE}" | ||
| } | ||
|
|
||
| when { | ||
| beforeAgent true | ||
| allOf { | ||
| branch 'master'; | ||
| environment name: 'bench_ci', value: 'true' | ||
| } | ||
| } | ||
| steps { | ||
| withEnvWrapper() { | ||
| unstash 'source' | ||
| dir("${BASE_DIR}"){ | ||
| sh """#!/bin/bash | ||
| ./scripts/jenkins/bench.sh | ||
| """ | ||
| sendBenchmarks(file: 'build/bench.out', index: "benchmark-go") | ||
axw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
| } | ||
| post { | ||
| always { | ||
| junit(allowEmptyResults: true, | ||
| keepLongStdio: true, | ||
| testResults: "${BASE_DIR}/build/junit-*.xml") | ||
| } | ||
| } | ||
| } | ||
| stage('Docker tests') { | ||
| agent { label 'linux && docker && immutable' } | ||
| environment { | ||
| PATH = "${env.PATH}:${env.HUDSON_HOME}/go/bin/:${env.WORKSPACE}/bin" | ||
| GOPATH = "${env.WORKSPACE}" | ||
| } | ||
|
|
||
| when { | ||
axw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| beforeAgent true | ||
| environment name: 'integration_test_ci', value: 'true' | ||
| } | ||
| steps { | ||
| withEnvWrapper() { | ||
| unstash 'source' | ||
| dir("${BASE_DIR}"){ | ||
| sh """#!/bin/bash | ||
| ./scripts/jenkins/docker-test.sh | ||
| """ | ||
| codecov('apm-agent-go') | ||
| } | ||
| } | ||
| } | ||
| post { | ||
| always { | ||
| coverageReport("${BASE_DIR}/build/coverage") | ||
| junit(allowEmptyResults: true, | ||
| keepLongStdio: true, | ||
| testResults: "${BASE_DIR}/build/junit-*.xml") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| run Go integration test with the commit version on master branch. | ||
| */ | ||
| stage('Integration test master') { | ||
| agent { label 'linux && immutable' } | ||
| when { | ||
| beforeAgent true | ||
| allOf { | ||
| branch 'master'; | ||
| environment name: 'integration_test_master_ci', value: 'true' | ||
| } | ||
| } | ||
| steps { | ||
axw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| build( | ||
| job: 'apm-server-ci/apm-integration-test-axis-pipeline', | ||
| parameters: [ | ||
| string(name: 'BUILD_DESCRIPTION', value: "${BUILD_TAG}-INTEST"), | ||
| booleanParam(name: "go_Test", value: true), | ||
| booleanParam(name: "java_Test", value: false), | ||
| booleanParam(name: "ruby_Test", value: false), | ||
| booleanParam(name: "python_Test", value: false), | ||
| booleanParam(name: "nodejs_Test", value: false)], | ||
| wait: true, | ||
| propagate: true) | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| run Go integration test with the commit version on a PR. | ||
| */ | ||
| stage('Integration test PR') { | ||
| agent { label 'linux && immutable' } | ||
| when { | ||
| beforeAgent true | ||
| allOf { | ||
| not { branch 'master' }; | ||
| environment name: 'integration_test_pr_ci', value: 'true' | ||
| } | ||
| } | ||
| steps { | ||
| build( | ||
| job: 'apm-server-ci/apm-integration-test-pipeline', | ||
| parameters: [ | ||
| string(name: 'BUILD_DESCRIPTION', value: "${BUILD_TAG}-INTEST"), | ||
| string(name: 'APM_AGENT_GO_PKG', value: "${BUILD_TAG}"), | ||
axw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| booleanParam(name: "go_Test", value: true), | ||
| booleanParam(name: "java_Test", value: false), | ||
| booleanParam(name: "ruby_Test", value: false), | ||
| booleanParam(name: "python_Test", value: false), | ||
| booleanParam(name: "nodejs_Test", value: false), | ||
| booleanParam(name: "kibana_Test", value: false), | ||
| booleanParam(name: "server_Test", value: false)], | ||
| wait: true, | ||
| propagate: true) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Documentation') { | ||
| agent { label 'linux && immutable' } | ||
| environment { | ||
| PATH = "${env.PATH}:${env.HUDSON_HOME}/go/bin/:${env.WORKSPACE}/bin" | ||
| GOPATH = "${env.WORKSPACE}" | ||
| ELASTIC_DOCS = "${env.WORKSPACE}/elastic/docs" | ||
| } | ||
|
|
||
| when { | ||
| beforeAgent true | ||
| allOf { | ||
| branch 'master'; | ||
| environment name: 'doc_ci', value: 'true' | ||
| } | ||
| } | ||
| steps { | ||
| withEnvWrapper() { | ||
| unstash 'source' | ||
| dir("${ELASTIC_DOCS}"){ | ||
| git "https://github.com/elastic/docs.git" | ||
| } | ||
| dir("${BASE_DIR}"){ | ||
| sh """#!/bin/bash | ||
| make docs | ||
| """ | ||
| } | ||
| } | ||
| } | ||
| post{ | ||
| success { | ||
| tar(file: "doc-files.tgz", archive: true, dir: "html", pathPrefix: "${BASE_DIR}/docs") | ||
| } | ||
| } | ||
| } | ||
| stage('Full log') { | ||
| when { | ||
| environment name: 'Never', value: 'true' | ||
| } | ||
| steps { | ||
| echo "NOOP" | ||
| } | ||
| } | ||
| } | ||
| post { | ||
| always { | ||
| echo 'Post Actions' | ||
| } | ||
| success { | ||
| echo 'Success Post Actions' | ||
| } | ||
| aborted { | ||
| echo 'Aborted Post Actions' | ||
| } | ||
| failure { | ||
| echo 'Failure Post Actions' | ||
| //step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${NOTIFY_TO}", sendToIndividuals: false]) | ||
| } | ||
| unstable { | ||
| echo 'Unstable Post Actions' | ||
| } | ||
| } | ||
| } | ||
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
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,16 @@ | ||
| #!/usr/bin/env bash | ||
| set -euxo pipefail | ||
|
|
||
| srcdir=`dirname $0` | ||
| test -z "$srcdir" && srcdir=. | ||
| . ${srcdir}/common.bash | ||
|
|
||
| jenkins_setup | ||
|
|
||
| go get -v -u github.com/jstemmer/go-junit-report | ||
| go get -v -t ./... | ||
|
|
||
| export OUT_FILE="build/bench.out" | ||
| mkdir -p build | ||
| go test -run=NONE -benchmem -bench=. ./... -v 2>&1 | tee ${OUT_FILE} | ||
| cat ${OUT_FILE} | go-junit-report > build/junit-apm-agent-go-bench.xml |
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,13 @@ | ||
| #!/usr/bin/env bash | ||
| set -euxo pipefail | ||
|
|
||
| srcdir=`dirname $0` | ||
| test -z "$srcdir" && srcdir=. | ||
| . ${srcdir}/common.bash | ||
|
|
||
| jenkins_setup | ||
|
|
||
| go get -u -v golang.org/x/tools/cmd/goimports | ||
| go get -u -v golang.org/x/lint/golint | ||
|
|
||
| make install precheck |
Oops, something went wrong.
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.