Skip to content

Commit

Permalink
internal/task: fix Git authentication
Browse files Browse the repository at this point in the history
Seems that the cookie file format is quite inflexible. Also install git
so that we can, you know, run it.

Change-Id: Iddf487701914b306a5c0fb30bdc66277395ecc0b
Reviewed-on: https://go-review.googlesource.com/c/build/+/536718
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Auto-Submit: Heschi Kreinick <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
  • Loading branch information
heschi authored and gopherbot committed Oct 20, 2023
1 parent 4988086 commit 33a0c70
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/relui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FROM debian:bookworm

RUN apt-get update && apt-get install -y \
--no-install-recommends \
tini ca-certificates
tini ca-certificates git

ARG PORT=8080
ENV PORT=${PORT}
Expand Down
2 changes: 1 addition & 1 deletion internal/task/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (g *Git) runGitStreamed(ctx context.Context, stdout, stderr io.Writer, dir
return err
}
// https://github.com/curl/curl/blob/master/docs/HTTP-COOKIES.md
cookieLine := fmt.Sprintf(".googlesource.com TRUE / TRUE %v o %v\n", tok.Expiry.Unix(), tok.AccessToken)
cookieLine := fmt.Sprintf(".googlesource.com\tTRUE\t/\tTRUE\t%v\to\t%v\n", tok.Expiry.Unix(), tok.AccessToken)
if err := os.WriteFile(g.cookieFile, []byte(cookieLine), 0o700); err != nil {
return fmt.Errorf("error writing git cookies: %v", err)
}
Expand Down

0 comments on commit 33a0c70

Please sign in to comment.