Serge Bazanski | 6feb746 | 2021-05-18 15:49:15 +0200 | [diff] [blame^] | 1 | // This is a 'Jenkinsfile'-style declarative 'Pipeline' definition. It is |
| 2 | // executed by Jenkins for presubmit checks, ie. checks that run against an |
| 3 | // open Gerrit change request. |
| 4 | |
| 5 | pipeline { |
| 6 | agent none |
| 7 | stages { |
| 8 | stage('Parallel') { |
| 9 | parallel { |
| 10 | stage('Test') { |
| 11 | agent { |
| 12 | node { |
| 13 | label "" |
| 14 | customWorkspace '/home/ci/monogon' |
| 15 | } |
| 16 | } |
| 17 | steps { |
| 18 | gerritCheck checks: ['jenkins:test': 'RUNNING'], message: "Running on ${env.NODE_NAME}" |
| 19 | sh "git clean -fdx -e '/bazel-*'" |
| 20 | sh "bazel test //..." |
| 21 | sh "bazel test -c dbg //..." |
| 22 | } |
| 23 | post { |
| 24 | success { |
| 25 | gerritCheck checks: ['jenkins:test': 'SUCCESSFUL'] |
| 26 | } |
| 27 | unsuccessful { |
| 28 | gerritCheck checks: ['jenkins:test': 'FAILED'] |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | stage('Gazelle') { |
| 34 | agent { |
| 35 | node { |
| 36 | label "" |
| 37 | customWorkspace '/home/ci/monogon' |
| 38 | } |
| 39 | } |
| 40 | steps { |
| 41 | gerritCheck checks: ['jenkins:gazelle': 'RUNNING'], message: "Running on ${env.NODE_NAME}" |
| 42 | sh "git clean -fdx -e '/bazel-*'" |
| 43 | sh "bazel run //:fietsje" |
| 44 | sh "bazel run //:gazelle -- update" |
| 45 | |
| 46 | script { |
| 47 | def diff = sh script: "git status --porcelain", returnStdout: true |
| 48 | if (diff.trim() != "") { |
| 49 | sh "git diff HEAD" |
| 50 | error """ |
| 51 | Unclean working directory after running gazelle and Fietsje. |
| 52 | Please run: |
| 53 | |
| 54 | \$ bazel run //:fietsje |
| 55 | \$ bazel run //:gazelle -- update |
| 56 | |
| 57 | In your git checkout and amend the resulting diff to this changelist. |
| 58 | """ |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | post { |
| 63 | success { |
| 64 | gerritCheck checks: ['jenkins:gazelle': 'SUCCESSFUL'] |
| 65 | } |
| 66 | unsuccessful { |
| 67 | gerritCheck checks: ['jenkins:gazelle': 'FAILED'] |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | } |