Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Commit

Permalink
[pipeline] elastic-agent-shipper (#2)
Browse files Browse the repository at this point in the history
* [pipeline] elastic-agent-shipper

* Remove macosx from .ci/Jenkinsfile

macosx is not availble yet in fleet-ci

Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>

* Remove Go version matrix per suggestion.

Co-authored-by: apmmachine <infra-root+apmmachine@elastic.co>
Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co>
Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
  • Loading branch information
4 people authored Apr 4, 2022
1 parent a0f5c1b commit db06963
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 1 deletion.
102 changes: 102 additions & 0 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#!/usr/bin/env groovy

@Library('apm@current') _

pipeline {
agent { label 'ubuntu-20.04 && immutable' }
environment {
REPO = "elastic-agent-shipper"
BASE_DIR = "src/github.com/elastic/${env.REPO}"
JOB_GIT_CREDENTIALS = "f6c7695a-671e-4f4f-a331-acdce44ff9ba"
PIPELINE_LOG_LEVEL = 'INFO'
}
options {
timeout(time: 1, unit: 'HOURS')
buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20', daysToKeepStr: '30'))
timestamps()
ansiColor('xterm')
disableResume()
durabilityHint('PERFORMANCE_OPTIMIZED')
rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true])
quietPeriod(10)
}
triggers {
issueCommentTrigger("${obltGitHubComments()}")
}
stages {
stage('Checkout') {
steps {
pipelineManager([ cancelPreviousRunningBuilds: [ when: 'PR' ] ])
deleteDir()
gitCheckout(basedir: "${BASE_DIR}", githubNotifyFirstTimeContributor: true)
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
}
}
stage('Lint'){
steps {
withGithubNotify(context: "Lint") {
dir("${BASE_DIR}"){
withGoEnv(){
sh(label: 'lint', script: '''
go mod tidy && git diff --exit-code
gofmt -l . | read && echo "Code differs from gofmt's style. Run 'gofmt -w .'" 1>&2 && exit 1 || true
''')
sh(label: 'Go vet', script: 'go vet')
}
}
}
}
}
stage('Test') {
failFast false
matrix {
agent {label "${PLATFORM}"}
options { skipDefaultCheckout() }
axes {
axis {
name 'PLATFORM'
values 'ubuntu-20.04 && immutable', 'windows-2019 && windows-immutable'
}
}
stages {
stage('build'){
steps {
withGithubNotify(context: "Build-${GO_VERSION}-${PLATFORM}") {
deleteDir()
unstash 'source'
dir("${BASE_DIR}"){
withGoEnv(){
cmd(label: 'Go build', script: 'go build')
}
}
}
}
}
stage('Test') {
steps {
withGithubNotify(context: "Test-${GO_VERSION}-${PLATFORM}") {
deleteDir()
unstash 'source'
dir("${BASE_DIR}"){
withGoEnv(){
goTestJUnit(options: '-v ./...', output: 'junit-report.xml')
}
}
}
}
post {
always {
junit(allowEmptyResults: true, keepLongStdio: true, testResults: '**/junit-report.xml')
}
}
}
}
}
}
}
post {
cleanup {
notifyBuildResult(prComment: true)
}
}
}
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.8
1.17.8

0 comments on commit db06963

Please sign in to comment.