Revert "[Buildbucket] Validate gerrit changelist hostnames."
This reverts commit bb21c01819ebd9788ee4034d523d0996e9af2c21.
Reason for revert: Let's roll this back until builders produce valid data; Otherwise Buildbucket is undeployable.
Original change's description:
> [Buildbucket] Validate gerrit changelist hostnames.
>
> Stop accepting invalid gerrit changelists in builds.
> This is causing problems downstream in LUCI Analysis.
>
> BUG=b:261350048
> TEST=Integration tests
>
> Change-Id: Ide0065000913509dab08be8e37fcd4f1b3ce68cd
> Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/luci-go/+/4075220
> Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
> Commit-Queue: Patrick Meiring <meiring@google.com>
Bug: b:261350048
Change-Id: Id619e48aa9b51576be6dc120115177f2a3a7bf63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/luci-go/+/4087520
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
diff --git a/buildbucket/appengine/rpc/schedule_build.go b/buildbucket/appengine/rpc/schedule_build.go
index dc0e9c6..6ed9ff7 100644
--- a/buildbucket/appengine/rpc/schedule_build.go
+++ b/buildbucket/appengine/rpc/schedule_build.go
@@ -49,11 +49,6 @@
"go.chromium.org/luci/buildbucket/protoutil"
)
-// Allow hostnames permitted by
-// https://www.rfc-editor.org/rfc/rfc1123#page-13. (Note that
-// the 255 character limit must be seperately applied.)
-var hostnameRE = regexp.MustCompile(`^[a-z0-9][a-z0-9-]+(\.[a-z0-9-]+)*$`)
-
func min(i, j int) int {
if i < j {
return i
@@ -120,10 +115,6 @@
return errors.Reason("change must be specified").Err()
case ch.Host == "":
return errors.Reason("host must be specified").Err()
- case !hostnameRE.MatchString(ch.Host):
- return errors.Reason("host does not match pattern %q", hostnameRE).Err()
- case len(ch.Host) > 255:
- return errors.Reason("host must not exceed 255 characters").Err()
case ch.Patchset == 0:
return errors.Reason("patchset must be specified").Err()
case ch.Project == "":
diff --git a/buildbucket/appengine/rpc/schedule_build_test.go b/buildbucket/appengine/rpc/schedule_build_test.go
index 9a7ab94..fdba035 100644
--- a/buildbucket/appengine/rpc/schedule_build_test.go
+++ b/buildbucket/appengine/rpc/schedule_build_test.go
@@ -19,7 +19,6 @@
"encoding/base64"
"math/rand"
"strconv"
- "strings"
"testing"
"time"
@@ -6198,50 +6197,18 @@
})
Convey("host", func() {
- Convey("not specified", func() {
- req := &pb.ScheduleBuildRequest{
- GerritChanges: []*pb.GerritChange{
- {
- Change: 1,
- Patchset: 1,
- Project: "project",
- },
+ req := &pb.ScheduleBuildRequest{
+ GerritChanges: []*pb.GerritChange{
+ {
+ Change: 1,
+ Patchset: 1,
+ Project: "project",
},
- TemplateBuildId: 1,
- }
- err := validateSchedule(req, nil, nil)
- So(err, ShouldErrLike, "host must be specified")
- })
- Convey("invalid", func() {
- req := &pb.ScheduleBuildRequest{
- GerritChanges: []*pb.GerritChange{
- {
- Change: 1,
- Host: "https://somehost", // host should not include the protocol.
- Patchset: 1,
- Project: "project",
- },
- },
- TemplateBuildId: 1,
- }
- err := validateSchedule(req, nil, nil)
- So(err, ShouldErrLike, "host does not match pattern")
- })
- Convey("too long", func() {
- req := &pb.ScheduleBuildRequest{
- GerritChanges: []*pb.GerritChange{
- {
- Change: 1,
- Host: strings.Repeat("h", 256),
- Patchset: 1,
- Project: "project",
- },
- },
- TemplateBuildId: 1,
- }
- err := validateSchedule(req, nil, nil)
- So(err, ShouldErrLike, "host must not exceed 255 characters")
- })
+ },
+ TemplateBuildId: 1,
+ }
+ err := validateSchedule(req, nil, nil)
+ So(err, ShouldErrLike, "host must be specified")
})
Convey("patchset", func() {