Skip to content
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

Adding CI setup files #13

Merged
merged 1 commit into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
75 changes: 75 additions & 0 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env groovy

@Library('apm@current') _

pipeline {
agent { label 'ubuntu-18 && immutable' }
environment {
BASE_DIR="src/github.com/elastic/package-spec"
JOB_GIT_CREDENTIALS = "f6c7695a-671e-4f4f-a331-acdce44ff9ba"
PIPELINE_LOG_LEVEL='INFO'
}
options {
timeout(time: 15, unit: 'MINUTES')
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('(?i)(.*(?:jenkins\\W+)?run\\W+(?:the\\W+)?tests(?:\\W+please)?.*|^\\/test$)')
}
stages {
/**
Checkout the code and stash it, to use it on other stages.
*/
stage('Checkout') {
steps {
deleteDir()
gitCheckout(basedir: "${BASE_DIR}")
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
}
}
/**
Check the source code.
*/
stage('Check') {
steps {
cleanup()
withMageEnv(){
dir("${BASE_DIR}"){
sh(label: 'Check',script: 'make check')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sh(label: 'Check',script: 'make check')
sh(label: 'Check', script: 'make check')

Tiny nit: Missing space

}
}
}
}
/**
Test the source code.
*/
stage('Test') {
steps {
cleanup()
withMageEnv(){
dir("${BASE_DIR}"){
sh(label: 'Check',script: 'make test')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sh(label: 'Check',script: 'make test')
sh(label: 'Check', script: 'make test')

Tiny nit: missing space

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What output does make test produce? Is it something that needs to be processed with junit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment make test will simply run go test -v ./... under the hood: https://github.com/elastic/package-spec/pull/12/files#diff-d635a9f292641eeeb317ef8c83354e7dR16

Would it be better if it output in a junit-compatible format? We could certainly make that happen with something like https://github.com/jstemmer/go-junit-report.

}
}
}
}
}
post {
cleanup {
notifyBuildResult(prComment: true)
}
}
}

def cleanup(){
dir("${BASE_DIR}"){
deleteDir()
}
unstash 'source'
}
18 changes: 18 additions & 0 deletions .ci/jobs/defaults.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---

##### GLOBAL METADATA

- meta:
cluster: beats-ci

##### JOB DEFAULTS

- job:
logrotate:
numToKeep: 20
node: linux
concurrent: true
publishers:
- email:
recipients: [email protected]
prune-dead-branches: true
43 changes: 43 additions & 0 deletions .ci/jobs/package-spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
- job:
name: Beats/package-spec
display-name: Package Spec
description: Jenkins pipeline for the Package Spec project
view: Beats
project-type: multibranch
script-path: .ci/Jenkinsfile
scm:
- github:
branch-discovery: no-pr
discover-pr-forks-strategy: merge-current
discover-pr-forks-trust: permission
discover-pr-origin: merge-current
discover-tags: true
notification-context: 'package-spec'
repo: package-spec
repo-owner: elastic
credentials-id: 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken
ssh-checkout:
credentials: f6c7695a-671e-4f4f-a331-acdce44ff9ba
build-strategies:
- tags:
ignore-tags-older-than: -1
ignore-tags-newer-than: -1
- regular-branches: true
- change-request:
ignore-target-only-changes: false
clean:
after: true
before: true
prune: true
shallow-clone: true
depth: 5
do-not-fetch-tags: true
submodule:
disable: false
recursive: true
parent-credentials: true
timeout: 100
timeout: '15'
use-author: true
wipe-workspace: true