1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-03-27 21:49:15 +02:00

fix(NPM): change NodeJS image to LTS (#1069)

* change NodeJS image to current LTS

* Update default_pipeline_environment.yml

* Update SonarExecuteScanTest.groovy

* use node:lts-stretch image
This commit is contained in:
Christopher Fenner 2020-01-29 11:17:56 +01:00 committed by GitHub
parent 7b95c04752
commit 92441577d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 27 additions and 27 deletions

View File

@ -27,7 +27,7 @@ func KarmaExecuteTestsCommand() *cobra.Command {
The step is using the ` + "`" + `seleniumExecuteTest` + "`" + ` step to spin up two containers in a Docker network:
* a Selenium/Chrome container (` + "`" + `selenium/standalone-chrome` + "`" + `)
* a NodeJS container (` + "`" + `node:8-stretch` + "`" + `)
* a NodeJS container (` + "`" + `node:lts-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 ` + "`" + `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)).

View File

@ -87,7 +87,7 @@ steps:
filePath: 'sbtDescriptor.json'
versioningTemplate: '${version}-${timestamp}${commitId?"+"+commitId:""}'
batsExecuteTests:
dockerImage: 'node:8-stretch'
dockerImage: 'node:lts-stretch'
dockerWorkspace: '/home/node'
envVars: {}
outputFormat: 'junit' # tap, junit
@ -260,7 +260,7 @@ steps:
runCommand: 'mvn test-compile gauge:execute'
testOptions: '-DspecsDir=specs'
npm:
dockerImage: 'node:8-stretch'
dockerImage: 'node:lts-stretch'
dockerName: 'npm'
dockerWorkspace: '/home/node'
languageRunner: 'js'
@ -308,13 +308,13 @@ steps:
dockerOptions: "-u 0 --entrypoint=''"
karmaExecuteTests:
containerPortMappings:
'node:8-stretch':
'node:lts-stretch':
- containerPort: 9876
hostPort: 9876
dockerEnvVars:
NO_PROXY: 'localhost,selenium,$NO_PROXY'
no_proxy: 'localhost,selenium,$no_proxy'
dockerImage: 'node:8-stretch'
dockerImage: 'node:lts-stretch'
dockerName: 'karma'
dockerWorkspace: '/home/node'
installCommand: 'npm install --quiet'
@ -354,7 +354,7 @@ steps:
credentialsId: 'CI_CREDENTIALS_ID'
newmanExecute:
dockerImage: 'node:8-stretch'
dockerImage: 'node:lts-stretch'
failOnError: true
newmanCollection: '**/*.postman_collection.json'
newmanEnvironment: ''
@ -364,7 +364,7 @@ steps:
stashContent:
- 'tests'
npmExecute:
dockerImage: 'node:8-stretch'
dockerImage: 'node:lts-stretch'
whitesourceExecuteScan:
createProductFromPipeline: true
emailAddressesOfInitialProductAdmins: []
@ -395,7 +395,7 @@ steps:
- 'opensourceConfiguration'
npm:
buildDescriptorFile: './package.json'
dockerImage: 'node:8-stretch'
dockerImage: 'node:lts-stretch'
dockerWorkspace: '/home/node'
stashContent:
- 'buildDescriptor'
@ -500,7 +500,7 @@ steps:
dockerName: 'maven'
dockerWorkspace: ''
npm:
dockerImage: 'node:8-stretch'
dockerImage: 'node:lts-stretch'
dockerName: 'npm'
dockerWorkspace: '/home/node'
bundler:
@ -512,7 +512,7 @@ steps:
defaultMessage: "${buildStatus}: Job ${env.JOB_NAME} <${env.BUILD_URL}|#${env.BUILD_NUMBER}>"
snykExecute:
buildDescriptorFile: './package.json'
dockerImage: 'node:8-stretch'
dockerImage: 'node:lts-stretch'
exclude: []
monitor: true
scanType: 'npm'
@ -522,7 +522,7 @@ steps:
toJson: false
toHtml: false
sonarExecuteScan:
dockerImage: 'node:8-stretch'
dockerImage: 'node:lts-stretch'
instance: 'SonarCloud'
options: []
pullRequestProvider: 'GitHub'

View File

@ -7,7 +7,7 @@ metadata:
The step is using the `seleniumExecuteTest` step to spin up two containers in a Docker network:
* a Selenium/Chrome container (`selenium/standalone-chrome`)
* a NodeJS container (`node:8-stretch`)
* a NodeJS container (`node:lts-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 `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)).
@ -53,7 +53,7 @@ spec:
#outputs:
containers:
- name: karma
image: node:8-stretch
image: node:lts-stretch
env:
- name: no_proxy
value: localhost,selenium,$no_proxy

