1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

Fix step not showing error status (#2758)

* Expose error to step

* Adapt to codeclimate
This commit is contained in:
Daniel Mieg 2021-04-14 09:31:50 +02:00 committed by GitHub
parent b8e9201df5
commit 3c9f993101
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,35 +39,32 @@ func runAbapEnvironmentCreateSystem(config *abapEnvironmentCreateSystemOptions,
Password: config.Password, Password: config.Password,
ServiceManifest: config.ServiceManifest, ServiceManifest: config.ServiceManifest,
} }
runCloudFoundryCreateService(&createServiceConfig, telemetryData, cf) return runCloudFoundryCreateService(&createServiceConfig, telemetryData, cf)
} else { }
// if no manifest file is provided, it is created with the provided config values // if no manifest file is provided, it is created with the provided config values
manifestYAML, err := generateManifestYAML(config) manifestYAML, err := generateManifestYAML(config)
// writing the yaml into a temporary file // writing the yaml into a temporary file
path, _ := os.Getwd() path, _ := os.Getwd()
path = path + "/generated_service_manifest-" + u.getUUID() + ".yml" path = path + "/generated_service_manifest-" + u.getUUID() + ".yml"
log.Entry().Debugf("Path: %s", path) log.Entry().Debugf("Path: %s", path)
err = ioutil.WriteFile(path, manifestYAML, 0644) err = ioutil.WriteFile(path, manifestYAML, 0644)
if err != nil { if err != nil {
return fmt.Errorf("%s: %w", "Could not generate manifest file for the cloud foundry cli", err) return fmt.Errorf("%s: %w", "Could not generate manifest file for the cloud foundry cli", err)
}
defer os.Remove(path)
// Calling cloudFoundryCreateService with the respective parameters
createServiceConfig := cloudFoundryCreateServiceOptions{
CfAPIEndpoint: config.CfAPIEndpoint,
CfOrg: config.CfOrg,
CfSpace: config.CfSpace,
Username: config.Username,
Password: config.Password,
ServiceManifest: path,
}
runCloudFoundryCreateService(&createServiceConfig, telemetryData, cf)
} }
return nil defer os.Remove(path)
// Calling cloudFoundryCreateService with the respective parameters
createServiceConfig := cloudFoundryCreateServiceOptions{
CfAPIEndpoint: config.CfAPIEndpoint,
CfOrg: config.CfOrg,
CfSpace: config.CfSpace,
Username: config.Username,
Password: config.Password,
ServiceManifest: path,
}
return runCloudFoundryCreateService(&createServiceConfig, telemetryData, cf)
} }
func generateManifestYAML(config *abapEnvironmentCreateSystemOptions) ([]byte, error) { func generateManifestYAML(config *abapEnvironmentCreateSystemOptions) ([]byte, error) {