From a41f652d64bdbf5fdfc10796ed20d17b2e945b8d Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Tue, 23 Oct 2018 13:58:48 +0200 Subject: [PATCH 01/14] add new step for karma execution --- vars/karmaExecuteTests.groovy | 73 +++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 vars/karmaExecuteTests.groovy diff --git a/vars/karmaExecuteTests.groovy b/vars/karmaExecuteTests.groovy new file mode 100644 index 00000000000..a68c036b754 --- /dev/null +++ b/vars/karmaExecuteTests.groovy @@ -0,0 +1,73 @@ +import com.sap.piper.ConfigurationHelper +import com.sap.piper.GitUtils +import com.sap.piper.Utils + +import groovy.text.SimpleTemplateEngine +import groovy.transform.Field + +@Field String STEP_NAME = 'karmaExecuteTests' +@Field Set STEP_CONFIG_KEYS = [ + 'containerPortMappings', //port mappings required for containers. This will only take effect inside a Kubernetes pod, format [[containerPort: 1111, hostPort: 1111]] + 'dockerEnvVars', //envVars to be set in the execution container if required + 'dockerImage', //Docker image for code execution + 'dockerName', //name of the Docker container. This will only take effect inside a Kubernetes pod. + 'dockerWorkspace', //user home directory for Docker execution. This will only take effect inside a Kubernetes pod. + 'failOnError', + 'installCommand', + 'modules', + 'sidecarEnvVars', //envVars to be set in Selenium container if required + 'sidecarImage', //image for Selenium execution which runs as sidecar to dockerImage + 'sidecarName', //name of the Selenium container. If not on Kubernetes pod, this will define the name of the link to the Selenium container and is thus required for accessing the server, example http://selenium:4444 (default) + 'sidecarVolumeBind', //volume bind. This will not take effect in Kubernetes pod. + 'stashContent', //list of stash names which are required to be unstashed before test run + 'testCommand' +] +@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS + +void call(Map parameters = [:]) { + handlePipelineStepErrors(stepName: STEP_NAME, stepParameters: parameters) { + def script = parameters?.script ?: [commonPipelineEnvironment: commonPipelineEnvironment] + def utils = parameters?.juStabUtils ?: new Utils() + + // load default & individual configuration + Map config = ConfigurationHelper.newInstance(this) + .loadStepDefaults() + .mixinGeneralConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS) + .mixinStepConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS) + .mixinStageConfig(script.commonPipelineEnvironment, parameters.stageName?:env.STAGE_NAME, STEP_CONFIG_KEYS) + .mixin(parameters, PARAMETER_KEYS) + .use() + + utils.pushToSWA([step: STEP_NAME], config) + + def testJobs = [:] + def options = [ + buildTool: 'npm', + containerPortMappings: config.containerPortMappings, + dockerEnvVars: config.dockerEnvVars, + dockerImage: config.dockerImage, + dockerName: config.dockerName, + dockerWorkspace: config.dockerWorkspace, + failOnError: config.failOnError, + sidecarEnvVars: config.sidecarEnvVars, + sidecarImage: config.sidecarImage, + sidecarName: config.sidecarName, + sidecarVolumeBind: config.sidecarVolumeBind, + stashContent: config.stashContent + ] + for(String path : config.modules){ + testJobs["Karma - ${path}"] = { + seleniumExecuteTests(options){ + sh "cd '${path}' && ${config.installCommand}" + sh "cd '${path}' && ${config.runCommand}" + } + } + } + + if(testJobs.size() == 1){ + testJobs.each({ key, value -> value() }) + }else{ + parallel testJobs.plus([failFast: false]) + } + } +} From 8eec29f1415cee868b53f8a0c8d828b8ee3d7611 Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Tue, 23 Oct 2018 14:00:38 +0200 Subject: [PATCH 02/14] add defaults --- resources/default_pipeline_environment.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/resources/default_pipeline_environment.yml b/resources/default_pipeline_environment.yml index 1d2502bc847..eb58e0b3b66 100644 --- a/resources/default_pipeline_environment.yml +++ b/resources/default_pipeline_environment.yml @@ -167,6 +167,18 @@ steps: healthEndpoint: '' influxWriteData: influxServer: 'jenkins' + karmaExecuteTests: + containerPortMappings: + 'node:8-stretch': + - containerPort: 9876 + hostPort: 9876 + dockerImage: 'node:8-stretch' + dockerName: 'karma' + dockerWorkspace: '/home/node' + installCommand: 'npm install --quiet' + modules: + - '.' + runCommand: 'npm run karma' mailSendNotification: notificationAttachment: true notifyCulprits: true From 9a260f163e64174ae9080d4fb113bd640d805143 Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Tue, 23 Oct 2018 15:12:59 +0200 Subject: [PATCH 03/14] Update karmaExecuteTests.groovy --- vars/karmaExecuteTests.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/vars/karmaExecuteTests.groovy b/vars/karmaExecuteTests.groovy index a68c036b754..09615415401 100644 --- a/vars/karmaExecuteTests.groovy +++ b/vars/karmaExecuteTests.groovy @@ -42,7 +42,6 @@ void call(Map parameters = [:]) { def testJobs = [:] def options = [ - buildTool: 'npm', containerPortMappings: config.containerPortMappings, dockerEnvVars: config.dockerEnvVars, dockerImage: config.dockerImage, From 2ebd7de4f7d8e5746aea940b1a3bfe7b7c03e3ad Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Tue, 23 Oct 2018 23:26:46 +0200 Subject: [PATCH 04/14] add key comments --- vars/karmaExecuteTests.groovy | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vars/karmaExecuteTests.groovy b/vars/karmaExecuteTests.groovy index 09615415401..7acb23f4a89 100644 --- a/vars/karmaExecuteTests.groovy +++ b/vars/karmaExecuteTests.groovy @@ -10,17 +10,17 @@ import groovy.transform.Field 'containerPortMappings', //port mappings required for containers. This will only take effect inside a Kubernetes pod, format [[containerPort: 1111, hostPort: 1111]] 'dockerEnvVars', //envVars to be set in the execution container if required 'dockerImage', //Docker image for code execution - 'dockerName', //name of the Docker container. This will only take effect inside a Kubernetes pod. + 'dockerName', //name of the Docker container. If not on Kubernetes pod, this will define the network-alias to the NPM container and is thus required for accessing the server, example http://karma:9876 (default). 'dockerWorkspace', //user home directory for Docker execution. This will only take effect inside a Kubernetes pod. 'failOnError', 'installCommand', 'modules', + 'runCommand', 'sidecarEnvVars', //envVars to be set in Selenium container if required 'sidecarImage', //image for Selenium execution which runs as sidecar to dockerImage - 'sidecarName', //name of the Selenium container. If not on Kubernetes pod, this will define the name of the link to the Selenium container and is thus required for accessing the server, example http://selenium:4444 (default) + 'sidecarName', //name of the Selenium container. If not on Kubernetes pod, this will define the network-alias to the Selenium container and is thus required for accessing the server, example http://selenium:4444 (default) 'sidecarVolumeBind', //volume bind. This will not take effect in Kubernetes pod. - 'stashContent', //list of stash names which are required to be unstashed before test run - 'testCommand' + 'stashContent' //list of stash names which are required to be unstashed before test run ] @Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS From a03d7f6a1c3442a857d928c7da8ddaa750a05db2 Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Tue, 23 Oct 2018 23:27:17 +0200 Subject: [PATCH 05/14] add test case --- test/groovy/KarmaExecuteTestsTest.groovy | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 test/groovy/KarmaExecuteTestsTest.groovy diff --git a/test/groovy/KarmaExecuteTestsTest.groovy b/test/groovy/KarmaExecuteTestsTest.groovy new file mode 100644 index 00000000000..d912c380f54 --- /dev/null +++ b/test/groovy/KarmaExecuteTestsTest.groovy @@ -0,0 +1,56 @@ +#!groovy +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.rules.ExpectedException +import org.junit.rules.RuleChain +import util.* + +import static org.hamcrest.Matchers.* +import static org.junit.Assert.assertThat + +class KarmaExecuteTestsTest extends BasePiperTest { + private JenkinsStepRule jsr = new JenkinsStepRule(this) + private JenkinsLoggingRule jlr = new JenkinsLoggingRule(this) + private JenkinsShellCallRule jscr = new JenkinsShellCallRule(this) + private JenkinsEnvironmentRule jer = new JenkinsEnvironmentRule(this) + private ExpectedException thrown = ExpectedException.none() + + @Rule + public RuleChain rules = Rules + .getCommonRules(this) + .around(new JenkinsReadYamlRule(this)) + .around(jscr) + .around(jlr) + .around(jer) + .around(jsr) + .around(thrown) + + def seleniumParams = [:] + + @Before + void init() throws Exception { + helper.registerAllowedMethod("unstash", [String.class], { s -> return [s]}) + + helper.registerAllowedMethod('seleniumExecuteTests', [Map.class, Closure.class], {map, body -> + seleniumParams = map + return body() + }) + } + + @Test + void testDefaults() throws Exception { + jsr.step.karmaExecuteTests( + script: nullScript, + juStabUtils: utils + ) + assertThat(jscr.shell, hasItems( + containsString("cd '.' && npm install --quiet"), + containsString("cd '.' && npm run karma") + )) + assertThat(seleniumParams.dockerImage, is('node:8-stretch')) + assertThat(seleniumParams.dockerName, is('karma')) + assertThat(seleniumParams.dockerWorkspace, is('/home/node')) + assertJobStatusSuccess() + } +} From 0ac33fa7ca0b2c164a724b0a91329ad4eced6d6b Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Tue, 23 Oct 2018 23:27:27 +0200 Subject: [PATCH 06/14] docs --- documentation/mkdocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/documentation/mkdocs.yml b/documentation/mkdocs.yml index 0947c28659c..6950f8afe6f 100644 --- a/documentation/mkdocs.yml +++ b/documentation/mkdocs.yml @@ -16,6 +16,7 @@ nav: - handlePipelineStepErrors: steps/handlePipelineStepErrors.md - healthExecuteCheck: steps/healthExecuteCheck.md - influxWriteData: steps/influxWriteData.md + - karmaExecuteTests: steps/karmaExecuteTests.md - mailSendNotification: steps/mailSendNotification.md - mavenExecute: steps/mavenExecute.md - mtaBuild: steps/mtaBuild.md From 8c930c2e7a17ab152c5b94202805d1b29410adfd Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Wed, 24 Oct 2018 08:54:40 +0200 Subject: [PATCH 07/14] add step docs --- documentation/docs/steps/karmaExecuteTests.md | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 documentation/docs/steps/karmaExecuteTests.md diff --git a/documentation/docs/steps/karmaExecuteTests.md b/documentation/docs/steps/karmaExecuteTests.md new file mode 100644 index 00000000000..e332c87b74e --- /dev/null +++ b/documentation/docs/steps/karmaExecuteTests.md @@ -0,0 +1,34 @@ +# karmaExecuteTests + +## Description +In this step the ([Karma test runner](http://karma-runner.github.io)) is executed. + +## Prerequisites +* **** - further description. + +## Parameters +| parameter | mandatory | default | possible values | +| ---------------|-----------|-----------------------------------|--------------------| +| | | | | + +* `` - Detailed description of each parameter. + +## Step configuration +The following parameters can also be specified as step parameters using the global configuration file: + +* `` + +## Return value +none + +## Side effects +Step uses `seleniumExecuteTest` & `dockerExecute` inside. + +## Exceptions +* `ExceptionType` + * List of cases when exception is thrown. + +## Example +```groovy + +``` From 5ac54043d19afcbb682031fdf138e1df15f6900d Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Sun, 28 Oct 2018 14:33:33 +0100 Subject: [PATCH 08/14] add step docs --- documentation/docs/steps/karmaExecuteTests.md | 44 +++++++++++++++---- vars/karmaExecuteTests.groovy | 5 ++- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/documentation/docs/steps/karmaExecuteTests.md b/documentation/docs/steps/karmaExecuteTests.md index e332c87b74e..4e358ecc76c 100644 --- a/documentation/docs/steps/karmaExecuteTests.md +++ b/documentation/docs/steps/karmaExecuteTests.md @@ -1,34 +1,62 @@ # karmaExecuteTests ## Description + In this step the ([Karma test runner](http://karma-runner.github.io)) is executed. +The step is using the `seleniumExecuteTest` step which spins up two containers in a Docker network: + - a Selenium container (`selenium/standalone-chrome`) + - a NodeJS container (`node:8-stretch`) +In the Docker network, the containers can be referenced by the values provided in `dockerName` and `sidecarName`, the default values are `karma` and `selenium`. These values must be used in the test configuration ([Karma `hostname`](https://karma-runner.github.io/1.0/config/configuration-file.html) and [WebDriver `hostname`](https://github.com/karma-runner/karma-webdriver-launcher#usage)). + +!!! note + In a Kubernetes environment, the containers both need to be referenced with `localhost`. + ## Prerequisites -* **** - further description. + +- **running Karma tests** - have a NPM module with running tests executed with Karma +- **configured WebDriver** - have the [`karma-webdriver-launcher`](https://github.com/karma-runner/karma-webdriver-launcher) package installed and a custom, WebDriver-based browser configured in Karma ## Parameters -| parameter | mandatory | default | possible values | -| ---------------|-----------|-----------------------------------|--------------------| -| | | | | + +| parameter | mandatory | default | possible values | +| ----------|-----------|---------|-----------------| +|script|yes||| +|containerPortMappings|no|`[node:8-stretch: [[containerPort: 9876, hostPort: 9876]]]`|| +|dockerEnvVars|no||| +|dockerImage|no|`node:8-stretch`|| +|dockerName|no|`karma`|| +|dockerWorkspace|no|`/home/node`|| +|failOnError|no||| +|installCommand|no|`npm install --quiet`|| +|modules|no|`['.']`|| +|runCommand|no|`npm run karma`|| +|sidecarEnvVars|no||| +|sidecarImage|no||| +|sidecarName|no||| +|sidecarVolumeBind|no||| +|stashContent|no||| * `` - Detailed description of each parameter. ## Step configuration -The following parameters can also be specified as step parameters using the global configuration file: * `` ## Return value + none ## Side effects + Step uses `seleniumExecuteTest` & `dockerExecute` inside. ## Exceptions -* `ExceptionType` - * List of cases when exception is thrown. + +none ## Example -```groovy +```groovy +karmaExecuteTests script: this, modules: ['./shoppinglist', './catalog'] ``` diff --git a/vars/karmaExecuteTests.groovy b/vars/karmaExecuteTests.groovy index 7acb23f4a89..7333fbe43fd 100644 --- a/vars/karmaExecuteTests.groovy +++ b/vars/karmaExecuteTests.groovy @@ -6,7 +6,7 @@ import groovy.text.SimpleTemplateEngine import groovy.transform.Field @Field String STEP_NAME = 'karmaExecuteTests' -@Field Set STEP_CONFIG_KEYS = [ +@Field Set GENERAL_CONFIG_KEYS = [ 'containerPortMappings', //port mappings required for containers. This will only take effect inside a Kubernetes pod, format [[containerPort: 1111, hostPort: 1111]] 'dockerEnvVars', //envVars to be set in the execution container if required 'dockerImage', //Docker image for code execution @@ -22,6 +22,7 @@ import groovy.transform.Field 'sidecarVolumeBind', //volume bind. This will not take effect in Kubernetes pod. 'stashContent' //list of stash names which are required to be unstashed before test run ] +@Field Set STEP_CONFIG_KEYS = GENERAL_CONFIG_KEYS @Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS void call(Map parameters = [:]) { @@ -32,7 +33,7 @@ void call(Map parameters = [:]) { // load default & individual configuration Map config = ConfigurationHelper.newInstance(this) .loadStepDefaults() - .mixinGeneralConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS) + .mixinGeneralConfig(script.commonPipelineEnvironment, GENERAL_CONFIG_KEYS) .mixinStepConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS) .mixinStageConfig(script.commonPipelineEnvironment, parameters.stageName?:env.STAGE_NAME, STEP_CONFIG_KEYS) .mixin(parameters, PARAMETER_KEYS) From 1728612c26aa828e92bf00a2124173f6f3e2ecad Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Sun, 28 Oct 2018 14:38:43 +0100 Subject: [PATCH 09/14] Update karmaExecuteTests.md --- documentation/docs/steps/karmaExecuteTests.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/docs/steps/karmaExecuteTests.md b/documentation/docs/steps/karmaExecuteTests.md index 4e358ecc76c..8154f9af604 100644 --- a/documentation/docs/steps/karmaExecuteTests.md +++ b/documentation/docs/steps/karmaExecuteTests.md @@ -4,8 +4,8 @@ In this step the ([Karma test runner](http://karma-runner.github.io)) is executed. -The step is using the `seleniumExecuteTest` step which spins up two containers in a Docker network: - - a Selenium container (`selenium/standalone-chrome`) +The step is using the `seleniumExecuteTest` step to spins up two containers in a Docker network: + - a Selenium/Chrome container (`selenium/standalone-chrome`) - a NodeJS container (`node:8-stretch`) In the Docker network, the containers can be referenced by the values provided in `dockerName` and `sidecarName`, the default values are `karma` and `selenium`. These values must be used in the test configuration ([Karma `hostname`](https://karma-runner.github.io/1.0/config/configuration-file.html) and [WebDriver `hostname`](https://github.com/karma-runner/karma-webdriver-launcher#usage)). From 2fa51195ec563e390818dec9313c560ab2f09fda Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Mon, 5 Nov 2018 11:31:37 +0100 Subject: [PATCH 10/14] complete docs --- documentation/docs/steps/karmaExecuteTests.md | 44 +++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/documentation/docs/steps/karmaExecuteTests.md b/documentation/docs/steps/karmaExecuteTests.md index 8154f9af604..4e739fd986d 100644 --- a/documentation/docs/steps/karmaExecuteTests.md +++ b/documentation/docs/steps/karmaExecuteTests.md @@ -5,8 +5,10 @@ In this step the ([Karma test runner](http://karma-runner.github.io)) is executed. The step is using the `seleniumExecuteTest` step to spins up two containers in a Docker network: - - a Selenium/Chrome container (`selenium/standalone-chrome`) - - a NodeJS container (`node:8-stretch`) + +- a Selenium/Chrome container (`selenium/standalone-chrome`) +- a NodeJS container (`node:8-stretch`) + In the Docker network, the containers can be referenced by the values provided in `dockerName` and `sidecarName`, the default values are `karma` and `selenium`. These values must be used in the test configuration ([Karma `hostname`](https://karma-runner.github.io/1.0/config/configuration-file.html) and [WebDriver `hostname`](https://github.com/karma-runner/karma-webdriver-launcher#usage)). !!! note @@ -37,11 +39,45 @@ In the Docker network, the containers can be referenced by the values provided i |sidecarVolumeBind|no||| |stashContent|no||| -* `` - Detailed description of each parameter. +- `script` - defines the global script environment of the Jenkinsfile run. Typically `this` is passed to this parameter. This allows the function to access the [`commonPipelineEnvironment`](commonPipelineEnvironment.md) for storing the measured duration. +- `containerPortMappings` - see step [dockerExecute](dockerExecute.md) +- `dockerEnvVars` - see step [dockerExecute](dockerExecute.md) +- `dockerImage` - see step [dockerExecute](dockerExecute.md) +- `dockerName` - see step [dockerExecute](dockerExecute.md) +- `dockerWorkspace` - see step [dockerExecute](dockerExecute.md) +- `failOnError` - see step [seleniumExecuteTests](seleniumExecuteTests.md) +- `installCommand` - the command that is executed to install dependencies +- `modules` - define the paths of the modules to execute tests on +- `runCommand` - the command that is executed to start the tests +- `sidecarEnvVars` - see step [dockerExecute](dockerExecute.md) +- `sidecarImage` - see step [dockerExecute](dockerExecute.md) +- `sidecarName` - see step [dockerExecute](dockerExecute.md) +- `sidecarVolumeBind` - see step [dockerExecute](dockerExecute.md) +- `stashContent` - pass specific stashed that should be considered for the tests ## Step configuration -* `` +We recommend to define values of step parameters via [config.yml file](../configuration.md). + +In following sections the configuration is possible: + +| parameter | general | step | stage | +| ----------|---------|------|-------| +|script|||| +|containerPortMappings|X|X|X| +|dockerEnvVars|X|X|X| +|dockerImage|X|X|X| +|dockerName|X|X|X| +|dockerWorkspace|X|X|X| +|failOnError|X|X|X| +|installCommand|X|X|X| +|modules|X|X|X| +|runCommand|X|X|X| +|sidecarEnvVars|X|X|X| +|sidecarImage|X|X|X| +|sidecarName|X|X|X| +|sidecarVolumeBind|X|X|X| +|stashContent|X|X|X| ## Return value From 2d9506abddca54bb5be09b207ea8b915ade359c6 Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Mon, 5 Nov 2018 11:43:58 +0100 Subject: [PATCH 11/14] Update karmaExecuteTests.md --- documentation/docs/steps/karmaExecuteTests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/steps/karmaExecuteTests.md b/documentation/docs/steps/karmaExecuteTests.md index 4e739fd986d..764b7ed3a2b 100644 --- a/documentation/docs/steps/karmaExecuteTests.md +++ b/documentation/docs/steps/karmaExecuteTests.md @@ -9,7 +9,7 @@ The step is using the `seleniumExecuteTest` step to spins up two containers in a - a Selenium/Chrome container (`selenium/standalone-chrome`) - a NodeJS container (`node:8-stretch`) -In the Docker network, the containers can be referenced by the values provided in `dockerName` and `sidecarName`, the default values are `karma` and `selenium`. These values must be used in the test configuration ([Karma `hostname`](https://karma-runner.github.io/1.0/config/configuration-file.html) and [WebDriver `hostname`](https://github.com/karma-runner/karma-webdriver-launcher#usage)). +In the Docker network, the containers can be referenced by the values provided in `dockerName` and `sidecarName`, the default values are `karma` and `selenium`. These values must be used in the `hostname` properties of the test configuration ([Karma](https://karma-runner.github.io/1.0/config/configuration-file.html) and [WebDriver](https://github.com/karma-runner/karma-webdriver-launcher#usage)). !!! note In a Kubernetes environment, the containers both need to be referenced with `localhost`. From ebb59fad3670bc7b4c1eb7d93201dab9d3290147 Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Mon, 5 Nov 2018 16:08:05 +0100 Subject: [PATCH 12/14] init `script` the "new way" --- vars/karmaExecuteTests.groovy | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vars/karmaExecuteTests.groovy b/vars/karmaExecuteTests.groovy index 7333fbe43fd..8d7e06a9fdd 100644 --- a/vars/karmaExecuteTests.groovy +++ b/vars/karmaExecuteTests.groovy @@ -1,3 +1,5 @@ +import static com.sap.piper.Prerequisites.checkScript + import com.sap.piper.ConfigurationHelper import com.sap.piper.GitUtils import com.sap.piper.Utils @@ -27,7 +29,7 @@ import groovy.transform.Field void call(Map parameters = [:]) { handlePipelineStepErrors(stepName: STEP_NAME, stepParameters: parameters) { - def script = parameters?.script ?: [commonPipelineEnvironment: commonPipelineEnvironment] + final script = checkScript(this, parameters) ?: this def utils = parameters?.juStabUtils ?: new Utils() // load default & individual configuration From 158e53c17c368a15376fb8ceb266588aa202ff05 Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Mon, 5 Nov 2018 16:12:03 +0100 Subject: [PATCH 13/14] Update karmaExecuteTests.groovy --- vars/karmaExecuteTests.groovy | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/vars/karmaExecuteTests.groovy b/vars/karmaExecuteTests.groovy index 8d7e06a9fdd..f38066caf8c 100644 --- a/vars/karmaExecuteTests.groovy +++ b/vars/karmaExecuteTests.groovy @@ -9,20 +9,20 @@ import groovy.transform.Field @Field String STEP_NAME = 'karmaExecuteTests' @Field Set GENERAL_CONFIG_KEYS = [ - 'containerPortMappings', //port mappings required for containers. This will only take effect inside a Kubernetes pod, format [[containerPort: 1111, hostPort: 1111]] - 'dockerEnvVars', //envVars to be set in the execution container if required - 'dockerImage', //Docker image for code execution - 'dockerName', //name of the Docker container. If not on Kubernetes pod, this will define the network-alias to the NPM container and is thus required for accessing the server, example http://karma:9876 (default). - 'dockerWorkspace', //user home directory for Docker execution. This will only take effect inside a Kubernetes pod. + 'containerPortMappings', /** port mappings required for containers. This will only take effect inside a Kubernetes pod, format [[containerPort: 1111, hostPort: 1111]] */ + 'dockerEnvVars', /** envVars to be set in the execution container if required */ + 'dockerImage', /** Docker image for code execution */ + 'dockerName', /** name of the Docker container. If not on Kubernetes pod, this will define the network-alias to the NPM container and is thus required for accessing the server, example http://karma:9876 (default). */ + 'dockerWorkspace', /** user home directory for Docker execution. This will only take effect inside a Kubernetes pod. */ 'failOnError', 'installCommand', 'modules', 'runCommand', - 'sidecarEnvVars', //envVars to be set in Selenium container if required - 'sidecarImage', //image for Selenium execution which runs as sidecar to dockerImage - 'sidecarName', //name of the Selenium container. If not on Kubernetes pod, this will define the network-alias to the Selenium container and is thus required for accessing the server, example http://selenium:4444 (default) - 'sidecarVolumeBind', //volume bind. This will not take effect in Kubernetes pod. - 'stashContent' //list of stash names which are required to be unstashed before test run + 'sidecarEnvVars', /** envVars to be set in Selenium container if required */ + 'sidecarImage', /** image for Selenium execution which runs as sidecar to dockerImage */ + 'sidecarName', /** name of the Selenium container. If not on Kubernetes pod, this will define the network-alias to the Selenium container and is thus required for accessing the server, example http://selenium:4444 (default) */ + 'sidecarVolumeBind', /** volume bind. This will not take effect in Kubernetes pod. */ + 'stashContent' /** list of stash names which are required to be unstashed before test run */ ] @Field Set STEP_CONFIG_KEYS = GENERAL_CONFIG_KEYS @Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS From ee8ba59d2039713eb13b160ba1eb7da7450d772e Mon Sep 17 00:00:00 2001 From: Christopher Fenner Date: Mon, 5 Nov 2018 16:21:25 +0100 Subject: [PATCH 14/14] Update karmaExecuteTests.groovy --- vars/karmaExecuteTests.groovy | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/vars/karmaExecuteTests.groovy b/vars/karmaExecuteTests.groovy index f38066caf8c..2743ea86619 100644 --- a/vars/karmaExecuteTests.groovy +++ b/vars/karmaExecuteTests.groovy @@ -9,20 +9,30 @@ import groovy.transform.Field @Field String STEP_NAME = 'karmaExecuteTests' @Field Set GENERAL_CONFIG_KEYS = [ - 'containerPortMappings', /** port mappings required for containers. This will only take effect inside a Kubernetes pod, format [[containerPort: 1111, hostPort: 1111]] */ - 'dockerEnvVars', /** envVars to be set in the execution container if required */ - 'dockerImage', /** Docker image for code execution */ - 'dockerName', /** name of the Docker container. If not on Kubernetes pod, this will define the network-alias to the NPM container and is thus required for accessing the server, example http://karma:9876 (default). */ - 'dockerWorkspace', /** user home directory for Docker execution. This will only take effect inside a Kubernetes pod. */ + /** port mappings required for containers. This will only take effect inside a Kubernetes pod, format [[containerPort: 1111, hostPort: 1111]] */ + 'containerPortMappings', + /** envVars to be set in the execution container if required */ + 'dockerEnvVars', + /** Docker image for code execution */ + 'dockerImage', + /** name of the Docker container. If not on Kubernetes pod, this will define the network-alias to the NPM container and is thus required for accessing the server, example http://karma:9876 (default). */ + 'dockerName', + /** user home directory for Docker execution. This will only take effect inside a Kubernetes pod. */ + 'dockerWorkspace', 'failOnError', 'installCommand', 'modules', 'runCommand', - 'sidecarEnvVars', /** envVars to be set in Selenium container if required */ - 'sidecarImage', /** image for Selenium execution which runs as sidecar to dockerImage */ - 'sidecarName', /** name of the Selenium container. If not on Kubernetes pod, this will define the network-alias to the Selenium container and is thus required for accessing the server, example http://selenium:4444 (default) */ - 'sidecarVolumeBind', /** volume bind. This will not take effect in Kubernetes pod. */ - 'stashContent' /** list of stash names which are required to be unstashed before test run */ + /** envVars to be set in Selenium container if required */ + 'sidecarEnvVars', + /** image for Selenium execution which runs as sidecar to dockerImage */ + 'sidecarImage', + /** name of the Selenium container. If not on Kubernetes pod, this will define the network-alias to the Selenium container and is thus required for accessing the server, example http://selenium:4444 (default) */ + 'sidecarName', + /** volume bind. This will not take effect in Kubernetes pod. */ + 'sidecarVolumeBind', + /** list of stash names which are required to be unstashed before test run */ + 'stashContent' ] @Field Set STEP_CONFIG_KEYS = GENERAL_CONFIG_KEYS @Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS