Skip to content
This repository is currently being migrated. It's locked while the migration is in progress.

Commit

Permalink
build: add Jenkins pipeline
Browse files Browse the repository at this point in the history
Builds, tests and lints using the Makefile.

Test has a 'special' pipeline target of test-junit which outputs the
test results in Junit, the form Jenkins requires.
  • Loading branch information
domodwyer committed Jan 7, 2020
1 parent 9b8cf3e commit c693495
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ repos:
types: [go]
exclude: \.pb.go$
args: ["-local=code.storageos.net"]
- id: dep-check
stages: [push, manual]
types: [go]
- id: todo-jira-check
stages: [push, manual]
types: [go]
Expand All @@ -54,3 +51,12 @@ repos:
types: [go]
exclude: \.pb.go$

# A CI-only lint that runs golang-ci on all the code
- repo: local
hooks:
- id: golangci-lint
name: Run golang-ci lints on all code
stages: [manual]
language: system
entry: sh -c 'golangci-lint run --timeout=5m ./...'
pass_filenames: false
44 changes: 44 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
pipeline {
agent { label 'dapper '}
triggers { pollSCM('0 * * * *') }
options { timestamps() }

stages {
// Build first to catch compilation errors - there's no point running
// unit tests against code that doesn't compile.
stage("Build") {
steps {
sh 'make -B build-docker'
}

// Always publish c2 and other binaries to Jenkins' filestore.
post { success { archiveArtifacts artifacts: 'bin/*', fingerprint: true } }
}

stage("Quality checks") {
parallel {
stage("Unit test only") {
steps {
sh 'make -B test-junit-docker'
}
post {
success { junit 'test_junit.xml' }
}
}

stage("Lints") {
steps {
sh 'make lint-docker'
}
}
}
}
}

post {
always {
sh 'make clean-docker'
sh 'sudo chown -R $USER *'
}
}
}

0 comments on commit c693495

Please sign in to comment.