View File

@ -61,7 +61,7 @@ class BatsExecuteTestsTest extends BasePiperTest {
assertThat(shellRule.shell, hasItem('bats-core/bin/bats --recursive --tap src/test > \'TEST-testPackage.tap\''))
assertThat(shellRule.shell, hasItem('cat \'TEST-testPackage.tap\''))
assertThat(dockerExecuteRule.dockerParams.dockerImage, is('node:8-stretch'))
assertThat(dockerExecuteRule.dockerParams.dockerImage, is('node:lts-stretch'))
assertThat(dockerExecuteRule.dockerParams.dockerWorkspace, is('/home/node'))
assertThat(shellRule.shell, hasItem('NPM_CONFIG_PREFIX=~/.npm-global npm install tap-xunit -g'))

View File

@ -106,7 +106,7 @@ class GaugeExecuteTestsTest extends BasePiperTest {
'gauge install js',
'gauge run testSpec'
])))
assertThat(seleniumParams.dockerImage, is('node:8-stretch'))
assertThat(seleniumParams.dockerImage, is('node:lts-stretch'))
assertThat(seleniumParams.dockerEnvVars, hasEntry('TARGET_SERVER_URL', 'http://custom.url'))
assertThat(seleniumParams.dockerName, is('npm'))
assertThat(seleniumParams.dockerWorkspace, is('/home/node'))

View File

@ -47,7 +47,7 @@ class KarmaExecuteTestsTest extends BasePiperTest {
containsString("cd '.' && npm install --quiet"),
containsString("cd '.' && npm run karma")
))
assertThat(seleniumParams.dockerImage, is('node:8-stretch'))
assertThat(seleniumParams.dockerImage, is('node:lts-stretch'))
assertThat(seleniumParams.dockerName, is('karma'))
assertThat(seleniumParams.dockerWorkspace, is('/home/node'))
assertJobStatusSuccess()

View File

@ -72,7 +72,7 @@ class NewmanExecuteTest extends BasePiperTest {
// asserts
assertThat(shellRule.shell, hasItem(endsWith('npm install newman newman-reporter-html --global --quiet')))
assertThat(shellRule.shell, hasItem(endsWith('newman run \'testCollection\' --environment \'testEnvironment\' --globals \'testGlobals\' --reporters junit,html --reporter-junit-export \'target/newman/TEST-testCollection.xml\' --reporter-html-export \'target/newman/TEST-testCollection.html\'')))
assertThat(dockerExecuteRule.dockerParams.dockerImage, is('node:8-stretch'))
assertThat(dockerExecuteRule.dockerParams.dockerImage, is('node:lts-stretch'))
assertThat(loggingRule.log, containsString('[newmanExecute] Found files [testCollection]'))
assertJobStatusSuccess()
}

View File

