This repository has been archived by the owner on Sep 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pipeline] elastic-agent-shipper (#2)
* [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
1 parent
a0f5c1b
commit db06963
Showing
2 changed files
with
103 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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,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) | ||
} | ||
} | ||
} |
This file contains 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 |
---|---|---|
@@ -1 +1 @@ | ||
1.17.8 | ||
1.17.8 |