Skip to content

Commit 7b16811

Browse files
authored
Merge pull request #4 from elastic/feature/pipeline-bayeux-master_2022_04_05-11_47_51
[pipeline] bayeux
2 parents b36927c + 2de221a commit 7b16811

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

.ci/Jenkinsfile

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/usr/bin/env groovy
2+
3+
@Library('apm@current') _
4+
5+
pipeline {
6+
agent { label 'ubuntu-20.04 && immutable' }
7+
environment {
8+
REPO = "bayeux"
9+
BASE_DIR = "src/github.com/elastic/${env.REPO}"
10+
JOB_GIT_CREDENTIALS = "f6c7695a-671e-4f4f-a331-acdce44ff9ba"
11+
PIPELINE_LOG_LEVEL = 'INFO'
12+
}
13+
options {
14+
timeout(time: 1, unit: 'HOURS')
15+
buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20', daysToKeepStr: '30'))
16+
timestamps()
17+
ansiColor('xterm')
18+
disableResume()
19+
durabilityHint('PERFORMANCE_OPTIMIZED')
20+
rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true])
21+
quietPeriod(10)
22+
}
23+
triggers {
24+
issueCommentTrigger("${obltGitHubComments()}")
25+
}
26+
stages {
27+
stage('Checkout') {
28+
steps {
29+
pipelineManager([ cancelPreviousRunningBuilds: [ when: 'PR' ] ])
30+
deleteDir()
31+
gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true)
32+
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
33+
}
34+
}
35+
stage('Lint'){
36+
steps {
37+
withGithubNotify(context: "Lint") {
38+
dir("${BASE_DIR}"){
39+
withGoEnv(){
40+
sh(label: 'lint', script: '''
41+
go mod tidy && git diff --exit-code
42+
gofmt -l . | read && echo "Code differs from gofmt's style. Run 'gofmt -w .'" 1>&2 && exit 1 || true
43+
''')
44+
sh(label: 'Go vet', script: 'go vet')
45+
}
46+
}
47+
}
48+
}
49+
}
50+
stage('build'){
51+
steps {
52+
withGithubNotify(context: "Build") {
53+
deleteDir()
54+
unstash 'source'
55+
dir("${BASE_DIR}"){
56+
withGoEnv(){
57+
cmd(label: 'Go build', script: 'go build')
58+
}
59+
}
60+
}
61+
}
62+
}
63+
stage('Test') {
64+
steps {
65+
withGithubNotify(context: "Test") {
66+
deleteDir()
67+
unstash 'source'
68+
dir("${BASE_DIR}"){
69+
withGoEnv(){
70+
goTestJUnit(options: '-v ./...', output: 'junit-report.xml')
71+
}
72+
}
73+
}
74+
}
75+
post {
76+
always {
77+
junit(allowEmptyResults: true, keepLongStdio: true, testResults: '**/junit-report.xml')
78+
}
79+
}
80+
}
81+
}
82+
post {
83+
cleanup {
84+
notifyBuildResult(prComment: true)
85+
}
86+
}
87+
}

.go-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.17.8

0 commit comments

Comments
 (0)