1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-01-20 05:19:40 +02:00

Enable configuration of npm registry for mtaBuild

This commit is contained in:
Florian Geckeler 2019-05-09 08:51:11 +02:00 committed by GitHub
parent e20eb3c320
commit 79b55cc064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -210,6 +210,14 @@ public class MtaBuildTest extends BasePiperTest {
assert shellRule.shell.find(){ c -> c.contains('cp settings.xml $M2_HOME/conf/settings.xml')}
}
@Test
void canConfigureNpmRegistry() {
stepRule.step.mtaBuild(script: nullScript, defaultNpmRegistry: 'myNpmRegistry.com')
assert shellRule.shell.find(){ c -> c.contains('npm config set registry myNpmRegistry.com')}
}
@Test
void canConfigureMavenGlobalSettingsFromRemoteSource() {

View File

@ -35,7 +35,9 @@ import static com.sap.piper.Utils.downloadSettingsFromUrl
]
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS.plus([
/** @see dockerExecute */
'dockerOptions'
'dockerOptions',
/** Url to the npm registry that should be used for installing npm dependencies.*/
'defaultNpmRegistry'
])
/**
@ -81,6 +83,11 @@ void call(Map parameters = [:]) {
sh "cp ${globalSettingsFile} \$M2_HOME/conf/settings.xml"
}
String defaultNpmRegistry = configuration.defaultNpmRegistry?.trim()
if (defaultNpmRegistry) {
sh "npm config set registry $defaultNpmRegistry"
}
def mtaYamlName = "mta.yaml"
def applicationName = configuration.applicationName