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

68 Коммитов

Автор SHA1 Сообщение Дата
Dmitri Shuralyov 5a8a822c9a internal/task: don't retry creating CL if Gerrit responds with 400
HTTP status codes in the 4xx range are known to be problems with the
request, so sending the exact same request again is doomed to create
more trouble rather than solve any problems. Disable retries instead.

Change-Id: I254d2c2dd48fa1470864545ed59e56ca6985a136
Reviewed-on: https://go-review.googlesource.com/c/build/+/482997
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2023-04-11 18:18:06 +00:00
andrew2nelson 1939f8f6ff gerrit: add WebLinks field to ProjectInfo
Make its content available to callers, like already done in TagInfo.

Change-Id: Id3bc06d905378e89362f9e8e05e8211e87b1c084
GitHub-Last-Rev: 36e8a8686e
GitHub-Pull-Request: golang/build#34
Reviewed-on: https://go-review.googlesource.com/c/build/+/314809
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Benny Siegert <bsiegert@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-12-20 08:59:28 +00:00
Heschi Kreinick da8db7aea9 internal/task: add greenness checking to TagXReposTasks
Before we tag an x/ repo, we want to make sure it's green across all
first-class builders and release branches. That's a surprisingly
complicated process.

First, we need to know which release branches are live; we can get that
from the front page of the build dashboard. Then we need the results for
the individual subrepo. Then we need to decide which builders need to
pass for a CL to be considered green. *Then* we need to know which
commits are on which release branch, which the coordinator knows in some
parts of itself but forgets by the time it serves the dashboard.
Finally, we can combine all that data to find the first CL that passed
after the commit we'd like to tag. It doesn't need to be the exact
commit, in case the build happened to be broken on a non-trybot at that
time.

Given how complex all that logic is, the test is unfortunately also kind
of a mess, sorry.

For golang/go#48523.

Change-Id: I789d83c41383df291e64d466a77c86182be15537
Reviewed-on: https://go-review.googlesource.com/c/build/+/435501
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-12 21:04:18 +00:00
Heschi Kreinick e7573ff6bf internal/task: start x repo tagging tasks
First step: list all our projects/repositories, and select those that
have a go.mod labeling them as golang.org/x as candidates to release as
the next version, or v0.1.0 for untagged repositories.

For golang/go#48523.

Change-Id: Ice92319a0726daf3bf5f94581582d8802640dffc
Reviewed-on: https://go-review.googlesource.com/c/build/+/425088
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-09-15 16:14:17 +00:00
Heschi Kreinick 644dfced84 cmd/relui,gerrit: use application default creds for Gerrit auth
relui needs to use its service account to access the private security
repository, and while I'm at it it might as well use it for the public
repo too. Add support to the gerrit package and use it in relui.

I adapted this code from the Gerrit team's auth daemon:
https://gerrit.googlesource.com/gcompute-tools/+/refs/heads/master/git-cookie-authdaemon
There may be better ways to do it but this works on my machine.

For golang/go#53799.

Change-Id: Iec302f4e4e336c21258019b0c20898280e249380
Reviewed-on: https://go-review.googlesource.com/c/build/+/417215
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
2022-07-13 22:33:46 +00:00
Heschi Kreinick 5227dc8288 internal/task: skip CLs that don't make changes
In the most recent release we retried the DL CL task, and it failed
because Gerrit rejected the no-op changes. Change the Gerrit client to
return no change in this case, and the surrounding tasks to tolerate it.

If this happens for the VERSION CL we will tag whatever the branch head
happens to be at the time, which seems correct to me.

For golang/go#51797.

Change-Id: Ieb69a4c96c7ebe057a53d0fca4d713dca0fc6f47
Reviewed-on: https://go-review.googlesource.com/c/build/+/411897
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
Reviewed-by: Alex Rakoczy <alex@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-06-14 17:38:31 +00:00
Heschi Kreinick c2ca09d7db gerrit: switch to a generic NotExist error
...and notice that only the one I just added is being used...

For golang/go#51797.

Change-Id: If62d643c2a0524231e88f1cde2cd4c980e63dd57
Reviewed-on: https://go-review.googlesource.com/c/build/+/411896
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-06-14 17:31:15 +00:00
Heschi Kreinick e90484b21f internal/relui: check for stray commits
We want to make sure we're tagging what we release. Check that the
revision that we used to build the source archive (and then do
everything else) is still the branch head once the build is done, and
then that it's the parent commit of the version CL if any.

For golang/go#51797.
Fixes golang/go#39317.

Change-Id: I718b6d03ad0de542aed9c94a585e6b052a5d986d
Reviewed-on: https://go-review.googlesource.com/c/build/+/411197
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Auto-Submit: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-06-08 23:23:41 +00:00
Heschi Kreinick 179cc6f7e0 internal/task: make Tag idempotent
Proceed if we're trying to write a tag that already exists and matches
the desired commit. That way, if we fail just after writing a tag, or
need to entirely restart a workflow for whatever reason, we can keep
going.

For golang/go#51797.

Change-Id: Ib2fdb13eea6f8cd6d3dd83cdc6cf7d97f12ca6f5
Reviewed-on: https://go-review.googlesource.com/c/build/+/411195
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Heschi Kreinick <heschi@google.com>
2022-06-08 23:23:39 +00:00
Heschi Kreinick 757f53580f gerrit, internal/task: add Gerrit-related release tasks
I refactored out the Gerrit-related code from MailDLCL, and added
support for waiting for submit and creating tags.

No test for creating tags but that logic has virtually nothing to it so
I think I'm okay with it?

For golang/go#51797.

Change-Id: Ia8c24536bbee27e0b7bef04769ac5a81dc3021ab
Reviewed-on: https://go-review.googlesource.com/c/build/+/408674
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alex Rakoczy <alex@golang.org>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-06-01 17:59:54 +00:00
Roland Shoemaker 96df98a27a cmd/gopherbot: revise autosubmit behavior for stacks
When checking whether to autosubmit a change in a stack, ignore whether
the revision of merged/abandoned parents are current (base revision ==
current revision). There are multiple reasons a merged parent may not be
current (the most obvious being that the parent change was submitted,
which increases the revision number, but the child was not rebased onto
the new revision), but as long as the change is still considered
'submittable' by gerrit (i.e. there are no merge conflicts) this should
not materially affect our decision of whether or not to submit the
change (and matches what most users will do when manually submitting a
stack).

For golang/go#48021.

Change-Id: Iceff8a88ac3638671f36175d802254788d2470fd
Reviewed-on: https://go-review.googlesource.com/c/build/+/406237
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2022-05-18 00:45:47 +00:00
Roland Shoemaker 140d723d60 cmd/gopherbot: autosubmit stacks in the right order
When a change in a stack is labelled with Auto-Submit+1, only submit
the change if all of the changes below have already been merged (or
been abandoned.) Additionally, if any of the parent changes are based on
a revision of their parent which is no longer the current revision (i.e.
in the Gerrit UI it is marked as 'Not current'), we will not submit the
change. This makes sure that changes are submitted in the expected
order.

Updates #48021

Change-Id: I9a178551843f64f8b752468ce0a091cb3cf2577d
Reviewed-on: https://go-review.googlesource.com/c/build/+/399043
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-05-07 01:40:57 +00:00
Dmitri Shuralyov 8ba548c303 cmd/gopherbot: consider Kokoro to be a bot
We're using a distinct Gerrit account to post Kokoro CI results.
Add it to the list of known bots to stop treating it as a human
reviewer.

Also future-proof a little by considering any Gerrit account with the
SERVICE_USER tag to be a bot, since all bot accounts are expected¹ to
be a part of that group.

¹ https://gerrit-review.googlesource.com/Documentation/user-attention-set.html#_important_note_for_all_host_owners_project_owners_and_bot_owners

For golang/go#38906.

Change-Id: If33def5b73fdaadec81b6fdc03a0eaf3042f8095
Reviewed-on: https://go-review.googlesource.com/c/build/+/401514
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-04-21 21:54:07 +00:00
cuishuang 3ab5e7e87a all: fix some typos
Change-Id: I35d764f27ce6a914e3af406b384e49a5183ca639
GitHub-Last-Rev: cec1a722f8
GitHub-Pull-Request: golang/build#44
Reviewed-on: https://go-review.googlesource.com/c/build/+/389597
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
2022-03-18 22:51:25 +00:00
Roland Shoemaker 31d859d323 cmd/gopherbot: add auto-submit functionality
If a CL has been labeled with "Auto-Submit", is submittable according
to Gerrit, has a positive TryBot-Result vote, and has no unresolved
comments then submit the change.

This requires adding a new gerrit.Client method for the CL submission
endpoint.

Updates golang/go#48021

