You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-07-15 01:34:38 +02:00
Merge pull request #169 from marcusholl/pr/gitUtilsParameterSanityCheck
GitUtils: sanity check for parameters handed over via signature
This commit is contained in:
@ -21,6 +21,14 @@ String[] extractLogLines(String filter = '',
|
|||||||
String to = 'HEAD',
|
String to = 'HEAD',
|
||||||
String format = '%b') {
|
String format = '%b') {
|
||||||
|
|
||||||
|
// Checks below: there was an value provided from outside, but the value was null.
|
||||||
|
// Throwing an exception is more transparent than making a fallback to the defaults
|
||||||
|
// used in case the paramter is omitted in the signature.
|
||||||
|
if(filter == null) throw new IllegalArgumentException('Parameter \'filter\' not provided.')
|
||||||
|
if(! from?.trim()) throw new IllegalArgumentException('Parameter \'from\' not provided.')
|
||||||
|
if(! to?.trim()) throw new IllegalArgumentException('Parameter \'to\' not provided.')
|
||||||
|
if(! format?.trim()) throw new IllegalArgumentException('Parameter \'format\' not provided.')
|
||||||
|
|
||||||
sh ( returnStdout: true,
|
sh ( returnStdout: true,
|
||||||
script: """#!/bin/bash
|
script: """#!/bin/bash
|
||||||
git log --pretty=format:${format} ${from}..${to}
|
git log --pretty=format:${format} ${from}..${to}
|
||||||
|
Reference in New Issue
Block a user