fix: pipeline fixes
[skip ci]
This commit is contained in:
parent
3309489612
commit
944ced15f3
1 changed files with 15 additions and 13 deletions
|
|
@ -161,27 +161,27 @@ func CreateInstanceWaitHandler(
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
// Sleep before wait is set because sometimes API returns 404 right after creation request
|
// Sleep before wait is set because sometimes API returns 404 right after creation request
|
||||||
// handler.SetTimeout(90 * time.Minute).SetSleepBeforeWait(30 * time.Second)
|
handler.SetTimeout(90 * time.Minute).SetSleepBeforeWait(30 * time.Second)
|
||||||
return handler
|
return handler
|
||||||
}
|
}
|
||||||
|
|
||||||
// PartialUpdateInstanceWaitHandler will wait for instance update
|
// PartialUpdateInstanceWaitHandler will wait for instance update
|
||||||
func PartialUpdateInstanceWaitHandler(
|
func PartialUpdateInstanceWaitHandler(
|
||||||
ctx context.Context, a APIClientInstanceInterface, projectId, region,
|
ctx context.Context, a APIClientInstanceInterface, projectID, region,
|
||||||
instanceId string,
|
instanceID string,
|
||||||
) *wait.AsyncActionHandler[v3alpha1api.GetInstanceResponse] {
|
) *wait.AsyncActionHandler[v3alpha1api.GetInstanceResponse] {
|
||||||
handler := wait.New(
|
handler := wait.New(
|
||||||
func() (waitFinished bool, response *v3alpha1api.GetInstanceResponse, err error) {
|
func() (waitFinished bool, response *v3alpha1api.GetInstanceResponse, err error) {
|
||||||
s, err := a.GetInstanceRequest(ctx, projectId, region, instanceId).Execute()
|
s, err := a.GetInstanceRequest(ctx, projectID, region, instanceID).Execute()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, nil, err
|
return false, nil, err
|
||||||
}
|
}
|
||||||
if s == nil || s.Id != instanceId {
|
if s == nil || s.Id != instanceID {
|
||||||
return false, nil, nil
|
return false, nil, nil
|
||||||
}
|
}
|
||||||
switch s.Status {
|
switch s.Status {
|
||||||
default:
|
default:
|
||||||
return true, s, fmt.Errorf("instance with id %s has unexpected status %s", instanceId, s.Status)
|
return true, s, fmt.Errorf("instance with id %s has unexpected status %s", instanceID, s.Status)
|
||||||
case InstanceStateEmpty:
|
case InstanceStateEmpty:
|
||||||
return false, nil, nil
|
return false, nil, nil
|
||||||
case InstanceStatePending:
|
case InstanceStatePending:
|
||||||
|
|
@ -195,7 +195,7 @@ func PartialUpdateInstanceWaitHandler(
|
||||||
case InstanceStateUnknown:
|
case InstanceStateUnknown:
|
||||||
return false, nil, nil
|
return false, nil, nil
|
||||||
case InstanceStateFailed:
|
case InstanceStateFailed:
|
||||||
return true, s, fmt.Errorf("update got status FAILURE for instance with id %s", instanceId)
|
return true, s, fmt.Errorf("update got status FAILURE for instance with id %s", instanceID)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
@ -290,14 +290,14 @@ func GetDatabaseByIdWaitHandler(
|
||||||
func DeleteInstanceWaitHandler(
|
func DeleteInstanceWaitHandler(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
a APIClientInstanceInterface,
|
a APIClientInstanceInterface,
|
||||||
projectId,
|
projectID,
|
||||||
region,
|
region,
|
||||||
instanceId string,
|
instanceID string,
|
||||||
timeout, sleepBeforeWait time.Duration,
|
timeout, sleepBeforeWait time.Duration,
|
||||||
) error {
|
) error {
|
||||||
handler := wait.New(
|
handler := wait.New(
|
||||||
func() (waitFinished bool, response *v3alpha1api.GetInstanceResponse, err error) {
|
func() (waitFinished bool, response *v3alpha1api.GetInstanceResponse, err error) {
|
||||||
s, err := a.GetInstanceRequest(ctx, projectId, region, instanceId).Execute()
|
s, err := a.GetInstanceRequest(ctx, projectID, region, instanceID).Execute()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
oapiErr, ok := err.(*oapierror.GenericOpenAPIError) // nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped
|
oapiErr, ok := err.(*oapierror.GenericOpenAPIError) // nolint:errorlint //complaining that error.As should be used to catch wrapped errors, but this error should not be wrapped
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
@ -314,12 +314,14 @@ func DeleteInstanceWaitHandler(
|
||||||
case InstanceStateEmpty, InstanceStatePending, InstanceStateUnknown, InstanceStateProgressing, InstanceStateSuccess:
|
case InstanceStateEmpty, InstanceStatePending, InstanceStateUnknown, InstanceStateProgressing, InstanceStateSuccess:
|
||||||
return false, nil, nil
|
return false, nil, nil
|
||||||
case InstanceStateFailed:
|
case InstanceStateFailed:
|
||||||
return true, nil, fmt.Errorf("wait handler got status FAILURE for instance: %s", instanceId)
|
return true, nil, fmt.Errorf("wait handler got status FAILURE for instance: %s", instanceID)
|
||||||
default:
|
default:
|
||||||
return true, s, fmt.Errorf("instance with id %s has unexpected status %s", instanceId, s.Status)
|
return true, s, fmt.Errorf("instance with id %s has unexpected status %s", instanceID, s.Status)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
).SetTimeout(timeout).SetSleepBeforeWait(sleepBeforeWait)
|
).
|
||||||
|
SetTimeout(timeout).
|
||||||
|
SetSleepBeforeWait(sleepBeforeWait)
|
||||||
|
|
||||||
_, err := handler.WaitWithContext(ctx)
|
_, err := handler.WaitWithContext(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue