Skip to content

Commit

Permalink
cmd/locktrigger: generalize repo
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
jba committed Jan 11, 2022
1 parent 5be32ad commit 60e69ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cmd/golangorg/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
7 changes: 4 additions & 3 deletions cmd/locktrigger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

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

if *project == "" || *build == "" {
if *project == "" || *build == "" || *repo == "" {
usage()
}

Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 60e69ee

Please sign in to comment.