Skip to content

Commit 0cb790a

Browse files
dmitshurgopherbot
authored andcommitted
internal/task: use relui service account instead of secret for git authn
Remove reliance on the secret in Secret Manager in one more place. This is easier to do now that the GenerateAutoSubmitChange implementation is done and handles all of the intended edge cases; it was very helpful be able to iterate with a shorter feedback loop during earlier development stages. For golang/go#69095. Change-Id: I103278cfde8df10c8a9f0807607a2a545fa2e376 Reviewed-on: https://go-review.googlesource.com/c/build/+/658018 Reviewed-by: Roland Shoemaker <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]>
1 parent 2b0a625 commit 0cb790a

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

internal/task/cloudbuild.go

+2-18
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"cloud.google.com/go/storage"
2121
"golang.org/x/build/gerrit"
2222
"golang.org/x/build/internal/gcsfs"
23-
"golang.org/x/build/internal/secret"
2423
wf "golang.org/x/build/internal/workflow"
2524
)
2625

@@ -208,7 +207,7 @@ func (c *RealCloudBuildClient) GenerateAutoSubmitChange(ctx *wf.TaskContext, inp
208207

209208
const (
210209
buildStepGitCommit = 4
211-
buildStepGitPush = 7
210+
buildStepGitPush = 6
212211
)
213212
buildStepOutput := func(b *cloudbuildpb.Build, buildStep int) []byte {
214213
out := b.GetResults().GetBuildStepOutputs()
@@ -266,10 +265,6 @@ func (c *RealCloudBuildClient) GenerateAutoSubmitChange(ctx *wf.TaskContext, inp
266265
Args: []string{"show", "HEAD"},
267266
Dir: "checkout",
268267
},
269-
{
270-
Name: "bash", Args: []string{"-c", `touch .gitcookies && chmod 0600 .gitcookies && printf ".googlesource.com\tTRUE\t/\tTRUE\t2147483647\to\tgit-gobot.golang.org=$$GOBOT_TOKEN\n" >> .gitcookies`},
271-
SecretEnv: []string{"GOBOT_TOKEN"},
272-
},
273268
buildStepGitPush: {
274269
Name: "gcr.io/cloud-builders/git",
275270
Entrypoint: "bash",
@@ -279,26 +274,15 @@ func (c *RealCloudBuildClient) GenerateAutoSubmitChange(ctx *wf.TaskContext, inp
279274
//
280275
// Whether the push successfully created a CL or not will be determined from
281276
// the output text.
282-
Args: []string{"-c", `git -c http.cookieFile=../.gitcookies push origin ` + refspec + ` 2>&1 | tee "$$BUILDER_OUTPUT/output"`},
277+
Args: []string{"-c", `git push origin ` + refspec + ` 2>&1 | tee "$$BUILDER_OUTPUT/output"`},
283278
Dir: "checkout",
284279
},
285-
{
286-
Name: "bash", Args: []string{"-c", "rm .gitcookies"},
287-
},
288280
},
289281
Options: &cloudbuildpb.BuildOptions{
290282
MachineType: cloudbuildpb.BuildOptions_E2_HIGHCPU_8,
291283
Logging: cloudbuildpb.BuildOptions_CLOUD_LOGGING_ONLY,
292284
},
293285
ServiceAccount: c.ScriptAccount,
294-
AvailableSecrets: &cloudbuildpb.Secrets{
295-
SecretManager: []*cloudbuildpb.SecretManagerSecret{
296-
{
297-
VersionName: "projects/" + c.ScriptProject + "/secrets/" + secret.NameGobotPassword + "/versions/latest",
298-
Env: "GOBOT_TOKEN",
299-
},
300-
},
301-
},
302286
},
303287
})
304288
if err != nil {

0 commit comments

Comments
 (0)