Change-Id: I3d5dafd1ca25a3cac5a40d7e9a744ba12ab44cae
Reviewed-on: https://go-review.googlesource.com/c/build/+/341212
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2022-01-21 22:44:44 +00:00
Dmitri Shuralyov 0ca60466b0 gerrit: add support for creating and editing CLs
Add methods for the following endpoints:

• https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#create-changehttps://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#put-edit-filehttps://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#publish-edit

These are needed to be able to mail a Gerrit CL via the Gerrit API,
which will be used as part of release automation.

Add support for specifying a raw (not JSON-encoded) request body,
and improve miscellaneous style inconsistencies and lint issues.

For golang/go#38075.

Change-Id: Ic556d6b1f0fb6f56cfc61c50b76657b9aeea443a
Reviewed-on: https://go-review.googlesource.com/c/build/+/350630
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Trust: Dmitri Shuralyov <dmitshur@golang.org>
2021-09-29 20:32:50 +00:00
Filippo Valsorda f6aabaa8ca cmd/coordinator: resolve stale TryBot threads
Also, respond to the most recent thread even if there are multiple ones
for the same commit.

This was way harder than it should be.

Change-Id: Id6868b267c019cd70e504310ecf9c79dac29a17b
Reviewed-on: https://go-review.googlesource.com/c/build/+/317971
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
Trust: Katie Hockman <katie@golang.org>
Reviewed-by: Katie Hockman <katie@golang.org>
2021-05-07 16:56:51 +00:00
Filippo Valsorda e175a9eec4 cmd/coordinator: correctly set happy TryBots threads as resolved
Unresolved false was being omitted because false is the zero value.

Change-Id: I4b164b27e28d10d10fc192ec86c9d41046a00dfc
Reviewed-on: https://go-review.googlesource.com/c/build/+/311469
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
2021-04-19 18:18:31 +00:00
Filippo Valsorda c328b2763b cmd/coordinator: post TryBot status as PatchSet comments
It's nice to have a thread for the results because it starts unresolved,
it gets marked resolved automatically if TryBots are happy, and it can
be used to discuss the failure.

Dropped the duplicate check on the beginning message because it's useful
to know the TryBots have started again when dropping TryBotResult.

Updates golang/go#39828

Change-Id: I66e8edec6dee10e8e1df2d2a6b501774ef373496
Reviewed-on: https://go-review.googlesource.com/c/build/+/310015
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Trust: Alexander Rakoczy <alex@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
2021-04-16 10:46:40 +00:00
Filippo Valsorda d5606d50ef cmd/coordinator: tag TryBot comments on Gerrit as autogenerated
This will only show the latest one in the web UI unless "Show all
entries" is checked.

Also added the status link to the in progress failure notification, as
the previous one won't be as accessible.

Fixes golang/go#39828

Change-Id: I9d81006ac3822a9dc0201637bbb0ce1bae860cc7
Reviewed-on: https://go-review.googlesource.com/c/build/+/310011
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Trust: Alexander Rakoczy <alex@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
Run-TryBot: Alexander Rakoczy <alex@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
2021-04-16 10:46:00 +00:00
Russ Cox f539cd3e8d all: go fmt ./...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).

Not strictly necessary but will avoid spurious changes
as files are edited.

Part of //go:build change (#41184).
See https://golang.org/design/draft-gobuild

Change-Id: I8020e066756b0cfa99ed1cb804b17e127e4151b9
Reviewed-on: https://go-review.googlesource.com/c/build/+/294417
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com>
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
2021-02-20 03:31:12 +00:00
Julie Qiu a56ae9428e all: add or change GoDoc badge to pkg.go.dev with update-readmes.go
update-readmes.go is updated to add a pkg.go.dev badge instead of a
godoc.org badge.

The GoDoc badge is added or changed in all READMEs by running
update-readmes.go

For golang/go#42251

Change-Id: I0c49df26a6c695f938c98c9a7b26325d991b3cfb
Reviewed-on: https://go-review.googlesource.com/c/build/+/276032
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2020-12-15 04:52:31 +00:00
Dmitri Shuralyov 243a34b7f2 maintner/maintnerd/maintapi: look for TRY= in inline comments
The Gerrit UI has changed its default behavior when leaving top-level
comments on a CL. Previously, that text was a part of the CL-scoped
messages, but now it is located in a patchset-level inline comment.

This change updates the logic in maintapi to look for TRY= comments
in the new place. This requires making an additional Gerrit API call
to the new ListChangeComments endpoint, because the inline comment
data is not tracked by the maintner corpus, and it can't be fetched
via the existing QueryChanges API call.

