jenkins-lib

Jenkins shared library
git clone https://git.in0rdr.ch/jenkins-lib.git
Log | Files | Refs | README

commit b6ab4deb3ae6f60abdabf34963ddde78ea657b8d
parent c4ecae0852e791c0e3323c10e9f36e54ee36e5d1
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date:   Tue,  4 Jun 2024 18:45:00 +0200

feat(gitleaks): return unstable instead of failure

Diffstat:
Mvars/gitleaks.groovy | 16+++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/vars/gitleaks.groovy b/vars/gitleaks.groovy @@ -11,16 +11,14 @@ def call() { stages { stage('scan') { steps { - sh ''' - gitleaks detect \ - --verbose --no-color --no-banner \ - --report-path gitleaks-report.json \ - ''' - sh 'ls' script { - def report = readJSON file: 'gitleaks-report.json' - if (!report.isEmpty) { - unstable(message: "${STAGE_NAME} is unstable") + ret = sh returnStatus: true, script: ''' + gitleaks detect \ + --verbose --no-color --no-banner \ + --report-path gitleaks-report.json \ + ''' + if (ret != 0) { + unstable(message: "Secrets detected in ${BUILD_URL}") } } }