1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-10-30 23:57:50 +02:00

Fix mta buildtool error (#4243)

* Fix indentation

* Fix type

* Exclude mta build tool from throwing error

* Update log message

* Add test case
This commit is contained in:
Srinikitha Kondreddy
2023-02-24 11:09:42 +01:00
committed by GitHub
parent 7e7182d3fe
commit 1536362a50
3 changed files with 17 additions and 5 deletions

View File

@@ -36,11 +36,11 @@ parameters:
modules:
- name: {{.ApplicationName}}
type: html5
type: com.sap.hcp.html5
path: .
parameters:
version: {{.Version}}-${timestamp}
name: {{.ApplicationName}}
version: {{.Version}}-${timestamp}
name: {{.ApplicationName}}
build-parameters:
builder: grunt
build-result: dist`
@@ -415,7 +415,7 @@ func getTimestamp() string {
func createMtaYamlFile(mtaYamlFile, applicationName string, utils mtaBuildUtils) error {
log.Entry().Debugf("mta yaml file not found in project sources.")
log.Entry().Infof("\"%s\" file not found in project sources", mtaYamlFile)
if len(applicationName) == 0 {
return fmt.Errorf("'%[1]s' not found in project sources and 'applicationName' not provided as parameter - cannot generate '%[1]s' file", mtaYamlFile)

View File

@@ -127,6 +127,18 @@ class PiperPipelineStageInitTest extends BasePiperTest {
)
}
@Test
void testInitMtaBuildToolDoesNotThrowException() {
jsr.step.piperPipelineStageInit(
script: nullScript,
juStabUtils: utils,
buildTool: 'mta',
stashSettings: 'com.sap.piper/pipeline/stashSettings.yml'
)
assertThat(stepsCalled, hasItems('checkout', 'setupCommonPipelineEnvironment', 'piperInitRunStageConfiguration', 'artifactPrepareVersion', 'pipelineStashFilesBeforeBuild'))
}
@Test
void testInitDefault() {

View File

@@ -302,7 +302,7 @@ private String inferProjectName(Script script, String buildTool, String buildToo
}
private checkBuildTool(String buildTool, String buildDescriptorPattern) {
if (buildDescriptorPattern && !findFiles(glob: buildDescriptorPattern)) {
if (buildTool != "mta" && !findFiles(glob: buildDescriptorPattern)) {
error "[${STEP_NAME}] buildTool configuration '${buildTool}' does not fit to your project (buildDescriptorPattern: '${buildDescriptorPattern}'), please set buildTool as general setting in your .pipeline/config.yml correctly, see also https://sap.github.io/jenkins-library/configuration/"
}
}