blob: 7cbb3d207f86305b29a39e447e58a10aa8ff14f4 [file] [log] [blame]
R. Tyler Croy5eb71412017-02-06 00:37:42 -08001#!/usr/bin/env groovy
2
R. Tyler Croyfc25da32017-02-06 02:16:17 -08003properties([
4 buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '5')),
5 pipelineTriggers([cron('@daily')]),
6])
7
Carlos Sancheze9f90952016-03-15 19:16:56 +01008node('docker') {
R. Tyler Croy5eb71412017-02-06 00:37:42 -08009 deleteDir()
Carlos Sancheze9f90952016-03-15 19:16:56 +010010
R. Tyler Croy5eb71412017-02-06 00:37:42 -080011 stage('Checkout') {
12 checkout scm
13 }
Carlos Sancheze9f90952016-03-15 19:16:56 +010014
R. Tyler Croyb3c49ab2017-02-06 02:56:03 -080015 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 Croy5eb71412017-02-06 00:37:42 -080022
R. Tyler Croyb3c49ab2017-02-06 02:56:03 -080023 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 Croyf358b3c2017-02-06 01:01:03 -080034 stage('Publish') {
Carlos Sanchez0f763d42017-02-06 10:55:11 +010035 sh './publish.sh'
R. Tyler Croyf358b3c2017-02-06 01:01:03 -080036 }
37 }
Carlos Sancheze9f90952016-03-15 19:16:56 +010038}