Start using the patch set number as returned by the Gerrit API,
instead of parsing it out of the message prefix with a regexp,
as this is simpler and should be more robust.

Document and simplify tryWorkItem slightly by removing support for
nil *gerrit.ChangeInfo. This was only needed for tests, but it's easy
to adjust tests to not depend on this. That makes the code in the
helper less indented and less complicated.

During these changes, the unintentional pitfall where the TRY= comment
had to be preceded by a blank link has also been removed. It only needs
to be on its own line now, as it was likely originally intended.

Fixes golang/go#40106.
Fixes golang/go#38747.

Change-Id: I64e85c18fefc23e1796de61dd8ba7025ea411706
Reviewed-on: https://go-review.googlesource.com/c/build/+/241323
Reviewed-by: Filippo Valsorda <filippo@golang.org>
2020-07-08 03:33:58 +00:00
Quinten Yearsley e43bf47e32 gerrit: correct the field name for commit message in RevisionInfo
The actual field returned by Gerrit in practice is called
CommitWithFooters:
https://gerrit.googlesource.com/gerrit/+/b2ce0c1008bb2755b999f45bbf4c81b8bb3aaaaf/java/com/google/gerrit/extensions/common/RevisionInfo.java

The field was apparently called "message with footers" here because of
out-of-date or inaccurate documentation; docs updated in
https://gerrit-review.googlesource.com/c/gerrit/+/227372.

Change-Id: I03c6ecda9eb49f12250c044d16f10b78c56c3925
Reviewed-on: https://go-review.googlesource.com/c/build/+/181340
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-10-14 22:22:43 +00:00
Dmitri Shuralyov 25c4be9e2e cmd/gitmirror: change Gerrit API URL to include "-review"
Using "https://go.googlesource.com" without "-review" as the Gerrit API
URL no longer works. Use "https://go-review.googlesource.com" instead.
This is the canonical Gerrit API URL for the Go project, and it's
already being used in many other places in x/build.

Return and handle errors from gerritMetaMap. Make it so gitmirror treats
an error from gerritMetaMap on startup as fatal, otherwise it would have
started in an incorrect state. While running, skip transient errors from
gerritMetaMap as before, but also log them when they happen.

Remove unneeded trailing slashes from the Gerrit API URLs in packages
maintner/maintnerd and maintner/maintnerd/maintapi for consistency.
This is a no-op as the gerrit client library used to trim them anyway.

Fixes golang/go#32931

Change-Id: Icc20b798946d6317ee89533691f92b1f4d1564f0
Reviewed-on: https://go-review.googlesource.com/c/build/+/184922
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
2019-07-04 02:39:44 +00:00
Alexander Lourier b392e07185 gerrit: use correct URL for GetProjects API call
API doc: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#list-projects

Change-Id: I070350948b11d9aa35050eaf1368bbec8d1cad91
GitHub-Last-Rev: 86abe8c664
GitHub-Pull-Request: golang/build#19
Reviewed-on: https://go-review.googlesource.com/c/build/+/178059
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-05-20 16:36:04 +00:00
Quinten Yearsley 96be844d43 gerrit: add RevisionInfo.Kind field
Bug: chromium:807036
Change-Id: I72f00a92641f202841a1c60bf03343e11cf3b1e1
Reviewed-on: https://go-review.googlesource.com/c/159517
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-24 23:44:35 +00:00
Baokun Lee d788e328d9 cmd/gerritbot: sync abandon message to PR
Fixes golang/go#28855

Change-Id: I769cca7a509a429fad1789a8984f62f05329196d
Reviewed-on: https://go-review.googlesource.com/c/150817
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2019-01-23 19:45:12 +00:00
Parminder Singh 03ea0966a8 gerrit: add messageWithFooter to RevisionInfo
I am working on a change in chromium/infra
https://chromium-review.googlesource.com/c/infra/infra/+/1379425
We use the gerrit library's structs and currently it
doesn't include the messageWithFooter property in object.
So this change adds it.

Change-Id: I95cc8c25b2997d02548df462778b2b264c2db5cf
Reviewed-on: https://go-review.googlesource.com/c/156438
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2019-01-07 03:02:40 +00:00
Russ Cox d2a2c1258f gerrit: add more fields to ChangeInfo
For details, see
https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-info

