From 5fab3268bd00868405d5fc24b8d6060ad7275881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Thu, 26 Mar 2020 14:37:41 +0100 Subject: [PATCH] allow lint stage fail in CI and still upload build result MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- ci/Jenkinsfile.android | 11 ++++++++++- ci/Jenkinsfile.ios | 11 ++++++++++- ci/Jenkinsfile.linux | 11 ++++++++++- ci/Jenkinsfile.macos | 11 ++++++++++- ci/Jenkinsfile.windows | 11 ++++++++++- 5 files changed, 50 insertions(+), 5 deletions(-) diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index 9f2756b7cc..583bc24f34 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -63,7 +63,16 @@ pipeline { stage('Checks') { stages { stage('Lint') { steps { - script { nix.shell('lein cljfmt check', attr: 'shells.lein') } + script { + /* We want the build result to be uploaded */ + catchError( + message: 'Linting check failed!', + buildResult: 'FAILURE', + stageResult: 'FAILURE' + ) { + nix.shell('lein cljfmt check', attr: 'shells.lein') + } + } } } stage('Tests') { diff --git a/ci/Jenkinsfile.ios b/ci/Jenkinsfile.ios index 3c8211138c..190df92798 100644 --- a/ci/Jenkinsfile.ios +++ b/ci/Jenkinsfile.ios @@ -54,7 +54,16 @@ pipeline { stage('Checks') { stages { stage('Lint') { steps { - script { nix.shell('lein cljfmt check', attr: 'shells.lein') } + script { + /* We want the build result to be uploaded */ + catchError( + message: 'Linting check failed!', + buildResult: 'FAILURE', + stageResult: 'FAILURE' + ) { + nix.shell('lein cljfmt check', attr: 'shells.lein') + } + } } } stage('Tests') { diff --git a/ci/Jenkinsfile.linux b/ci/Jenkinsfile.linux index 39e41c39bf..efb1416d80 100644 --- a/ci/Jenkinsfile.linux +++ b/ci/Jenkinsfile.linux @@ -57,7 +57,16 @@ pipeline { stage('Checks') { stages { stage('Lint') { steps { - script { nix.shell('lein cljfmt check', attr: 'shells.lein') } + script { + /* We want the build result to be uploaded */ + catchError( + message: 'Linting check failed!', + buildResult: 'FAILURE', + stageResult: 'FAILURE' + ) { + nix.shell('lein cljfmt check', attr: 'shells.lein') + } + } } } stage('Tests') { diff --git a/ci/Jenkinsfile.macos b/ci/Jenkinsfile.macos index f0461d9d9b..b5160b73b1 100644 --- a/ci/Jenkinsfile.macos +++ b/ci/Jenkinsfile.macos @@ -55,7 +55,16 @@ pipeline { stage('Checks') { stages { stage('Lint') { steps { - script { nix.shell('lein cljfmt check', attr: 'shells.lein') } + script { + /* We want the build result to be uploaded */ + catchError( + message: 'Linting check failed!', + buildResult: 'FAILURE', + stageResult: 'FAILURE' + ) { + nix.shell('lein cljfmt check', attr: 'shells.lein') + } + } } } stage('Tests') { diff --git a/ci/Jenkinsfile.windows b/ci/Jenkinsfile.windows index cdc84b94b2..b3b7c1d93a 100644 --- a/ci/Jenkinsfile.windows +++ b/ci/Jenkinsfile.windows @@ -60,7 +60,16 @@ pipeline { stage('Checks') { stages { stage('Lint') { steps { - script { nix.shell('lein cljfmt check', attr: 'shells.lein') } + script { + /* We want the build result to be uploaded */ + catchError( + message: 'Linting check failed!', + buildResult: 'FAILURE', + stageResult: 'FAILURE' + ) { + nix.shell('lein cljfmt check', attr: 'shells.lein') + } + } } } stage('Tests') {