@ -36,8 +36,8 @@ class NpmExecuteTest extends BasePiperTest {
@Test
void testNpmExecute() {
stepRule.step.npmExecute(script: nullScript, dockerImage: 'node:8-stretch')
assertEquals 'node:8-stretch', dockerExecuteRule.dockerParams.dockerImage
stepRule.step.npmExecute(script: nullScript, dockerImage: 'node:lts-stretch')
assertEquals 'node:lts-stretch', dockerExecuteRule.dockerParams.dockerImage
}
@Test
@ -68,7 +68,7 @@ class NpmExecuteTest extends BasePiperTest {
@Test
void testNpmExecuteWithClosure() {
stepRule.step.npmExecute(script: nullScript, dockerImage: 'node:8-stretch', npmCommand: 'run build') { }
stepRule.step.npmExecute(script: nullScript, dockerImage: 'node:lts-stretch', npmCommand: 'run build') { }
assert shellRule.shell.find { c -> c.contains('npm run build') }
}
@ -77,6 +77,6 @@ class NpmExecuteTest extends BasePiperTest {
helper.registerAllowedMethod 'fileExists', [String], { false }
thrown.expect AbortException
thrown.expectMessage '[npmExecute] package.json is not found.'
stepRule.step.npmExecute(script: nullScript, dockerImage: 'node:8-stretch', npmCommand: 'run build')
stepRule.step.npmExecute(script: nullScript, dockerImage: 'node:lts-stretch', npmCommand: 'run build')
}
}

View File

@ -48,7 +48,7 @@ class SeleniumExecuteTestsTest extends BasePiperTest {
assertThat(bodyExecuted, is(true))
assertThat(dockerExecuteRule.dockerParams.containerPortMappings, is(['selenium/standalone-chrome': [[containerPort: 4444, hostPort: 4444]]]))
assertThat(dockerExecuteRule.dockerParams.dockerEnvVars, is(null))
assertThat(dockerExecuteRule.dockerParams.dockerImage, is('node:8-stretch'))
assertThat(dockerExecuteRule.dockerParams.dockerImage, is('node:lts-stretch'))
assertThat(dockerExecuteRule.dockerParams.dockerName, is('npm'))
assertThat(dockerExecuteRule.dockerParams.dockerWorkspace, is('/home/node'))
assertThat(dockerExecuteRule.dockerParams.sidecarEnvVars, is(null))

View File

@ -91,7 +91,7 @@ class SnykExecuteTest extends BasePiperTest {
)
assertThat(withCredentialsParameters.credentialsId, is('myPassword'))
assertThat(dockerExecuteRule.dockerParams, hasEntry('dockerImage', 'node:8-stretch'))
assertThat(dockerExecuteRule.dockerParams, hasEntry('dockerImage', 'node:lts-stretch'))
assertThat(dockerExecuteRule.dockerParams.stashContent, hasItem('buildDescriptor'))
assertThat(dockerExecuteRule.dockerParams.stashContent, hasItem('opensourceConfiguration'))
}

View File

@ -69,7 +69,7 @@ class SonarExecuteScanTest extends BasePiperTest {
// asserts
assertThat('Sonar instance is not set to the default value', sonarInstance, is('SonarCloud'))
assertThat('Sonar project version is not set to the default value', jscr.shell, hasItem(containsString('sonar-scanner -Dsonar.projectVersion=1')))
assertThat('Docker image is not set to the default value', jedr.dockerParams.dockerImage, is('node:8-stretch'))
assertThat('Docker image is not set to the default value', jedr.dockerParams.dockerImage, is('node:lts-stretch'))
assertJobStatusSuccess()
}

View File

@ -227,7 +227,7 @@ class WhitesourceExecuteScanTest extends BasePiperTest {
assertThat(loggingRule.log, containsString('Unstash content: buildDescriptor'))
assertThat(loggingRule.log, containsString('Unstash content: opensourceConfiguration'))
assertThat(dockerExecuteRule.dockerParams, hasEntry('dockerImage', 'node:8-stretch'))
assertThat(dockerExecuteRule.dockerParams, hasEntry('dockerImage', 'node:lts-stretch'))
assertThat(dockerExecuteRule.dockerParams, hasEntry('dockerWorkspace', '/home/node'))
assertThat(dockerExecuteRule.dockerParams, hasEntry('stashContent', ['buildDescriptor', 'opensourceConfiguration', 'modified whitesource config d3aa80454919391024374ba46b4df082d15ab9a3']))
assertThat(shellRule.shell, Matchers.hasItems(

View File

@ -65,7 +65,7 @@ import groovy.transform.Field
* The step is using the `seleniumExecuteTest` step to spin up two containers in a Docker network:
*
* * a Selenium/Chrome container (`selenium/standalone-chrome`)
* * a NodeJS container (`node:8-stretch`)
* * a NodeJS container (`node:lts-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 `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)).
*

View File

@ -8,7 +8,7 @@ import groovy.transform.Field
@Field Set GENERAL_CONFIG_KEYS = []
@Field Set STEP_CONFIG_KEYS = [
/**
* Name of the docker image that should be used, in which node should be installed and configured. Default value is 'node:8-stretch'.
* Name of the docker image that should be used, in which node should be installed and configured.
*/
'dockerImage',
/** @see dockerExecute*/