1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-09-16 09:26:22 +02:00

Publish TargetVector enhanced retry (#4971)

* cache Error, increase max polling duration

* Update abapAddonAssemblyKitPublishTargetVector_generated.go
This commit is contained in:
Tilo Körner
2024-06-24 14:49:40 +02:00
committed by GitHub
parent bf9c743fb6
commit b9022dc10d
3 changed files with 11 additions and 5 deletions

View File

@@ -143,7 +143,7 @@ func addAbapAddonAssemblyKitPublishTargetVectorFlags(cmd *cobra.Command, stepCon
cmd.Flags().StringVar(&stepConfig.Username, "username", os.Getenv("PIPER_username"), "User for the Addon Assembly Kit as a Service (AAKaaS) system")
cmd.Flags().StringVar(&stepConfig.Password, "password", os.Getenv("PIPER_password"), "Password for the Addon Assembly Kit as a Service (AAKaaS) system")
cmd.Flags().StringVar(&stepConfig.TargetVectorScope, "targetVectorScope", `T`, "Determines whether the Target Vector is published to the productive ('P') or test ('T') environment")
cmd.Flags().IntVar(&stepConfig.MaxRuntimeInMinutes, "maxRuntimeInMinutes", 16, "Maximum runtime for status polling in minutes")
cmd.Flags().IntVar(&stepConfig.MaxRuntimeInMinutes, "maxRuntimeInMinutes", 90, "Maximum runtime for status polling in minutes")
cmd.Flags().IntVar(&stepConfig.PollingIntervalInSeconds, "pollingIntervalInSeconds", 60, "Wait time in seconds between polling calls")
cmd.Flags().StringVar(&stepConfig.AddonDescriptor, "addonDescriptor", os.Getenv("PIPER_addonDescriptor"), "Structure in the commonPipelineEnvironment containing information about the Product Version and corresponding Software Component Versions")
cmd.Flags().StringVar(&stepConfig.AbapAddonAssemblyKitOriginHash, "abapAddonAssemblyKitOriginHash", os.Getenv("PIPER_abapAddonAssemblyKitOriginHash"), "Origin Hash for restricted AAKaaS scenarios")
@@ -241,7 +241,7 @@ func abapAddonAssemblyKitPublishTargetVectorMetadata() config.StepData {
Type: "int",
Mandatory: false,
Aliases: []config.Alias{},
Default: 16,
Default: 90,
},
{
Name: "pollingIntervalInSeconds",

View File

@@ -155,12 +155,17 @@ func (tv *TargetVector) GetTargetVector(conn *abapbuild.Connector) error {
// PollForStatus : Poll AAKaaS until final PublishStatus reached and check if desired Status was reached
func (tv *TargetVector) PollForStatus(conn *abapbuild.Connector, targetStatus TargetVectorStatus) error {
var cachedError error
timeout := time.After(conn.MaxRuntime)
ticker := time.Tick(conn.PollingInterval)
for {
select {
case <-timeout:
return errors.New("Timed out (AAKaaS target Vector Status change)")
if cachedError == nil {
return errors.New("Timed out (AAKaaS target Vector Status change)")
} else {
return cachedError
}
case <-ticker:
if err := tv.GetTargetVector(conn); err != nil {
return errors.Wrap(err, "Getting TargetVector status during polling resulted in an error")
@@ -172,7 +177,8 @@ func (tv *TargetVector) PollForStatus(conn *abapbuild.Connector, targetStatus Ta
if TargetVectorStatus(tv.Status) == targetStatus {
return nil
} else {
return errors.New("Publishing of Targetvector " + tv.ID + " resulted in state " + string(tv.Status) + " instead of expected state " + string(targetStatus))
cachedError = errors.New("Publishing of Targetvector " + tv.ID + " resulted in state " + string(tv.Status) + " instead of expected state " + string(targetStatus))
continue
}
case TargetVectorPublishStatusError:
return errors.New("Publishing of Targetvector " + tv.ID + " failed in AAKaaS")

View File

@@ -88,7 +88,7 @@ spec:
- STAGES
- STEPS
- GENERAL
default: 16
default: 90
- name: pollingIntervalInSeconds
type: int
description: Wait time in seconds between polling calls