Skip to content
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
44c5803
pipeline version 0
kuisathaverat Oct 29, 2018
17396ee
Merge branch 'master' of github.com:elastic/apm-agent-go into pipeline
kuisathaverat Oct 29, 2018
26e3b41
Update Jenkinsfile
axw Oct 30, 2018
0c77133
Update Jenkinsfile
axw Oct 30, 2018
ece290f
Update Jenkinsfile
axw Oct 30, 2018
4023751
Update scripts/jenkins/docker-test.sh
axw Oct 30, 2018
ba1a532
order dependencies
kuisathaverat Oct 30, 2018
c588d82
some test changes
kuisathaverat Oct 31, 2018
7fc5752
Update scripts/jenkins/test.sh
axw Oct 31, 2018
c211729
adjustments in tests
kuisathaverat Oct 31, 2018
a31786f
disable integration test, and remove tags creation
kuisathaverat Nov 3, 2018
67e94a9
use immutable nodes
kuisathaverat Nov 5, 2018
fc40307
use runbld
kuisathaverat Nov 5, 2018
3aac405
check and install go
kuisathaverat Nov 5, 2018
a08ceca
check and install go
kuisathaverat Nov 5, 2018
b312193
do not forget to set permissions
kuisathaverat Nov 5, 2018
99e31fd
set the GO version
kuisathaverat Nov 5, 2018
d34a3e0
set the GO version as parameter
kuisathaverat Nov 5, 2018
b14d3e2
import goimports
kuisathaverat Nov 5, 2018
556e499
import goint
kuisathaverat Nov 5, 2018
09955f9
typo
kuisathaverat Nov 5, 2018
77d6af0
Merge branch 'master' of github.com:elastic/apm-agent-go into pipeline
kuisathaverat Nov 5, 2018
83adaec
merge master changes
kuisathaverat Nov 5, 2018
06ca118
exit 0 on bench.sh
kuisathaverat Nov 5, 2018
99f5628
testing bench.sh
kuisathaverat Nov 5, 2018
397ffa5
testing bench.sh
kuisathaverat Nov 5, 2018
8f5e104
no report library changes, useless variables
kuisathaverat Nov 6, 2018
4b3615f
disable ansiColor, test should return 0 as exit code
kuisathaverat Nov 6, 2018
e0d7b31
stash .git folder
kuisathaverat Nov 6, 2018
79316bb
test
kuisathaverat Nov 6, 2018
b482928
test
kuisathaverat Nov 6, 2018
f2b6139
test
kuisathaverat Nov 6, 2018
27d5dc0
test
kuisathaverat Nov 6, 2018
687823b
test
kuisathaverat Nov 6, 2018
9179ac2
test
kuisathaverat Nov 6, 2018
f3de2b9
test
kuisathaverat Nov 7, 2018
41c9055
test
kuisathaverat Nov 7, 2018
ecb46b8
test
kuisathaverat Nov 7, 2018
e4de08d
test
kuisathaverat Nov 7, 2018
df54a97
Merge branch 'master' of github.com:elastic/apm-agent-go into pipeline
kuisathaverat Nov 7, 2018
ebd794a
typo
kuisathaverat Nov 7, 2018
fe1b3e6
suggested changes
kuisathaverat Nov 8, 2018
84fdbb2
Merge branch 'master' of github.com:elastic/apm-agent-go into pipeline
kuisathaverat Nov 8, 2018
5f46c49
move test stage
kuisathaverat Nov 8, 2018
59372f4
remove old style github integration, we will use pipeline multibranch…
kuisathaverat Nov 8, 2018
d53b105
remove covertura on test stage, add trick to see the full logs in col…
kuisathaverat Nov 8, 2018
d099649
remove cobertura from the test script
kuisathaverat Nov 8, 2018
bbdaa72
simplify script
kuisathaverat Nov 8, 2018
eaf0aa1
improvements
kuisathaverat Nov 15, 2018
690be06
Merge branch 'master' of github.com:elastic/apm-agent-go into pipeline
kuisathaverat Nov 15, 2018
04921d8
run it only on PRs
kuisathaverat Nov 15, 2018
a6506bc
add skipDefaultCheckout
kuisathaverat Nov 22, 2018
f35e324
codecov changes
kuisathaverat Nov 23, 2018
06f339b
Merge branch 'master' of github.com:elastic/apm-agent-go into pipeline
kuisathaverat Nov 28, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
333 changes: 333 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,333 @@
#!/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')
githubPush()
}
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()

on_change{
echo "build cause a change (commit or PR)"
}

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 {
coverageReport("${BASE_DIR}/build/coverage")
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")
}
}
}
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 {
beforeAgent true
allOf {
//branch 'master';
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 {
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}"),
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")
}
}
}
}
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'
}
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[![Build Status](https://apm-ci.elastic.co/buildStatus/icon?job=apm-agent-go/apm-agent-go-mbp/master)](https://apm-ci.elastic.co/job/apm-agent-go/job/apm-agent-go-mbp/job/master/)
[![GoDoc](https://godoc.org/go.elastic.co/apm?status.svg)](http://godoc.org/go.elastic.co/apm)
[![Travis-CI](https://travis-ci.org/elastic/apm-agent-go.svg)](https://travis-ci.org/elastic/apm-agent-go)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/28fhswvqqc7p90f7?svg=true)](https://ci.appveyor.com/project/AndrewWilkins/apm-agent-go)
Expand Down
16 changes: 16 additions & 0 deletions scripts/jenkins/bench.sh
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
13 changes: 13 additions & 0 deletions scripts/jenkins/build.sh
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
Loading