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

8 Коммитов

Автор SHA1 Сообщение Дата
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