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 <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
Jonathan Amsterdam 2022-01-11 14:40:45 -05:00
Родитель 5be32adfba
Коммит 60e69eecf2
2 изменённых файлов: 6 добавлений и 4 удалений

Просмотреть файл

@ -15,7 +15,8 @@ steps:
- name: golang
args: ["bash", "-c", "go run ./cmd/events > ./_content/events.yaml"]
- name: golang
args: ["go", "run", "./cmd/locktrigger", "--project=$PROJECT_ID", "--build=$BUILD_ID"]
args: ["go", "run", "./cmd/locktrigger", "--project=$PROJECT_ID",
"--build=$BUILD_ID", "--repo=https://go.googlesource.com/website"]
- name: gcr.io/cloud-builders/gcloud
entrypoint: bash
args: ["./go-app-deploy.sh", "cmd/golangorg/app.yaml"]

Просмотреть файл

@ -54,10 +54,11 @@ import (
var (
project = flag.String("project", "", "GCP project `name` (required)")
build = flag.String("build", "", "GCP build `id` (required)")
repo = flag.String("repo", "", "`URL` of repository (required)")
)
func usage() {
fmt.Fprintf(os.Stderr, "usage: locktrigger -project=name -build=id\n")
fmt.Fprintf(os.Stderr, "usage: locktrigger -project=name -build=id -repo=URL\n")
os.Exit(2)
}
@ -67,7 +68,7 @@ func main() {
log.SetPrefix("locktrigger: ")
log.SetFlags(0)
if *project == "" || *build == "" {
if *project == "" || *build == "" || *repo == "" {
usage()
}
@ -140,7 +141,7 @@ func main() {
// if we are the only build that is running.
if shallow {
log.Printf("git fetch --unshallow")
run("git", "fetch", "--unshallow", "https://go.googlesource.com/website")
run("git", "fetch", "--unshallow", *repo)
shallow = false
}