Skip to content

Commit

Permalink
internal/task: fix a bug where RunCustomSteps return without result url
Browse files Browse the repository at this point in the history
For golang/vscode-go#3500

Change-Id: Ic55a53fd5797322bc18d52ae910f60dd70641ec9
Reviewed-on: https://go-review.googlesource.com/c/build/+/613597
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
  • Loading branch information
h9jiang committed Sep 17, 2024
1 parent d68cbf0 commit 30938eb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/task/cloudbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,9 @@ func (c *RealCloudBuildClient) RunScript(ctx context.Context, script string, ger
}

func (c *RealCloudBuildClient) RunCustomSteps(ctx context.Context, steps func(resultURL string) []*cloudbuildpb.BuildStep) (CloudBuild, error) {
resultURL := fmt.Sprintf("%v/script-build-%v", c.ScratchURL, rand.Int63())
build := &cloudbuildpb.Build{
Steps: steps(fmt.Sprintf("%v/script-build-%v", c.ScratchURL, rand.Int63())),
Steps: steps(resultURL),
Options: &cloudbuildpb.BuildOptions{
MachineType: cloudbuildpb.BuildOptions_E2_HIGHCPU_8,
Logging: cloudbuildpb.BuildOptions_CLOUD_LOGGING_ONLY,
Expand All @@ -157,7 +158,7 @@ func (c *RealCloudBuildClient) RunCustomSteps(ctx context.Context, steps func(re
if err != nil {
return CloudBuild{}, fmt.Errorf("reading metadata: %w", err)
}
return CloudBuild{Project: c.ScriptProject, ID: meta.Build.Id}, nil
return CloudBuild{Project: c.ScriptProject, ID: meta.Build.Id, ResultURL: resultURL}, nil
}

func (c *RealCloudBuildClient) Completed(ctx context.Context, build CloudBuild) (string, bool, error) {
Expand Down

0 comments on commit 30938eb

Please sign in to comment.