Граф коммитов

13 Коммитов

Автор SHA1 Сообщение Дата
Dmitri Shuralyov 8c598b7262 cloudfns/sendwikidiff: fix temporary repo clone path on Windows
tempRepoDir used path.Join (not filepath.Join) and url.PathEscape,
which aren't suited for file path manipulation, causing git clone
to fail to clone the repository on Windows. Fix that.

Since there's only one repoURL constant, simplify the tempRepoDir
function to be one variable alongside repoURL.

Change-Id: I74d0f78a1d79a0456444eaf2a3f4479d383503e9
Reviewed-on: https://go-review.googlesource.com/c/build/+/501196
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2023-06-07 15:57:38 +00:00
Dmitri Shuralyov caf05ac5ca cloudfns: use go.dev instead of golang.org
Both work but go.dev is newer and shorter.

For golang/go#59741.

Change-Id: I5f65d67bc997058860be77373e3a7952565acc10
Reviewed-on: https://go-review.googlesource.com/c/build/+/486956
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-05-05 17:01:43 +00:00
Dmitri Shuralyov c5157f59a2 cloudfns: merge nested modules into root module, update Go runtime
Dependencies from the 3 modules were combined by essentially taking the
highest version from each. The following sequence reproduces the change
to the top-level go.mod file:

	go get cloud.google.com/go/pubsub@v1.26.0
	rm cloudfns/*/go.mod
	go mod tidy

In order to deploy cloud functions now, the sequence of steps ends up
recreating the nested modules in the local tree by reusing dependency
versions selected in the top-level root module, and 'go mod tidy'-ing
away all the unused modules. This way we end up maintaining two fewer
go.mod files.

While here, update the Go runtime used by the Cloud Functions to 1.20
and use io instead of io/ioutil.

Fixes golang/go#59741.

Change-Id: Icd1c1b388f648dbb13fbea5371860cc96521a9d6
Reviewed-on: https://go-review.googlesource.com/c/build/+/486955
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
2023-05-05 17:01:41 +00:00
Guoqi Chen 7eab32633e cloudfns/wikiwebhook: update cloud.google.com/go/pubsub version
go get cloud.google.com/go/pubsub@v1.26.0
go mod tidy

This brings in loong64 support.

Change-Id: Iff5905f5aa866b240832abf76ce97a4a8763e8f7
Reviewed-on: https://go-review.googlesource.com/c/build/+/453456
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Carlos Amedee <carlos@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2022-11-28 21:09:57 +00:00
Dmitri Shuralyov 6bb969c74d cloudfns/issueswebhook: delete
This function was actively used a few years ago, but by now it's not
serving any purpose. If it (or a modified version thereof) becomes
needed again, it's easy to re-add. In the meantime, delete its code
to reduce x/build maintenance costs slightly.

For golang/go#51867.

Change-Id: I4962cc5a6384541ca4f38003565b2cdc218c0c51
Reviewed-on: https://go-review.googlesource.com/c/build/+/396477
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2022-05-17 15:35:38 +00:00
Bryan C. Mills ecfecf7bea all: consistently set PWD to match Dir for subprocesses
Also consistently deduplicate Env entries, mainly to reduce confusion
when reading logs.

This change is probably larger than what is strictly needed to fix the
issue, but it seemed simpler than trying to figure out which of the
many calls to exec.Command in the module are actually relevant.
(It also provides some useful case studies for possible additions to
the Go standard library.)

For golang/go#33598

Change-Id: Ia2bce4549e4a71b56fb497e3df093f79fbcf7f29
Reviewed-on: https://go-review.googlesource.com/c/build/+/353549
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2021-10-08 15:15:56 +00:00
Dmitri Shuralyov 884a8debac cloudfns/wikiwebhook: set GCP_PROJECT env var explicitly
Prior to CL 230637, this cloud function was targeting the Go 1.11
runtime, which implicitly¹ set the GCP_PROJECT environment variable.
That no longer happens with the newer Go runtime², so set the same
variable explicitly, otherwise publishing to the topic fails.

Remove a defer r.Body.Close() line; the http.Request body is closed
by the http.Server, http.Handler does not need to.

Also update the version of pubsub package to the latest. It isn't
needed to fix the problem, but it has already been tested during
debugging, so it's inexpensive to include.

A future enhancement is to factor out the pubsub client creation
to happen once per function instance rather than per invocation³,
and use metadata.ProjectID instead of needing an explicit env var.

¹ https://cloud.google.com/functions/docs/env-var#nodejs_8_python_37_and_go_111
² https://cloud.google.com/functions/docs/env-var#newer_runtimes
³ https://cloud.google.com/functions/docs/concepts/go-runtime#one-time_initialization

Fixes golang/go#44948.

Change-Id: I03fd66c7fb784cef24c5759b45cb7c10ed17ee6a
Reviewed-on: https://go-review.googlesource.com/c/build/+/302549
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Trust: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2021-03-18 16:11:36 +00:00
Dmitri Shuralyov ef3d1880f2 cloudfns: fetch secrets from Secret Manager
This makes the deploy into something that can be executed without
the need to seek external context on where the secrets are kept.

It's especially helpful since we deploy cloud functions less
frequently than many other services.

A future change can explore removing secrets from the environment,
preferring to have the cloud function access secrets directly from
Secret Manager.

Updates golang/go#37171.

Change-Id: I1b1468c6f02d45b764f65396027d9bdca69ac5e4
Reviewed-on: https://go-review.googlesource.com/c/build/+/300230
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
2021-03-18 16:09:22 +00:00
Dmitri Shuralyov c79c8100c9 all: improve update-readmes.go and regenerate package READMEs
Some of README.md files were initially generated by update-readmes.go,
but later had some additional information appended. Re-running update-
readmes.go blasts away those changes, and requires manually reverting
the deletions. This makes it expensive to re-run update-readmes.go to
add new READMEs or update existing ones.

Solve this problem by adding support for a special "<!-- End of auto-
generated section -->" comment and making update-readmes.go preserve
any content after it.

After this change, re-running update-readmes.go produces a zero diff.

Also set the working directory when using build.Import so that packages
inside nested modules work okay.

Add the missing first word 'Package' to ./internal/datastore/fake doc.

Change-Id: If7ba92a297eebeec8029d48d760acb1daa7f263e
Reviewed-on: https://go-review.googlesource.com/c/build/+/300229
Trust: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2021-03-10 19:07:43 +00:00
Alexander Rakoczy 916311cec4 cloudfns: update to go1.13 runtime
We're running on an outdated version of Go, and should not be.

Change-Id: I650c9d74cf230c2c24939c79a270040026a489ca
Reviewed-on: https://go-review.googlesource.com/c/build/+/230637
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-04-28 20:27:02 +00:00
Brad Fitzpatrick 944a57051c cloudfns/sendwikidiff: fix test when git not available (like on windows longtest)
Change-Id: I4277f8b9d3872cc14149788df5a2bb02a7eeeb2d
Reviewed-on: https://go-review.googlesource.com/c/build/+/211099
Reviewed-by: Bryan C. Mills <bcmills@google.com>
2019-12-12 17:46:51 +00:00
Andrew Bonventre a3b43586c3 cloudfns: add issueswebhook to store issue events in GCS
To do historical analysis, it is helpful to have a corpus of
events data from GitHub. Store all GitHub events in a GCS
bucket until golang/go#29396 is fixed.

Updates golang/go#29396

Change-Id: Ia0172db93e019a8d6ab4ccf6e195f3a3e15583bd
Reviewed-on: https://go-review.googlesource.com/c/build/+/199638
Run-TryBot: Andrew Bonventre <andybons@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-10 20:44:41 +00:00
Andrew Bonventre bace88d50d cloudfns: send email updates when the wiki changes
This change introduces two cloud functions: wikiwebhook and
sendwikidiff. The former handles GitHub Wiki change events
sent over HTTP and enqueues them on a pubsub topic for the
latter to pick up. sendwikidiff then checks out the wiki
repo and sends an email with the diff of the change to
golang-wikichanges@.

The reason it is split into two functions is due to GitHub’s
timeout limit on webhook handlers (ten seconds). In testing,
a cold boot of a function that does everything described
above would sometimes hit that limit.

Updates golang/go#27313

Change-Id: I1974e1434c7003482df724d6ea3b537e22231c36
Reviewed-on: https://go-review.googlesource.com/c/158642
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-29 20:39:59 +00:00