Skip to content

Commit

Permalink
Merge pull request #2697 from buildkite/core-103-artifacts-exceed-limit
Browse files Browse the repository at this point in the history
core-103 break from retrying if we get a 422
  • Loading branch information
DrJosh9000 authored Mar 27, 2024
2 parents 2a8f473 + a6ff2e5 commit a81c510
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion agent/artifact_batch_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ func (a *ArtifactBatchCreator) Create(ctx context.Context) ([]*api.Artifact, err
}

creation, resp, err := a.apiClient.CreateArtifacts(ctxTimeout, a.conf.JobID, batch)
if resp != nil && (resp.StatusCode == 401 || resp.StatusCode == 404) {
// the server returns a 403 code if the artifact has exceeded the service quota
// Break the retry on any 4xx code except for 429 Too Many Requests.
if resp != nil && (resp.StatusCode != 429 && resp.StatusCode >= 400 && resp.StatusCode <= 499) {
a.logger.Warn("Artifact creation failed with status code %d, breaking the retry loop", resp.StatusCode)
r.Break()
}
if err != nil {
Expand Down

0 comments on commit a81c510

Please sign in to comment.