Skip to content

Commit 60e69ee

Browse files
committed
cmd/locktrigger: generalize repo
Require a -repo flag for the repo to clone, instead of hardcoded x/website. Change-Id: I7fffd07b24d070e8e825fc3a5962bd506ea98f07 Reviewed-on: https://go-review.googlesource.com/c/website/+/377794 Trust: Jonathan Amsterdam <[email protected]> Run-TryBot: Jonathan Amsterdam <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Russ Cox <[email protected]>
1 parent 5be32ad commit 60e69ee

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

cmd/golangorg/cloudbuild.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ steps:
1515
- name: golang
1616
args: ["bash", "-c", "go run ./cmd/events > ./_content/events.yaml"]
1717
- name: golang
18-
args: ["go", "run", "./cmd/locktrigger", "--project=$PROJECT_ID", "--build=$BUILD_ID"]
18+
args: ["go", "run", "./cmd/locktrigger", "--project=$PROJECT_ID",
19+
"--build=$BUILD_ID", "--repo=https://go.googlesource.com/website"]
1920
- name: gcr.io/cloud-builders/gcloud
2021
entrypoint: bash
2122
args: ["./go-app-deploy.sh", "cmd/golangorg/app.yaml"]

cmd/locktrigger/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@ import (
5454
var (
5555
project = flag.String("project", "", "GCP project `name` (required)")
5656
build = flag.String("build", "", "GCP build `id` (required)")
57+
repo = flag.String("repo", "", "`URL` of repository (required)")
5758
)
5859

5960
func usage() {
60-
fmt.Fprintf(os.Stderr, "usage: locktrigger -project=name -build=id\n")
61+
fmt.Fprintf(os.Stderr, "usage: locktrigger -project=name -build=id -repo=URL\n")
6162
os.Exit(2)
6263
}
6364

@@ -67,7 +68,7 @@ func main() {
6768
log.SetPrefix("locktrigger: ")
6869
log.SetFlags(0)
6970

70-
if *project == "" || *build == "" {
71+
if *project == "" || *build == "" || *repo == "" {
7172
usage()
7273
}
7374

@@ -140,7 +141,7 @@ func main() {
140141
// if we are the only build that is running.
141142
if shallow {
142143
log.Printf("git fetch --unshallow")
143-
run("git", "fetch", "--unshallow", "https://go.googlesource.com/website")
144+
run("git", "fetch", "--unshallow", *repo)
144145
shallow = false
145146
}
146147

0 commit comments

Comments
 (0)