mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-03-05 15:15:44 +02:00
TransportRequestUploadFile migration to Go - CTS (#3098)
* UploadFile CTS - migrate to GO implementation
This commit is contained in:
parent
86e8125279
commit
cacdb2b867
@ -179,7 +179,7 @@ func transportRequestUploadCTSMetadata() config.StepData {
|
|||||||
Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"},
|
Scope: []string{"PARAMETERS", "STAGES", "STEPS", "GENERAL"},
|
||||||
Type: "string",
|
Type: "string",
|
||||||
Mandatory: false,
|
Mandatory: false,
|
||||||
Aliases: []config.Alias{},
|
Aliases: []config.Alias{{Name: "applicationDescription"}},
|
||||||
Default: `Deployed with Piper based on SAP Fiori tools`,
|
Default: `Deployed with Piper based on SAP Fiori tools`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -18,6 +18,8 @@ spec:
|
|||||||
- name: description
|
- name: description
|
||||||
type: string
|
type: string
|
||||||
description: "The description of the application. The description is only taken into account for a new upload. In case of an update the description will not be updated."
|
description: "The description of the application. The description is only taken into account for a new upload. In case of an update the description will not be updated."
|
||||||
|
aliases:
|
||||||
|
- name: applicationDescription
|
||||||
default: "Deployed with Piper based on SAP Fiori tools"
|
default: "Deployed with Piper based on SAP Fiori tools"
|
||||||
scope:
|
scope:
|
||||||
- PARAMETERS
|
- PARAMETERS
|
||||||
|
@ -156,35 +156,18 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
|||||||
loggingRule.expect("[INFO] Uploading application 'myApp' to transport request '002'.")
|
loggingRule.expect("[INFO] Uploading application 'myApp' to transport request '002'.")
|
||||||
loggingRule.expect("[INFO] Application 'myApp' has been successfully uploaded to transport request '002'.")
|
loggingRule.expect("[INFO] Application 'myApp' has been successfully uploaded to transport request '002'.")
|
||||||
|
|
||||||
ChangeManagement cm = new ChangeManagement(nullScript) {
|
def calledWithParameters,
|
||||||
void uploadFileToTransportRequestCTS(
|
calledWithStepName,
|
||||||
Map docker,
|
calledWithMetadata,
|
||||||
String transportRequestId,
|
calledWithCredentials
|
||||||
String endpoint,
|
|
||||||
String client,
|
|
||||||
String appName,
|
|
||||||
String appDescription,
|
|
||||||
String abapPackage,
|
|
||||||
String osDeployUser,
|
|
||||||
def deployToolsDependencies,
|
|
||||||
def npmInstallArgs,
|
|
||||||
String deployConfigFile,
|
|
||||||
String credentialsId) {
|
|
||||||
|
|
||||||
cmUtilReceivedParams.docker = docker
|
helper.registerAllowedMethod('piperExecuteBin', [Map, String, String, List], {
|
||||||
cmUtilReceivedParams.transportRequestId = transportRequestId
|
params, stepName, metaData, creds ->
|
||||||
cmUtilReceivedParams.endpoint = endpoint
|
calledWithParameters = params
|
||||||
cmUtilReceivedParams.client = client
|
calledWithStepName = stepName
|
||||||
cmUtilReceivedParams.appName = appName
|
calledWithMetadata = metaData
|
||||||
cmUtilReceivedParams.appDescription = appDescription
|
calledWithCredentials = creds
|
||||||
cmUtilReceivedParams.abapPackage = abapPackage
|
})
|
||||||
cmUtilReceivedParams.osDeployUser = osDeployUser
|
|
||||||
cmUtilReceivedParams.deployToolDependencies = deployToolsDependencies
|
|
||||||
cmUtilReceivedParams.npmInstallOpts = npmInstallArgs
|
|
||||||
cmUtilReceivedParams.deployConfigFile = deployConfigFile
|
|
||||||
cmUtilReceivedParams.credentialsId = credentialsId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stepRule.step.transportRequestUploadFile(script: nullScript,
|
stepRule.step.transportRequestUploadFile(script: nullScript,
|
||||||
changeManagement: [
|
changeManagement: [
|
||||||
@ -200,28 +183,20 @@ public class TransportRequestUploadFileTest extends BasePiperTest {
|
|||||||
applicationDescription: 'the description',
|
applicationDescription: 'the description',
|
||||||
abapPackage: 'myPackage',
|
abapPackage: 'myPackage',
|
||||||
transportRequestId: '002',
|
transportRequestId: '002',
|
||||||
cmUtils: cm)
|
credentialsId: 'CM')
|
||||||
|
|
||||||
assert cmUtilReceivedParams ==
|
assertThat(calledWithStepName, is('transportRequestUploadCTS'))
|
||||||
[
|
assertThat(calledWithParameters.transportRequestId, is('002'))
|
||||||
docker: [
|
assertThat(calledWithParameters.endpoint, is('https://example.org/cm'))
|
||||||
image: 'node',
|
assertThat(calledWithParameters.client, is('001'))
|
||||||
options:[],
|
assertThat(calledWithParameters.applicationName, is('myApp'))
|
||||||
envVars:[:],
|
assertThat(calledWithParameters.description, is('the description'))
|
||||||
pullImage:true
|
assertThat(calledWithParameters.abapPackage, is('myPackage'))
|
||||||
],
|
assertThat(calledWithParameters.osDeployUser, is('node2'))
|
||||||
transportRequestId: '002',
|
assertThat(calledWithParameters.deployToolDependencies, is(['@ui5/cli', '@sap/ux-ui5-tooling', '@ui5/logger', '@ui5/fs', '@dummy/foo']))
|
||||||
endpoint: 'https://example.org/cm',
|
assertThat(calledWithParameters.npmInstallOpts, is(['--verbose']))
|
||||||
client: '001',
|
assertThat(calledWithParameters.deployConfigFile, is('ui5-deploy.yaml'))
|
||||||
appName: 'myApp',
|
assertThat(calledWithParameters.uploadCredentialsId, is('CM'))
|
||||||
appDescription: 'the description',
|
|
||||||
abapPackage: 'myPackage',
|
|
||||||
osDeployUser: 'node2',
|
|
||||||
deployToolDependencies: ['@ui5/cli', '@sap/ux-ui5-tooling', '@ui5/logger', '@ui5/fs', '@dummy/foo'],
|
|
||||||
npmInstallOpts: ['--verbose'],
|
|
||||||
deployConfigFile: 'ui5-deploy.yaml',
|
|
||||||
credentialsId: 'CM',
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -256,19 +256,18 @@ void call(Map parameters = [:]) {
|
|||||||
|
|
||||||
echo "[INFO] Uploading application '${configuration.applicationName}' to transport request '${configuration.transportRequestId}'."
|
echo "[INFO] Uploading application '${configuration.applicationName}' to transport request '${configuration.transportRequestId}'."
|
||||||
|
|
||||||
cm.uploadFileToTransportRequestCTS(
|
transportRequestUploadCTS(script: script,
|
||||||
configuration.changeManagement.cts?.nodeDocker ?: [:],
|
transportRequestId: configuration.transportRequestId,
|
||||||
configuration.transportRequestId,
|
endpoint: configuration.changeManagement.endpoint,
|
||||||
configuration.changeManagement.endpoint,
|
client: configuration.changeManagement.client,
|
||||||
configuration.changeManagement.client,
|
applicationName: configuration.applicationName,
|
||||||
configuration.applicationName,
|
description: configuration.applicationDescription,
|
||||||
configuration.applicationDescription,
|
abapPackage: configuration.abapPackage,
|
||||||
configuration.abapPackage,
|
osDeployUser: configuration.changeManagement.cts.osDeployUser,
|
||||||
configuration.changeManagement.cts.osDeployUser,
|
deployToolDependencies: configuration.changeManagement.cts.deployToolDependencies,
|
||||||
configuration.changeManagement.cts.deployToolDependencies,
|
npmInstallOpts: configuration.changeManagement.cts.npmInstallOpts,
|
||||||
configuration.changeManagement.cts.npmInstallOpts,
|
deployConfigFile: configuration.changeManagement.cts.deployConfigFile,
|
||||||
configuration.changeManagement.cts.deployConfigFile,
|
uploadCredentialsId: configuration.changeManagement.credentialsId)
|
||||||
configuration.changeManagement.credentialsId)
|
|
||||||
|
|
||||||
echo "[INFO] Application '${configuration.applicationName}' has been successfully uploaded to transport request '${configuration.transportRequestId}'."
|
echo "[INFO] Application '${configuration.applicationName}' has been successfully uploaded to transport request '${configuration.transportRequestId}'."
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user