Skip to content

Commit

Permalink
feat(clouddriver): use SpinnakerRetrofitErrorHandler for retrofit cli…
Browse files Browse the repository at this point in the history
…ent beans in CloudDriverConfiguration (#4528)

* feat(clouddriver): use SpinnakerRetrofitErrorHandler for retrofit client beans in CloudDriverConfiguration

to improve the behavior of RetrySupport, to improve error messages in the UI, and to pave
the way to move to retrofit2 by reducing dependencies on retrofit1 classes
(e.g. RetrofitError).  The main consequence of this is that code that previously checked
for RetrofitError now checks for Spinnaker*Exception.

Specifically, the beans for these classes now use SpinnakerRetrofitErrorHandler:

KatoRestService
FeaturesRestService
MortService
CloudDriverCacheStatusService
OortService
CloudDriverTaskStatusService

and then as well

KatoService since it wraps KatoRestService
CloudDriverService since it wraps OortService

There is more cleanup to follow in subsequent commits.

* refactor(clouddriver/test): use more fully formed RetrofitErrors in TargetServerGroupResolverSpec

to pave the way for Spinnaker*Exceptions, which depend on more fields being present

* update TargetServerGroupResolver assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* update ClusterSizePreconditionTask assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* refactor(clouddriver/test): use more fully formed RetrofitErrors in FindImageFromClusterTaskSpec

to pave the way for Spinnaker*Exceptions, which depend on more fields being present

* update FindImageFromClusterTask assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* refactor(clouddriver/test): use a converter with RetrofitErrors in WaitForDestroyedAsgTaskSpec

to pave the way for Spinnaker*Exceptions, which depend on a converter being present

* update WaitForDestroyedServerGroupTask assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

Note that the code now populates lastSpinnakerException instead of lastRetrofitException
in the pipeline execution context when an unexpected http error occurs.

* update WaitForManifestStableTask assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* update WaitForCloudFormationCompletionTask assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* update BulkWaitForDestroyedServerGroupTask assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* update SpinnakerMetadataServerGroupTagGenerator assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* refactor(clouddriver): remove OortService where it's not used: SourceResolver, JarDiffsTask, VerifyQuipTask

* update UpsertImageTagsTask assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* update VerifyApplicationHasNoDependenciesTask assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* update TerminatingInstanceSupport assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* update AbstractWaitForAppEngineServerGroupStopStartTask assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

Note that the code now populates lastSpinnakerException instead of lastRetrofitException
in the pipeline execution context when an unexpected http error occurs.

* update MonitorDeleteImageTask assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

Note that the code now populates lastSpinnakerException instead of lastRetrofitException
in the pipeline execution context when an unexpected http error occurs.

* update AbstractInstancesCheckTask assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* update WaitForDisabledServerGroupTask assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* update SourceResolver assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* update TargetReferenceSupport assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* update PollerSupport assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* update CloudDriverService assuming the underlying calls to oortService use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception

* refactor(igor): add helper methods for exception handling in GetCommitsTask

to pave the way to handle Spinnaker*Exceptions as well

* refactor(igor/test): rename retrofit-specific variables

to something more generic to pave the way for Spinnaker*Exception

* update GetCommitsTask assuming the underlying calls to clouddriver use SpinnakerRetrofitErrorHandler / throw Spinnaker*Exception
  • Loading branch information
dbyron-sf authored Sep 18, 2023
1 parent 4666ce0 commit 6dfe7dd
Show file tree
Hide file tree
Showing 48 changed files with 293 additions and 247 deletions.
1 change: 1 addition & 0 deletions orca-applications/orca-applications.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies {
implementation(project(":orca-keel"))
implementation(project(":orca-retrofit"))
implementation("io.spinnaker.fiat:fiat-core:$fiatVersion")
implementation("io.spinnaker.kork:kork-retrofit")

compileOnly("org.projectlombok:lombok")
annotationProcessor("org.projectlombok:lombok")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package com.netflix.spinnaker.orca.applications.tasks

import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerServerException
import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus
import com.netflix.spinnaker.orca.api.pipeline.Task
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
Expand All @@ -27,7 +29,6 @@ import com.netflix.spinnaker.orca.front50.model.Application
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import retrofit.RetrofitError

import javax.annotation.Nonnull

Expand Down Expand Up @@ -61,22 +62,16 @@ class VerifyApplicationHasNoDependenciesTask implements Task {
}) {
existingDependencyTypes << "security groups"
}
} catch (RetrofitError e) {
if (!e.response) {
def exception = [operation: stage.tasks[-1].name, reason: e.message]
return TaskResult.builder(ExecutionStatus.TERMINAL).context([exception: exception]).build()
} else if (e.response && e.response.status && e.response.status != 404) {
def resp = e.response
def exception = [statusCode: resp.status, operation: stage.tasks[-1].name, url: resp.url, reason: resp.reason]
try {
exception.details = e.getBodyAs(Map) as Map
} catch (ignored) {
}

} catch (SpinnakerHttpException e) {
if (e.getResponseCode() != 404) {
def exception = [statusCode: e.getResponseCode(), operation: stage.tasks[-1].name, url: e.getUrl(), reason: e.getReason()]
exception.details = e.getResponseBody()
return TaskResult.builder(ExecutionStatus.TERMINAL).context([exception: exception]).build()
}
} catch (SpinnakerServerException e) {
def exception = [operation: stage.tasks[-1].name, reason: e.message]
return TaskResult.builder(ExecutionStatus.TERMINAL).context([exception: exception]).build()
}

if (!existingDependencyTypes) {
return TaskResult.ofStatus(ExecutionStatus.SUCCEEDED)
}
Expand Down
1 change: 1 addition & 0 deletions orca-clouddriver/orca-clouddriver.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies {
implementation(project(":orca-bakery"))
implementation(project(":orca-deploymentmonitor"))
implementation("io.spinnaker.kork:kork-moniker")
implementation("io.spinnaker.kork:kork-retrofit")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
implementation("io.kubernetes:client-java")
implementation("com.amazonaws:aws-java-sdk-lambda")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.netflix.spinnaker.orca.clouddriver.pipeline.instance

import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerServerException
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
import com.netflix.spinnaker.orca.clouddriver.CloudDriverService
import com.netflix.spinnaker.orca.clouddriver.model.SearchResultSet
Expand All @@ -24,7 +25,6 @@ import com.netflix.spinnaker.orca.clouddriver.utils.CloudProviderAware
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import retrofit.RetrofitError

@Slf4j
@Component
Expand Down Expand Up @@ -116,7 +116,7 @@ class TerminatingInstanceSupport implements CloudProviderAware {
List<SearchResultSet> searchResult
try {
searchResult = cloudDriverService.getSearchResults(terminatingInstance.id, "instances", cloudProvider)
} catch (RetrofitError e) {
} catch (SpinnakerServerException e) {
log.warn e.message
}
return !(searchResult?.getAt(0)?.totalMatches == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.support
import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.kork.annotations.VisibleForTesting
import com.netflix.spinnaker.kork.core.RetrySupport
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
import com.netflix.spinnaker.orca.clouddriver.OortService
import com.netflix.spinnaker.orca.clouddriver.model.ServerGroup
Expand Down Expand Up @@ -153,11 +154,11 @@ class TargetServerGroupResolver {
return retrySupport.retry({
try {
return fetchClosure.call()
} catch (RetrofitError re) {
if (re.kind == RetrofitError.Kind.HTTP && re.response.status == 404) {
} catch (SpinnakerHttpException spinnakerHttpException) {
if (spinnakerHttpException.getResponseCode() == 404) {
return null
}
throw re
throw spinnakerHttpException
}
}, NUM_RETRIES, Duration.ofMillis(1000), false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.netflix.spectator.api.Registry
import com.netflix.spinnaker.kork.annotations.VisibleForTesting
import com.netflix.spinnaker.kork.core.RetrySupport
import com.netflix.spinnaker.kork.dynamicconfig.DynamicConfigService
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus
import com.netflix.spinnaker.orca.api.pipeline.RetryableTask
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
Expand All @@ -35,7 +36,6 @@ import groovy.transform.TypeCheckingMode
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import retrofit.RetrofitError

import javax.annotation.Nonnull
import java.time.Clock
Expand Down Expand Up @@ -108,8 +108,8 @@ class MonitorKatoTask implements RetryableTask, CloudProviderAware {
katoTask = kato.lookupTask(taskId.id, false)
}, MAX_HTTP_INTERNAL_RETRIES, Duration.ofMillis(100), false)
outputs['kato.task.notFoundRetryCount'] = 0
} catch (RetrofitError re) {
if (re.kind == RetrofitError.Kind.HTTP && re.response.status == HttpURLConnection.HTTP_NOT_FOUND) {
} catch (SpinnakerHttpException re) {
if (re.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
def notFoundRetryCount = ((stage.context."kato.task.notFoundRetryCount" as Long) ?: 0) + 1

def ctx = ['kato.task.notFoundRetryCount': notFoundRetryCount]
Expand Down Expand Up @@ -187,9 +187,9 @@ class MonitorKatoTask implements RetryableTask, CloudProviderAware {
try {
kato.resumeTask(katoTask.id)
} catch (Exception e) {
if (e instanceof RetrofitError) {
RetrofitError retrofitError = (RetrofitError) e
if (retrofitError?.response?.status == 404) {
if (e instanceof SpinnakerHttpException) {
SpinnakerHttpException spinnakerHttpException = (SpinnakerHttpException) e
if (spinnakerHttpException.getResponseCode() == 404) {
monitorFinalTerminalRetry(stage, "404")
// unexpected -- no sense attempting to resume a saga that `clouddriver` has no knowledge about
throw e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package com.netflix.spinnaker.orca.clouddriver.tasks.cluster
import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.frigga.Names
import com.netflix.spinnaker.kork.exceptions.ConfigurationException
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.moniker.Moniker
import com.netflix.spinnaker.orca.api.pipeline.RetryableTask
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
Expand Down Expand Up @@ -96,11 +97,11 @@ class ClusterSizePreconditionTask implements CloudProviderAware, RetryableTask,
def response
try {
response = oortService.getCluster(config.application, credentials, config.cluster, cloudProvider)
} catch (RetrofitError re) {
if (re.kind == RetrofitError.Kind.HTTP && re.response.status == 404) {
} catch (SpinnakerHttpException spinnakerHttpException) {
if (spinnakerHttpException.getResponseCode() == 404) {
return [:]
}
throw re
throw spinnakerHttpException
}

JacksonConverter converter = new JacksonConverter(objectMapper)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.fasterxml.jackson.core.type.TypeReference
import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.frigga.Names
import com.netflix.spinnaker.kork.artifacts.model.Artifact
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.moniker.Moniker
import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus
import com.netflix.spinnaker.orca.api.pipeline.RetryableTask
Expand Down Expand Up @@ -160,15 +161,10 @@ class FindImageFromClusterTask implements CloudProviderAware, RetryableTask {
}
}
return [(location): summaries]
} catch (RetrofitError e) {
if (e.response?.status == 404) {
Map reason
try {
reason = objectMapper.readValue(e.response.body.in(), new TypeReference<Map<String, Object>>() {})
} catch (Exception ignored) {
throw new IllegalStateException("Unexpected response from API")
}
if (reason.error?.contains("target.fail.strategy")){
} catch (SpinnakerHttpException spinnakerHttpException) {
if (spinnakerHttpException.getResponseCode() == 404) {
Map<String, Object> responseBody = spinnakerHttpException.getResponseBody()
if (responseBody.error?.contains("target.fail.strategy")){
throw new IllegalStateException("Multiple possible server groups present in ${location.value}")
}
if (config.resolveMissingLocations) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.netflix.spinnaker.orca.clouddriver.tasks.providers.appengine

import com.netflix.frigga.Names
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus
import com.netflix.spinnaker.orca.api.pipeline.RetryableTask
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
Expand All @@ -26,10 +27,9 @@ import com.netflix.spinnaker.orca.clouddriver.model.Cluster
import com.netflix.spinnaker.orca.clouddriver.model.ServerGroup
import com.netflix.spinnaker.orca.clouddriver.utils.CloudProviderAware

import com.netflix.spinnaker.orca.retrofit.exceptions.RetrofitExceptionHandler
import com.netflix.spinnaker.orca.retrofit.exceptions.SpinnakerServerExceptionHandler
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import retrofit.RetrofitError

@Slf4j
abstract class AbstractWaitForAppEngineServerGroupStopStartTask implements CloudProviderAware, RetryableTask {
Expand Down Expand Up @@ -65,14 +65,13 @@ abstract class AbstractWaitForAppEngineServerGroupStopStartTask implements Cloud
log.info("${serverGroupName}: not yet ${start ? "started" : "stopped"}.")
return TaskResult.ofStatus(ExecutionStatus.RUNNING)
}

} catch (RetrofitError e) {
def retrofitErrorResponse = new RetrofitExceptionHandler().handle(stage.name, e)
if (e.response?.status == 404) {
} catch (SpinnakerHttpException e) {
def spinnakerHttpExceptionResponse = new SpinnakerServerExceptionHandler().handle(stage.name, e)
if (e.getResponseCode() == 404) {
return TaskResult.ofStatus(ExecutionStatus.TERMINAL)
} else if (e.response?.status >= 500) {
log.error("Unexpected retrofit error (${retrofitErrorResponse})")
return TaskResult.builder(ExecutionStatus.RUNNING).context([lastRetrofitException: retrofitErrorResponse]).build()
} else if (e.getResponseCode() >= 500) {
log.error("Unexpected http error (${spinnakerHttpExceptionResponse})")
return TaskResult.builder(ExecutionStatus.RUNNING).context([lastSpinnakerException: spinnakerHttpExceptionResponse]).build()
}

throw e
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

package com.netflix.spinnaker.orca.clouddriver.tasks.providers.aws

import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
import com.netflix.spinnaker.orca.clouddriver.MortService
import com.netflix.spinnaker.orca.clouddriver.tasks.securitygroup.SecurityGroupUpserter
import com.netflix.spinnaker.orca.clouddriver.utils.CloudProviderAware
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import retrofit.RetrofitError

import static com.netflix.spinnaker.orca.clouddriver.MortService.SecurityGroup.filterForSecurityGroupIngress

Expand Down Expand Up @@ -102,8 +102,8 @@ class AmazonSecurityGroupUpserter implements SecurityGroupUpserter, CloudProvide
return mortSecurityGroupIngress.containsAll(targetSecurityGroupIngress)
}
return mortSecurityGroupIngress == targetSecurityGroupIngress
} catch (RetrofitError e) {
if (e.response?.status != 404) {
} catch (SpinnakerHttpException e) {
if (e.getResponseCode() != 404) {
throw e
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

package com.netflix.spinnaker.orca.clouddriver.tasks.providers.azure

import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
import com.netflix.spinnaker.orca.clouddriver.MortService
import com.netflix.spinnaker.orca.clouddriver.tasks.securitygroup.SecurityGroupUpserter
import com.netflix.spinnaker.orca.clouddriver.utils.CloudProviderAware
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import retrofit.RetrofitError

@Component
class AzureSecurityGroupUpserter implements SecurityGroupUpserter, CloudProviderAware {
Expand Down Expand Up @@ -51,8 +51,8 @@ class AzureSecurityGroupUpserter implements SecurityGroupUpserter, CloudProvider
cloudProvider,
upsertedSecurityGroup.name,
upsertedSecurityGroup.region)
} catch (RetrofitError e) {
if (e.response?.status != 404) {
} catch (SpinnakerHttpException e) {
if (e.getResponseCode() != 404) {
throw e
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@

package com.netflix.spinnaker.orca.clouddriver.tasks.providers.gce

import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
import com.netflix.spinnaker.orca.clouddriver.MortService
import com.netflix.spinnaker.orca.clouddriver.tasks.securitygroup.SecurityGroupUpserter
import com.netflix.spinnaker.orca.clouddriver.utils.CloudProviderAware
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import retrofit.RetrofitError

import static com.netflix.spinnaker.orca.clouddriver.MortService.SecurityGroup.SecurityGroupIngress

Expand Down Expand Up @@ -103,8 +103,8 @@ class GoogleSecurityGroupUpserter implements SecurityGroupUpserter, CloudProvide
boolean ingressMatches = existingSecurityGroupIngress == targetSecurityGroupIngress

return ingressMatches
} catch (RetrofitError e) {
if (e.response?.status != 404) {
} catch (SpinnakerHttpException e) {
if (e.getResponseCode() != 404) {
throw e
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.netflix.spinnaker.orca.clouddriver.tasks.servergroup

import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.kork.retrofit.exceptions.SpinnakerHttpException
import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus
import com.netflix.spinnaker.orca.api.pipeline.RetryableTask
import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution
Expand All @@ -27,10 +28,10 @@ import com.netflix.spinnaker.orca.clouddriver.utils.CloudProviderAware
import com.netflix.spinnaker.orca.clouddriver.utils.ClusterDescriptor
import com.netflix.spinnaker.orca.clouddriver.utils.ServerGroupDescriptor
import com.netflix.spinnaker.orca.retrofit.exceptions.RetrofitExceptionHandler
import com.netflix.spinnaker.orca.retrofit.exceptions.SpinnakerServerExceptionHandler
import groovy.util.logging.Slf4j
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import retrofit.RetrofitError

@Slf4j
@Component
Expand Down Expand Up @@ -75,16 +76,16 @@ class WaitForDestroyedServerGroupTask implements CloudProviderAware, RetryableTa
def instances = serverGroup.instances ?: []
log.info("${serverGroupDescriptor.name}: not yet destroyed, found instances: ${instances?.join(', ') ?: 'none'}")
return TaskResult.builder(ExecutionStatus.RUNNING).context([remainingInstances: instances.findResults { it.name }]).build()
} catch (RetrofitError e) {
def retrofitErrorResponse = new RetrofitExceptionHandler().handle(stage.name, e)
if (e.response?.status == 404) {
} catch (SpinnakerHttpException spinnakerHttpException) {
def errorResponse = new SpinnakerServerExceptionHandler().handle(stage.name, spinnakerHttpException)
if (spinnakerHttpException.getResponseCode() == 404) {
return TaskResult.ofStatus(ExecutionStatus.SUCCEEDED)
} else if (e.response?.status >= 500) {
log.error("Unexpected retrofit error (${retrofitErrorResponse})")
return TaskResult.builder(ExecutionStatus.RUNNING).context([lastRetrofitException: retrofitErrorResponse]).build()
} else if (spinnakerHttpException.getResponseCode() >= 500) {
log.error("Unexpected http error (${errorResponse})")
return TaskResult.builder(ExecutionStatus.RUNNING).context([lastSpinnakerException: errorResponse]).build()
}

throw e
throw spinnakerHttpException
}
}

Expand Down
Loading

0 comments on commit 6dfe7dd

Please sign in to comment.