Note that the field Mergable has been renamed Mergeable,
and its JSON tag has been corrected from mergable to mergeable.
If this breaks any existing code using the gerrit package,
that code should be examined, since it has never seen a
mergeable change as actually mergeable in the past.

Change-Id: I769abeed173c7afd7da7b1527f810d0a2db18236
Reviewed-on: https://go-review.googlesource.com/c/149239
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-13 05:43:49 +00:00
Giuseppe Valente 1931831e3d gerrit: add FileInfo status constants
Makes it easier for users of the ListFiles() API to evaluate Status in
FileInfo objects.

Change-Id: I974fefc9ce0fc539cd678f77899630e91f68d5b9
GitHub-Last-Rev: 352dc73960
GitHub-Pull-Request: golang/build#14
Reviewed-on: https://go-review.googlesource.com/c/145657
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-29 21:21:50 +00:00
Giuseppe Valente 453fa3cd1b gerrit: add Client.GetProjectTags method, WebLinkInfo, TagInfo
Change-Id: Iebe0796ecd65b98b75b73b1f4008fef0177fb9c8
GitHub-Last-Rev: 5807f37ca6
GitHub-Pull-Request: golang/build#13
Reviewed-on: https://go-review.googlesource.com/c/143838
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-23 20:50:23 +00:00
Andrew Bonventre 952c4101bf cmd/gerritbot: autoassign reviewers on changes
Look for changes that haven’t had any human aside from the author
on them and assign reviewers/CCs based on entries in golang.org/s/owners.
If no owners can be found, the tag 'no-owners' is added to the
change to prevent gopherbot from making unneeded API calls.

Also updates gopherbot's Dockerfile to use 1.11 and update deps.

Change-Id: I2650a10dd324532d86bc902be419c5f29ae980db
Reviewed-on: https://go-review.googlesource.com/121018
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-09-03 22:18:01 +00:00
Daniel Theophanes c1b72a71f2 gerrit: allow setAuth to fallthrough to netrc lookup
When git has no http cookies, the request for http cookies
will fail because git will exit(1). Ignore this failure
because the output is properly tested either way. This allows
authentication to fallthrough to the netrc lookup.

Correct the netrc lookup under windows. git reads the netrc
file as "_netrc" in the users home directory.

Add a warning at the end of the function that no authentication
was set.

Fixes golang/go#26782

Change-Id: I0ba94ff7fa4b6038d6117156dcc729ddf4616fdc
Reviewed-on: https://go-review.googlesource.com/127855
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-08-03 18:56:37 +00:00
Michael Dorner 7feb1540b0 gerrit: add parameter for pagination in QueryChangesOpt
QueryChangesOpt has now a new pagination field Start for the number of first changes to skip, as it was already implemented for QueryAccountsOpt.

Fixes golang/go#24838

