You've already forked sap-jenkins-library
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:
@@ -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",
|
||||
|
@@ -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")
|
||||
|
@@ -88,7 +88,7 @@ spec:
|
||||
- STAGES
|
||||
- STEPS
|
||||
- GENERAL
|
||||
default: 16
|
||||
default: 90
|
||||
- name: pollingIntervalInSeconds
|
||||
type: int
|
||||
description: Wait time in seconds between polling calls
|
||||
|
Reference in New Issue
Block a user