Skip to content

Provide better error message for HTTP 524 #11808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions components/content-service/pkg/initializer/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package initializer
import (
"context"
"errors"
"fmt"
"os"
"os/exec"
"strings"
Expand Down Expand Up @@ -97,6 +98,7 @@ func (ws *GitInitializer) Run(ctx context.Context, mappings []archive.IDMapping)
b := backoff.NewExponentialBackOff()
b.MaxElapsedTime = 5 * time.Minute
if err = backoff.RetryNotify(gitClone, b, onGitCloneFailure); err != nil {
err = checkGitStatus(err)
return src, xerrors.Errorf("git initializer gitClone: %w", err)
}

Expand Down Expand Up @@ -155,6 +157,7 @@ func (ws *GitInitializer) realizeCloneTarget(ctx context.Context) (err error) {
// Because we don't want to make the "git fetch" mechanism in supervisor more complicated,
// we'll just fetch the 20 commits right away.
if err := ws.Git(ctx, "fetch", "origin", ws.CloneTarget, "--depth=20"); err != nil {
err = checkGitStatus(err)
return err
}

Expand All @@ -176,3 +179,13 @@ func (ws *GitInitializer) realizeCloneTarget(ctx context.Context) (err error) {
}
return nil
}

func checkGitStatus(err error) error {
if err != nil {
if strings.Contains(err.Error(), "The requested URL returned error: 524") {
return fmt.Errorf("Git clone returned HTTP status 524 (see https://gitlab.com/gitlab-com/gl-infra/reliability/-/issues/8475). Please try restarting your workspace")
}
}

return err
}
2 changes: 2 additions & 0 deletions components/content-service/pkg/initializer/prebuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ func runGitInit(ctx context.Context, gInit *GitInitializer) (err error) {
didStash := !strings.Contains(string(out), "No local changes to save")

err = gInit.Fetch(ctx)
err = checkGitStatus(err)
if err != nil {
return xerrors.Errorf("prebuild initializer: %w", err)
}

err = gInit.realizeCloneTarget(ctx)
if err != nil {
return xerrors.Errorf("prebuild initializer: %w", err)
Expand Down