Change-Id: If779a404f256aca1924ce2412c79b821f4f9f639
GitHub-Last-Rev: aa79a753b6
GitHub-Pull-Request: golang/build#8
Reviewed-on: https://go-review.googlesource.com/122584
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-09 13:51:24 +00:00
Andrew Bonventre 99c796b950 gerrit: add support for adding reviewers to a change
Change-Id: I9180296c6ca5d1c981c91edb87bbfefa29223685
Reviewed-on: https://go-review.googlesource.com/114838
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-27 18:05:07 +00:00
Brad Fitzpatrick a9c7bdc7aa gerrit: add support for hashtags
Tested in one-off local tool:

   func main() {
       gc := gerrit.NewClient("https://go-review.googlesource.com/", gerrit.GitCookiesAuth())
       ....

Updates golang/go#24836

Change-Id: I231e3afb4a27e41f9b56968e3e97fa1c31fd8d84
Reviewed-on: https://go-review.googlesource.com/106795
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-04-13 14:30:05 +00:00
Andrew Bonventre 5adabcfcf9 cmd/gerritbot: close GitHub PR when Gerrit change is closed
When a Gerrit change moves into a "closed" state (merged or abandoned),
close the linked GitHub Pull Request with the appropriate message.
If the change has been merged, there is no need to mention the commit
in the message on the PR because the commit message will be linked
from the PR by virtue of the GitHub-Pull-Request: git label. See
https://github.com/golang/scratch/pull/2#issuecomment-358105675 for
an example.

Closed changes are also be cleaned up within b.pendingCLs.

Also removes a nil pointer dereference in the case where the
Gerrit CL does not exist yet, surmising its link from the output
of the push command.

Updates golang/go#18517

Change-Id: Ieb28c1b9d31216d48076b256bf6a65a099a38552
Reviewed-on: https://go-review.googlesource.com/87915
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-01-17 19:46:31 +00:00
Kevin Burke d13a093a9c gerrit: fix vet error
"go vet" now runs when the tests run, and errors on this test.

Change-Id: I239f23f51477530e4bda19793979e519fa371cdf
Reviewed-on: https://go-review.googlesource.com/80302
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-28 21:59:26 +00:00
Tobias Klauser c9ba2777a2 all: fix vet format string warnings
Change-Id: Iec22c99fad05b880c52c9b6d09284fe03967471b
Reviewed-on: https://go-review.googlesource.com/75070
Reviewed-by: Kevin Burke <kev@inburke.com>
2017-11-01 15:41:47 +00:00
Andrew Bonventre f6341f92eb gerrit: add optional message param to Abandon call
Gerrit accepts an optional message that one can use to specify
why they’re abandoning a change. Allow a caller to utilize that.

Change-Id: I16924611275c71c164f796362ea523f05834f4a7
Reviewed-on: https://go-review.googlesource.com/67010
Reviewed-by: Kevin Burke <kev@inburke.com>
2017-09-29 15:02:36 +00:00
Jude Pereira ec36dd2dea x/build/gerrit: add support for querying accounts in Gerrit
Added support for querying accounts in Gerrit. This is a pre-requisite
for golang/go#21216

Change-Id: Ic6776ddf18a23e347d0eb7edf91a934d2feb01c9
Reviewed-on: https://go-review.googlesource.com/61970
Reviewed-by: Kevin Burke <kev@inburke.com>
2017-09-07 19:25:33 +00:00
Brad Fitzpatrick 73f88a6d4c all: add README.md files where missing, and tool to keep them updated
Change-Id: I385171c415bf168c04c6c3a7a996bff88964af84
Reviewed-on: https://go-review.googlesource.com/52856
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2017-08-02 22:17:52 +00:00
Lann Martin be55dc02bb gerrit: add TimeStamp.MarshalJSON method
This mirrors TimeStamp.UnmarshalJSON. Helps in emulating a Gerrit server
in integration tests.

Add tests for TimeStamp.UnmarshalJSON and .MarshalJSON.

Fixes golang/go#21261

Change-Id: I972164c35308f5c5c46cf68847d52da2475182c3
Reviewed-on: https://go-review.googlesource.com/52471
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-08-02 03:56:33 +00:00
Kevin Burke bf074728a2 gerrit: Fix tests
We changed the API for this but I forgot to update the tests to match
the new API.

Change-Id: If31536655d99bcc403c9095198092693a05c4f02
Reviewed-on: https://go-review.googlesource.com/48598
Reviewed-by: Kevin Burke <kev@inburke.com>
2017-07-15 05:15:33 +00:00
Kevin Burke fefb8562f0 gerrit: switch GetChange argument type
Matching what's currently defined in the Gerrit package, instead of
the int32 type defined in maintner.

Change-Id: I463c7a83e9c9e7d933a2375790d35d59056ea09d
Reviewed-on: https://go-review.googlesource.com/48570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-14 17:58:47 +00:00
Kevin Burke afc6d121f3 gerrit: add GetChange API call
GetChange returns details about a specific change, and we need it for
CL 46390.

Change-Id: I0047e7170e4c9f822663640e28ee4eaf24b184de
Reviewed-on: https://go-review.googlesource.com/48553
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-07-14 17:27:11 +00:00
Brad Fitzpatrick 891b12dcbd cmd/gopherstats, internal/gophers: start of tool to collect community stats
Total mess, but a functional mess, and a starting point for the future.

Change-Id: Ifcc72660f30a0ee2692668b4ea53acd1c4015777
Reviewed-on: https://go-review.googlesource.com/41077
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-05-03 17:36:15 +00:00
Brad Fitzpatrick bce074b887 gerrit: switch to use std context package, require Go 1.7+
This ends support for Go 1.6.

Change-Id: If7765a15add556a5a7a881b24b1a38d96ff10841
Reviewed-on: https://go-review.googlesource.com/40938
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-04-18 05:16:09 +00:00
Brad Fitzpatrick c0c79826e0 gerrit: add ListProjects method
Change-Id: I04209313610b42813fc4f9697a4c5ec7366c627f
Reviewed-on: https://go-review.googlesource.com/38717
Reviewed-by: Kevin Burke <kev@inburke.com>
2017-03-27 19:32:05 +00:00