mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
Merge pull request #805 from rodibrin/harmonize-docker-arguments
harmonize docker configuration properties
This commit is contained in:
commit
4e03c81b94
@ -70,6 +70,32 @@ class BatsExecuteTestsTest extends BasePiperTest {
|
||||
assertJobStatusSuccess()
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDockerFromCustomStepConfiguration() {
|
||||
|
||||
def expectedImage = 'image:test'
|
||||
def expectedEnvVars = ['env1': 'value1', 'env2': 'value2']
|
||||
def expectedOptions = '--opt1=val1 --opt2=val2 --opt3'
|
||||
def expectedWorkspace = '/path/to/workspace'
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:[batsExecuteTests:[
|
||||
dockerImage: expectedImage,
|
||||
dockerOptions: expectedOptions,
|
||||
dockerEnvVars: expectedEnvVars,
|
||||
dockerWorkspace: expectedWorkspace
|
||||
]]]
|
||||
|
||||
stepRule.step.batsExecuteTests(
|
||||
script: nullScript,
|
||||
juStabUtils: utils
|
||||
)
|
||||
|
||||
assert expectedImage == dockerExecuteRule.dockerParams.dockerImage
|
||||
assert expectedOptions == dockerExecuteRule.dockerParams.dockerOptions
|
||||
assert expectedEnvVars.equals(dockerExecuteRule.dockerParams.dockerEnvVars)
|
||||
assert expectedWorkspace == dockerExecuteRule.dockerParams.dockerWorkspace
|
||||
}
|
||||
|
||||
@Test
|
||||
void testTap() {
|
||||
stepRule.step.batsExecuteTests(
|
||||
|
@ -67,6 +67,32 @@ class GaugeExecuteTestsTest extends BasePiperTest {
|
||||
assertJobStatusSuccess()
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDockerFromCustomStepConfiguration() {
|
||||
|
||||
def expectedImage = 'image:test'
|
||||
def expectedEnvVars = ['HUB':'', 'HUB_URL':'', 'env1': 'value1', 'env2': 'value2']
|
||||
def expectedOptions = '--opt1=val1 --opt2=val2 --opt3'
|
||||
def expectedWorkspace = '/path/to/workspace'
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:[gaugeExecuteTests:[
|
||||
dockerImage: expectedImage,
|
||||
dockerOptions: expectedOptions,
|
||||
dockerEnvVars: expectedEnvVars,
|
||||
dockerWorkspace: expectedWorkspace
|
||||
]]]
|
||||
|
||||
stepRule.step.gaugeExecuteTests(
|
||||
script: nullScript,
|
||||
juStabUtils: utils
|
||||
)
|
||||
|
||||
assert expectedImage == seleniumParams.dockerImage
|
||||
assert expectedOptions == seleniumParams.dockerOptions
|
||||
assert expectedEnvVars.equals(seleniumParams.dockerEnvVars)
|
||||
assert expectedWorkspace == seleniumParams.dockerWorkspace
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExecuteGaugeNode() throws Exception {
|
||||
stepRule.step.gaugeExecuteTests(
|
||||
|
@ -53,6 +53,32 @@ class KarmaExecuteTestsTest extends BasePiperTest {
|
||||
assertJobStatusSuccess()
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDockerFromCustomStepConfiguration() {
|
||||
|
||||
def expectedImage = 'image:test'
|
||||
def expectedEnvVars = ['NO_PROXY':'', 'no_proxy':'', 'env1': 'value1', 'env2': 'value2']
|
||||
def expectedOptions = '--opt1=val1 --opt2=val2 --opt3'
|
||||
def expectedWorkspace = '/path/to/workspace'
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:[karmaExecuteTests:[
|
||||
dockerImage: expectedImage,
|
||||
dockerOptions: expectedOptions,
|
||||
dockerEnvVars: expectedEnvVars,
|
||||
dockerWorkspace: expectedWorkspace
|
||||
]]]
|
||||
|
||||
stepRule.step.karmaExecuteTests(
|
||||
script: nullScript,
|
||||
juStabUtils: utils
|
||||
)
|
||||
|
||||
assert expectedImage == seleniumParams.dockerImage
|
||||
assert expectedOptions == seleniumParams.dockerOptions
|
||||
assert expectedEnvVars.equals(seleniumParams.dockerEnvVars)
|
||||
assert expectedWorkspace == seleniumParams.dockerWorkspace
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMultiModules() throws Exception {
|
||||
stepRule.step.karmaExecuteTests(
|
||||
|
@ -169,6 +169,29 @@ public class MtaBuildTest extends BasePiperTest {
|
||||
assert shellRule.shell.find(){ c -> c.contains('java -jar /opt/sap/mta/lib/mta.jar --mtar com.mycompany.northwind.mtar --build-target=NEO build')}
|
||||
}
|
||||
|
||||
@Test
|
||||
void dockerFromCustomStepConfigurationTest() {
|
||||
|
||||
def expectedImage = 'image:test'
|
||||
def expectedEnvVars = ['env1': 'value1', 'env2': 'value2']
|
||||
def expectedOptions = '--opt1=val1 --opt2=val2 --opt3'
|
||||
def expectedWorkspace = '-w /path/to/workspace'
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:[mtaBuild:[
|
||||
dockerImage: expectedImage,
|
||||
dockerOptions: expectedOptions,
|
||||
dockerEnvVars: expectedEnvVars,
|
||||
dockerWorkspace: expectedWorkspace
|
||||
]]]
|
||||
|
||||
stepRule.step.mtaBuild(script: nullScript)
|
||||
|
||||
assert expectedImage == dockerExecuteRule.dockerParams.dockerImage
|
||||
assert expectedOptions == dockerExecuteRule.dockerParams.dockerOptions
|
||||
assert expectedEnvVars.equals(dockerExecuteRule.dockerParams.dockerEnvVars)
|
||||
assert expectedWorkspace == dockerExecuteRule.dockerParams.dockerWorkspace
|
||||
}
|
||||
|
||||
@Test
|
||||
void canConfigureDockerImage() {
|
||||
|
||||
|
@ -77,6 +77,32 @@ class NewmanExecuteTest extends BasePiperTest {
|
||||
assertJobStatusSuccess()
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDockerFromCustomStepConfiguration() {
|
||||
|
||||
def expectedImage = 'image:test'
|
||||
def expectedEnvVars = ['env1': 'value1', 'env2': 'value2']
|
||||
def expectedOptions = '--opt1=val1 --opt2=val2 --opt3'
|
||||
def expectedWorkspace = '/path/to/workspace'
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:[newmanExecute:[
|
||||
dockerImage: expectedImage,
|
||||
dockerOptions: expectedOptions,
|
||||
dockerEnvVars: expectedEnvVars,
|
||||
dockerWorkspace: expectedWorkspace
|
||||
]]]
|
||||
|
||||
stepRule.step.newmanExecute(
|
||||
script: nullScript,
|
||||
juStabUtils: utils
|
||||
)
|
||||
|
||||
assert expectedImage == dockerExecuteRule.dockerParams.dockerImage
|
||||
assert expectedOptions == dockerExecuteRule.dockerParams.dockerOptions
|
||||
assert expectedEnvVars.equals(dockerExecuteRule.dockerParams.dockerEnvVars)
|
||||
assert expectedWorkspace == dockerExecuteRule.dockerParams.dockerWorkspace
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGlobalInstall() throws Exception {
|
||||
stepRule.step.newmanExecute(
|
||||
|
@ -40,6 +40,32 @@ class NpmExecuteTest extends BasePiperTest {
|
||||
assertEquals 'node:8-stretch', dockerExecuteRule.dockerParams.dockerImage
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDockerFromCustomStepConfiguration() {
|
||||
|
||||
def expectedImage = 'image:test'
|
||||
def expectedEnvVars = ['env1': 'value1', 'env2': 'value2']
|
||||
def expectedOptions = '--opt1=val1 --opt2=val2 --opt3'
|
||||
def expectedWorkspace = '/path/to/workspace'
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:[npmExecute:[
|
||||
dockerImage: expectedImage,
|
||||
dockerOptions: expectedOptions,
|
||||
dockerEnvVars: expectedEnvVars,
|
||||
dockerWorkspace: expectedWorkspace
|
||||
]]]
|
||||
|
||||
stepRule.step.npmExecute(
|
||||
script: nullScript,
|
||||
juStabUtils: utils
|
||||
)
|
||||
|
||||
assert expectedImage == dockerExecuteRule.dockerParams.dockerImage
|
||||
assert expectedOptions == dockerExecuteRule.dockerParams.dockerOptions
|
||||
assert expectedEnvVars.equals(dockerExecuteRule.dockerParams.dockerEnvVars)
|
||||
assert expectedWorkspace == dockerExecuteRule.dockerParams.dockerWorkspace
|
||||
}
|
||||
|
||||
@Test
|
||||
void testNpmExecuteWithClosure() {
|
||||
stepRule.step.npmExecute(script: nullScript, dockerImage: 'node:8-stretch', npmCommand: 'run build') { }
|
||||
|
@ -57,6 +57,33 @@ class SeleniumExecuteTestsTest extends BasePiperTest {
|
||||
assertThat(dockerExecuteRule.dockerParams.sidecarVolumeBind, is(['/dev/shm': '/dev/shm']))
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDockerFromCustomStepConfiguration() {
|
||||
|
||||
def expectedImage = 'image:test'
|
||||
def expectedEnvVars = ['env1': 'value1', 'env2': 'value2']
|
||||
def expectedOptions = '--opt1=val1 --opt2=val2 --opt3'
|
||||
def expectedWorkspace = '/path/to/workspace'
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration = [steps:[seleniumExecuteTests:[
|
||||
dockerImage: expectedImage,
|
||||
dockerOptions: expectedOptions,
|
||||
dockerEnvVars: expectedEnvVars,
|
||||
dockerWorkspace: expectedWorkspace
|
||||
]]]
|
||||
|
||||
stepRule.step.seleniumExecuteTests(
|
||||
script: nullScript,
|
||||
juStabUtils: utils
|
||||
) {
|
||||
}
|
||||
|
||||
assert expectedImage == dockerExecuteRule.dockerParams.dockerImage
|
||||
assert expectedOptions == dockerExecuteRule.dockerParams.dockerOptions
|
||||
assert expectedEnvVars.equals(dockerExecuteRule.dockerParams.dockerEnvVars)
|
||||
assert expectedWorkspace == dockerExecuteRule.dockerParams.dockerWorkspace
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExecuteSeleniumCustomBuildTool() {
|
||||
stepRule.step.seleniumExecuteTests(
|
||||
|
@ -17,6 +17,8 @@ import util.JenkinsStepRule
|
||||
import util.JenkinsLoggingRule
|
||||
import util.Rules
|
||||
|
||||
import com.sap.piper.MapUtils
|
||||
|
||||
class SnykExecuteTest extends BasePiperTest {
|
||||
private ExpectedException thrown = ExpectedException.none()
|
||||
private JenkinsDockerExecuteRule dockerExecuteRule = new JenkinsDockerExecuteRule(this)
|
||||
@ -94,6 +96,35 @@ class SnykExecuteTest extends BasePiperTest {
|
||||
assertThat(dockerExecuteRule.dockerParams.stashContent, hasItem('opensourceConfiguration'))
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDockerFromCustomStepConfiguration() {
|
||||
|
||||
def expectedImage = 'image:test'
|
||||
def expectedEnvVars = ['SNYK_TOKEN':'', 'env1': 'value1', 'env2': 'value2']
|
||||
def expectedOptions = '--opt1=val1 --opt2=val2 --opt3'
|
||||
def expectedWorkspace = '/path/to/workspace'
|
||||
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration = MapUtils.merge(
|
||||
nullScript.commonPipelineEnvironment.configuration,
|
||||
[steps:[snykExecute:[
|
||||
dockerImage: expectedImage,
|
||||
dockerOptions: expectedOptions,
|
||||
dockerEnvVars: expectedEnvVars,
|
||||
dockerWorkspace: expectedWorkspace
|
||||
]]])
|
||||
|
||||
stepRule.step.snykExecute(
|
||||
script: nullScript,
|
||||
juStabUtils: utils
|
||||
)
|
||||
|
||||
assert expectedImage == dockerExecuteRule.dockerParams.dockerImage
|
||||
assert expectedOptions == dockerExecuteRule.dockerParams.dockerOptions
|
||||
assert expectedEnvVars.equals(dockerExecuteRule.dockerParams.dockerEnvVars)
|
||||
assert expectedWorkspace == dockerExecuteRule.dockerParams.dockerWorkspace
|
||||
}
|
||||
|
||||
@Test
|
||||
void testScanTypeNpm() throws Exception {
|
||||
stepRule.step.snykExecute(
|
||||
|
@ -2,6 +2,7 @@ import com.sap.piper.DescriptorUtils
|
||||
import com.sap.piper.JsonUtils
|
||||
import com.sap.piper.integration.WhitesourceOrgAdminRepository
|
||||
import com.sap.piper.integration.WhitesourceRepository
|
||||
import com.sap.piper.MapUtils
|
||||
import hudson.AbortException
|
||||
import org.hamcrest.Matchers
|
||||
import org.junit.Assert
|
||||
@ -100,6 +101,53 @@ class WhitesourceExecuteScanTest extends BasePiperTest {
|
||||
nullScript.commonPipelineEnvironment.configuration['steps']['whitesourceExecuteScan']['userTokenCredentialsId'] = 'ID-123456789'
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDockerFromCustomStepConfiguration() {
|
||||
|
||||
def expectedImage = 'image:test'
|
||||
def expectedEnvVars = ['env1': 'value1', 'env2': 'value2']
|
||||
def expectedOptions = '--opt1=val1 --opt2=val2 --opt3'
|
||||
def expectedWorkspace = '/path/to/workspace'
|
||||
|
||||
helper.registerAllowedMethod("readProperties", [Map], {
|
||||
def result = new Properties()
|
||||
result.putAll([
|
||||
"apiKey": "b39d1328-52e2-42e3-98f0-932709daf3f0",
|
||||
"productName": "SHC - Piper",
|
||||
"checkPolicies": "true",
|
||||
"projectName": "python-test",
|
||||
"projectVersion": "1.0.0"
|
||||
])
|
||||
return result
|
||||
})
|
||||
|
||||
nullScript.commonPipelineEnvironment.configuration =
|
||||
MapUtils.merge(nullScript.commonPipelineEnvironment.configuration,
|
||||
[steps:[whitesourceExecuteScan:[
|
||||
dockerImage: expectedImage,
|
||||
dockerOptions: expectedOptions,
|
||||
dockerEnvVars: expectedEnvVars,
|
||||
dockerWorkspace: expectedWorkspace
|
||||
]]]
|
||||
)
|
||||
|
||||
stepRule.step.whitesourceExecuteScan([
|
||||
script : nullScript,
|
||||
whitesourceRepositoryStub : whitesourceStub,
|
||||
whitesourceOrgAdminRepositoryStub : whitesourceOrgAdminRepositoryStub,
|
||||
descriptorUtilsStub : descriptorUtilsStub,
|
||||
scanType : 'maven',
|
||||
juStabUtils : utils,
|
||||
orgToken : 'testOrgToken',
|
||||
whitesourceProductName : 'testProduct'
|
||||
])
|
||||
|
||||
assert expectedImage == dockerExecuteRule.dockerParams.dockerImage
|
||||
assert expectedOptions == dockerExecuteRule.dockerParams.dockerOptions
|
||||
assert expectedEnvVars.equals(dockerExecuteRule.dockerParams.dockerEnvVars)
|
||||
assert expectedWorkspace == dockerExecuteRule.dockerParams.dockerWorkspace
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMaven() {
|
||||
helper.registerAllowedMethod("readProperties", [Map], {
|
||||
|
@ -16,6 +16,10 @@ import groovy.transform.Field
|
||||
/** @see dockerExecute */
|
||||
'dockerImage',
|
||||
/** @see dockerExecute */
|
||||
'dockerEnvVars',
|
||||
/** @see dockerExecute */
|
||||
'dockerOptions',
|
||||
/** @see dockerExecute */
|
||||
'dockerWorkspace',
|
||||
/** @see dockerExecute */
|
||||
'stashContent',
|
||||
@ -97,7 +101,14 @@ void call(Map parameters = [:]) {
|
||||
} finally {
|
||||
sh "cat 'TEST-${config.testPackage}.tap'"
|
||||
if (config.outputFormat == 'junit') {
|
||||
dockerExecute(script: script, dockerImage: config.dockerImage, dockerWorkspace: config.dockerWorkspace, stashContent: config.stashContent) {
|
||||
dockerExecute(
|
||||
script: script,
|
||||
dockerImage: config.dockerImage,
|
||||
dockerEnvVars: config.dockerEnvVars,
|
||||
dockerOptions: config.dockerOptions,
|
||||
dockerWorkspace: config.dockerWorkspace,
|
||||
stashContent: config.stashContent
|
||||
) {
|
||||
sh "NPM_CONFIG_PREFIX=~/.npm-global npm install tap-xunit -g"
|
||||
sh "cat 'TEST-${config.testPackage}.tap' | PATH=\$PATH:~/.npm-global/bin tap-xunit --package='${config.testPackage}' > TEST-${config.testPackage}.xml"
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ import groovy.transform.Field
|
||||
'dockerImage',
|
||||
/** @see dockerExecute*/
|
||||
'dockerName',
|
||||
/** @see dockerExecute */
|
||||
'dockerOptions',
|
||||
/** @see dockerExecute*/
|
||||
'dockerWorkspace',
|
||||
/**
|
||||
@ -100,6 +102,8 @@ void call(Map parameters = [:]) {
|
||||
.mixin(parameters, PARAMETER_KEYS)
|
||||
.dependingOn('buildTool').mixin('dockerImage')
|
||||
.dependingOn('buildTool').mixin('dockerName')
|
||||
.dependingOn('buildTool').mixin('dockerOptions')
|
||||
.dependingOn('buildTool').mixin('dockerEnvVars')
|
||||
.dependingOn('buildTool').mixin('dockerWorkspace')
|
||||
.dependingOn('buildTool').mixin('languageRunner')
|
||||
.dependingOn('buildTool').mixin('runCommand')
|
||||
@ -127,9 +131,10 @@ void call(Map parameters = [:]) {
|
||||
seleniumExecuteTests (
|
||||
script: script,
|
||||
buildTool: config.buildTool,
|
||||
dockerEnvVars: config.dockerEnvVars,
|
||||
dockerImage: config.dockerImage,
|
||||
dockerName: config.dockerName,
|
||||
dockerEnvVars: config.dockerEnvVars,
|
||||
dockerOptions: config.dockerOptions,
|
||||
dockerWorkspace: config.dockerWorkspace,
|
||||
stashContent: config.stashContent
|
||||
) {
|
||||
|
@ -30,6 +30,8 @@ import groovy.transform.Field
|
||||
* Specifies a dedicated user home directory for the container which will be passed as value for environment variable `HOME`.
|
||||
*/
|
||||
'dockerWorkspace',
|
||||
/** @see dockerExecute */
|
||||
'dockerOptions',
|
||||
/**
|
||||
* With `failOnError` the behavior in case tests fail can be defined.
|
||||
* @possibleValues `true`, `false`
|
||||
@ -95,6 +97,7 @@ void call(Map parameters = [:]) {
|
||||
dockerImage: config.dockerImage,
|
||||
dockerName: config.dockerName,
|
||||
dockerWorkspace: config.dockerWorkspace,
|
||||
dockerOptions: config.dockerOptions,
|
||||
failOnError: config.failOnError,
|
||||
sidecarEnvVars: config.sidecarEnvVars,
|
||||
sidecarImage: config.sidecarImage,
|
||||
|
@ -21,6 +21,12 @@ import static com.sap.piper.Utils.downloadSettingsFromUrl
|
||||
'buildTarget',
|
||||
/** @see dockerExecute */
|
||||
'dockerImage',
|
||||
/** @see dockerExecute */
|
||||
'dockerEnvVars',
|
||||
/** @see dockerExecute */
|
||||
'dockerOptions',
|
||||
/** @see dockerExecute */
|
||||
'dockerWorkspace',
|
||||
/** The path to the extension descriptor file.*/
|
||||
'extension',
|
||||
/**
|
||||
@ -34,8 +40,6 @@ import static com.sap.piper.Utils.downloadSettingsFromUrl
|
||||
'projectSettingsFile'
|
||||
]
|
||||
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS.plus([
|
||||
/** @see dockerExecute */
|
||||
'dockerOptions',
|
||||
/** Url to the npm registry that should be used for installing npm dependencies.*/
|
||||
'defaultNpmRegistry'
|
||||
])
|
||||
@ -64,7 +68,13 @@ void call(Map parameters = [:]) {
|
||||
stepParam1: parameters?.script == null
|
||||
], configuration)
|
||||
|
||||
dockerExecute(script: script, dockerImage: configuration.dockerImage, dockerOptions: configuration.dockerOptions) {
|
||||
dockerExecute(
|
||||
script: script,
|
||||
dockerImage: configuration.dockerImage,
|
||||
dockerEnvVars: configuration.dockerEnvVars,
|
||||
dockerOptions: configuration.dockerOptions,
|
||||
dockerWorkspace: configuration.dockerWorkspace
|
||||
) {
|
||||
|
||||
String projectSettingsFile = configuration.projectSettingsFile?.trim()
|
||||
if (projectSettingsFile) {
|
||||
|
@ -14,6 +14,12 @@ import groovy.transform.Field
|
||||
@Field Set STEP_CONFIG_KEYS = [
|
||||
/** @see dockerExecute */
|
||||
'dockerImage',
|
||||
/** @see dockerExecute*/
|
||||
'dockerEnvVars',
|
||||
/** @see dockerExecute */
|
||||
'dockerOptions',
|
||||
/** @see dockerExecute*/
|
||||
'dockerWorkspace',
|
||||
/**
|
||||
* Defines the behavior, in case tests fail.
|
||||
* @possibleValues `true`, `false`
|
||||
@ -103,6 +109,9 @@ void call(Map parameters = [:]) {
|
||||
dockerExecute(
|
||||
script: script,
|
||||
dockerImage: config.dockerImage,
|
||||
dockerEnvVars: config.dockerEnvVars,
|
||||
dockerOptions: config.dockerOptions,
|
||||
dockerWorkspace: config.dockerWorkspace,
|
||||
stashContent: config.stashContent
|
||||
) {
|
||||
sh "NPM_CONFIG_PREFIX=~/.npm-global ${config.newmanInstallCommand}"
|
||||
|
@ -11,6 +11,12 @@ import groovy.transform.Field
|
||||
* Name of the docker image that should be used, in which node should be installed and configured. Default value is 'node:8-stretch'.
|
||||
*/
|
||||
'dockerImage',
|
||||
/** @see dockerExecute*/
|
||||
'dockerEnvVars',
|
||||
/** @see dockerExecute */
|
||||
'dockerOptions',
|
||||
/** @see dockerExecute*/
|
||||
'dockerWorkspace',
|
||||
/**
|
||||
* URL of default NPM registry
|
||||
*/
|
||||
@ -53,7 +59,12 @@ void call(Map parameters = [:], body = null) {
|
||||
if (!fileExists('package.json')) {
|
||||
error "[${STEP_NAME}] package.json is not found."
|
||||
}
|
||||
dockerExecute(script: script, dockerImage: configuration.dockerImage, dockerOptions: configuration.dockerOptions) {
|
||||
dockerExecute(script: script,
|
||||
dockerImage: configuration.dockerImage,
|
||||
dockerEnvVars: configuration.dockerEnvVars,
|
||||
dockerOptions: configuration.dockerOptions,
|
||||
dockerWorkspace: configuration.dockerWorkspace
|
||||
) {
|
||||
if (configuration.defaultNpmRegistry) {
|
||||
sh "npm config set registry ${configuration.defaultNpmRegistry}"
|
||||
}
|
||||
|
@ -26,6 +26,8 @@ import groovy.text.GStringTemplateEngine
|
||||
/** @see dockerExecute */
|
||||
'dockerName',
|
||||
/** @see dockerExecute */
|
||||
'dockerOptions',
|
||||
/** @see dockerExecute */
|
||||
'dockerWorkspace',
|
||||
/**
|
||||
* With `failOnError` the behavior in case tests fail can be defined.
|
||||
@ -103,6 +105,7 @@ void call(Map parameters = [:], Closure body) {
|
||||
dockerEnvVars: config.dockerEnvVars,
|
||||
dockerImage: config.dockerImage,
|
||||
dockerName: config.dockerName,
|
||||
dockerOptions: config.dockerOptions,
|
||||
dockerWorkspace: config.dockerWorkspace,
|
||||
sidecarEnvVars: config.sidecarEnvVars,
|
||||
sidecarImage: config.sidecarImage,
|
||||
|
@ -4,6 +4,7 @@ import com.sap.piper.ConfigurationHelper
|
||||
import com.sap.piper.GenerateDocumentation
|
||||
import com.sap.piper.Utils
|
||||
import com.sap.piper.mta.MtaMultiplexer
|
||||
import com.sap.piper.MapUtils
|
||||
|
||||
import groovy.transform.Field
|
||||
|
||||
@ -23,6 +24,12 @@ import groovy.transform.Field
|
||||
'buildDescriptorFile',
|
||||
/** @see dockerExecute */
|
||||
'dockerImage',
|
||||
/** @see dockerExecute*/
|
||||
'dockerEnvVars',
|
||||
/** @see dockerExecute */
|
||||
'dockerOptions',
|
||||
/** @see dockerExecute*/
|
||||
'dockerWorkspace',
|
||||
/**
|
||||
* Only scanType 'mta': Exclude modules from MTA projects.
|
||||
*/
|
||||
@ -103,8 +110,10 @@ void call(Map parameters = [:]) {
|
||||
dockerExecute(
|
||||
script: script,
|
||||
dockerImage: config.dockerImage,
|
||||
stashContent: config.stashContent,
|
||||
dockerEnvVars: ['SNYK_TOKEN': token]
|
||||
dockerEnvVars: MapUtils.merge(['SNYK_TOKEN': token],config.dockerEnvVars?:[:]),
|
||||
dockerWorkspace: config.dockerWorkspace,
|
||||
dockerOptions: config.dockerOptions,
|
||||
stashContent: config.stashContent
|
||||
) {
|
||||
// install Snyk
|
||||
sh 'npm install snyk --global --quiet'
|
||||
|
@ -117,6 +117,10 @@ import static com.sap.piper.Prerequisites.checkScript
|
||||
* Docker workspace to be used for scanning.
|
||||
*/
|
||||
'dockerWorkspace',
|
||||
/** @see dockerExecute*/
|
||||
'dockerEnvVars',
|
||||
/** @see dockerExecute */
|
||||
'dockerOptions',
|
||||
/**
|
||||
* Whether license compliance is considered and reported as part of the assessment.
|
||||
* @possibleValues `true`, `false`
|
||||
@ -246,6 +250,8 @@ void call(Map parameters = [:]) {
|
||||
.dependingOn('scanType').mixin('buildDescriptorFile')
|
||||
.dependingOn('scanType').mixin('dockerImage')
|
||||
.dependingOn('scanType').mixin('dockerWorkspace')
|
||||
.dependingOn('scanType').mixin('dockerOptions')
|
||||
.dependingOn('scanType').mixin('dockerEnvVars')
|
||||
.dependingOn('scanType').mixin('stashContent')
|
||||
.dependingOn('scanType').mixin('whitesource/configFilePath')
|
||||
.dependingOn('scanType').mixin('whitesource/installCommand')
|
||||
@ -369,7 +375,14 @@ private def triggerWhitesourceScanWithUserKey(script, config, utils, descriptorU
|
||||
script.commonPipelineEnvironment.getValue('whitesourceProjectNames').add(projectName)
|
||||
|
||||
WhitesourceConfigurationHelper.extendUAConfigurationFile(script, utils, config, path)
|
||||
dockerExecute(script: script, dockerImage: config.dockerImage, dockerWorkspace: config.dockerWorkspace, stashContent: config.stashContent) {
|
||||
dockerExecute(
|
||||
script: script,
|
||||
dockerImage: config.dockerImage,
|
||||
dockerEnvVars: config.dockerEnvVars,
|
||||
dockerOptions: config.dockerOptions,
|
||||
dockerWorkspace: config.dockerWorkspace,
|
||||
stashContent: config.stashContent
|
||||
) {
|
||||
if (config.whitesource.agentDownloadUrl) {
|
||||
def agentDownloadUrl = new GStringTemplateEngine().createTemplate(config.whitesource.agentDownloadUrl).make([config: config]).toString()
|
||||
//if agentDownloadUrl empty, rely on dockerImage to contain unifiedAgent correctly set up and available
|
||||
|
Loading…
Reference in New Issue
Block a user