Skip to content

Commit

Permalink
internal/task: fix Cloud Build with Git checkout
Browse files Browse the repository at this point in the history
Putting the Go installation in the middle of the repo we're working with
is unwise. Extract it to /workspace unconditionally.

(See
https://cloud.google.com/build/docs/configuring-builds/pass-data-between-steps#passing_data_using_workspaces)

Change-Id: I94fd1469cd715bf53e342a5dbbac1e4ba061da70
Reviewed-on: https://go-review.googlesource.com/c/build/+/534156
Auto-Submit: Heschi Kreinick <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
  • Loading branch information
heschi authored and gopherbot committed Oct 10, 2023
1 parent 06d0829 commit 8b8f944
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/task/cloudbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ func (c *RealCloudBuildClient) RunScript(ctx context.Context, script string, ger
set -eux
archive=$(wget -qO - 'https://go.dev/dl/?mode=json' | grep -Eo 'go.*linux-amd64.tar.gz' | head -n 1)
wget -qO - https://go.dev/dl/${archive} | tar -xz
mv go released_go
mv go /workspace/released_go
`

const scriptPrefix = `#!/usr/bin/env bash
set -eux
set -o pipefail
export PATH=$PWD/released_go/bin:$PATH
export PATH=/workspace/released_go/bin:$PATH
`

// Cloud build loses directory structure when it saves artifacts, which is
Expand Down

0 comments on commit 8b8f944

Please sign in to comment.