R. Tyler Croy | 5eb7141 | 2017-02-06 00:37:42 -0800 | [diff] [blame] | 1 | #!/usr/bin/env groovy |
| 2 | |
R. Tyler Croy | fc25da3 | 2017-02-06 02:16:17 -0800 | [diff] [blame] | 3 | properties([ |
| 4 | buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '5')), |
| 5 | pipelineTriggers([cron('@daily')]), |
| 6 | ]) |
| 7 | |
Carlos Sanchez | e9f9095 | 2016-03-15 19:16:56 +0100 | [diff] [blame] | 8 | node('docker') { |
R. Tyler Croy | 5eb7141 | 2017-02-06 00:37:42 -0800 | [diff] [blame] | 9 | deleteDir() |
Carlos Sanchez | e9f9095 | 2016-03-15 19:16:56 +0100 | [diff] [blame] | 10 | |
R. Tyler Croy | 5eb7141 | 2017-02-06 00:37:42 -0800 | [diff] [blame] | 11 | stage('Checkout') { |
| 12 | checkout scm |
| 13 | } |
Carlos Sanchez | e9f9095 | 2016-03-15 19:16:56 +0100 | [diff] [blame] | 14 | |
R. Tyler Croy | b3c49ab | 2017-02-06 02:56:03 -0800 | [diff] [blame] | 15 | if (!infra.isTrusted()) { |
| 16 | /* Outside of the trusted.ci environment, we're building and testing |
| 17 | * the Dockerful in this repository, but not publishing to docker hub |
| 18 | */ |
| 19 | stage('Build') { |
| 20 | docker.build('jenkins') |
| 21 | } |
R. Tyler Croy | 5eb7141 | 2017-02-06 00:37:42 -0800 | [diff] [blame] | 22 | |
R. Tyler Croy | b3c49ab | 2017-02-06 02:56:03 -0800 | [diff] [blame] | 23 | stage('Test') { |
| 24 | sh """ |
| 25 | git submodule update --init --recursive |
| 26 | git clone https://github.com/sstephenson/bats.git |
| 27 | bats/bin/bats tests |
| 28 | """ |
| 29 | } |
| 30 | } else { |
| 31 | /* In our trusted.ci environment we only want to be publishing our |
| 32 | * containers from artifacts |
| 33 | */ |
R. Tyler Croy | f358b3c | 2017-02-06 01:01:03 -0800 | [diff] [blame] | 34 | stage('Publish') { |
Carlos Sanchez | 0f763d4 | 2017-02-06 10:55:11 +0100 | [diff] [blame] | 35 | sh './publish.sh' |
R. Tyler Croy | f358b3c | 2017-02-06 01:01:03 -0800 | [diff] [blame] | 36 | } |
| 37 | } |
Carlos Sanchez | e9f9095 | 2016-03-15 19:16:56 +0100 | [diff] [blame] | 38 | } |