From a1afbb986d63bba6a75971b978f18f500388445a Mon Sep 17 00:00:00 2001 From: "tandrii@chromium.org" Date: Mon, 15 Feb 2016 10:25:50 +0000 Subject: [PATCH] Roll cq_client. From infra_internal, revisions 6f979a..cd0150f. TBR=sergiyb@chromium.org,machenbach@chromium.org BUG= Review URL: https://codereview.chromium.org/1697053003 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@298789 0039d316-1c4b-4281-b951-d872f2087c98 --- third_party/cq_client/README.md | 56 +++++--- third_party/cq_client/cq.pb.go | 119 +++++++++-------- third_party/cq_client/cq.proto | 23 ++-- third_party/cq_client/cq_pb2.py | 37 +++--- third_party/cq_client/test/__init__.py | 2 - .../cq_client/test/validate_config_test.py | 66 --------- .../{test => testdata}/cq_gerrit.cfg | 0 .../{test => testdata}/cq_rietveld.cfg | 1 + third_party/cq_client/validate_config.py | 125 ------------------ 9 files changed, 143 insertions(+), 286 deletions(-) delete mode 100644 third_party/cq_client/test/__init__.py delete mode 100755 third_party/cq_client/test/validate_config_test.py rename third_party/cq_client/{test => testdata}/cq_gerrit.cfg (100%) rename third_party/cq_client/{test => testdata}/cq_rietveld.cfg (96%) delete mode 100644 third_party/cq_client/validate_config.py diff --git a/third_party/cq_client/README.md b/third_party/cq_client/README.md index f1bb79c2d..d3a264f02 100644 --- a/third_party/cq_client/README.md +++ b/third_party/cq_client/README.md @@ -1,29 +1,55 @@ +# CQ Client Library. + This directory contains CQ client library to be distributed to other repos. If you need to modify some files in this directory, please make sure that you are changing the canonical version of the source code and not one of the copies, which should only be updated as a whole using Glyco (when available, see [chromium issue 489420](http://crbug.com/489420)). -The canonical version is located at `https://chrome-internal.googlesource.com/ -infra/infra_internal/+/master/commit_queue/cq_client`. +The canonical version is located at +[https://chrome-internal.googlesource.com/infra/infra_internal/+/master/commit_queue/cq_client](). + +When modifying cq.proto, consider adding checks to validator in +[https://chrome-internal.googlesource.com/infra/infra_internal/+/master/appengine/commit_queue/src/commitqueue/validate.go](). + + +## Generation of Python and Go bindings + +### tl;dr + + make + + +### Details + +All commands below assume you are working in a standard infra_internal gclient +checkout (e.g., after you ran `mkdir src && cd src && fetch infra_internal`) and +are in current directory of this README.md (that is, in +`cd infra_internal/commit_queue/cq_client`). -You'll need to use protoc version 2.6.1 and -recent golang/protobuf package. Sadly, the latter has neither tags nor versions. +To generate Python's `cq_pb2.py` you'll need to get and `protoc` of version +**2.6.1**. You can get it by `make py-prepare`. + + make py -You can get protobuf by downloading archive from -https://github.com/google/protobuf/tree/v2.6.1 and manually building it. As for -golang compiler, if you have go configured, just +To generate Golang's protobuf file `cq.pb.go`, you'll need to bootstrap +infra/infra repository and go utilities `make go-prepare`. - go get -u github.com/golang/protobuf/{proto,protoc-gen-go} + make go -TODO(tandrii,sergiyb): decide how to pin the go protobuf generator. +## Notes -To generate `cq_pb2.py` and `cq.pb.go`: +1. Please make sure to use proto3-compatible yntax, e.g. no default +values, no required fields. As of this writing (Jan 2016), +the Go protobuf compiler has been upgraded to 3.0.0. So, if you can generate go +bindings, all is good. - cd commit_queue/cq_client - protoc cq.proto --python_out $(pwd) --go_out $(pwd) +2. If after generating Python binding, CQ tests fail with: -Additionally, please make sure to use proto3-compatible syntax, e.g. no default -values, no required fields. Ideally, we should use proto3 generator already, -however alpha version thereof is still unstable. + TypeError: __init__() got an unexpected keyword argument 'syntax' +You've probably used 3.0.0 protoc generator. We should eventually switch to 3x +Python version as well, but it requires upgrading infra's Python ENV to newer +package. See [bootstrap/README.md](../../bootstrap/README.md) for more +information. We may end up deprecating Python before all infra's Python code +can be moved to protobuf v3. diff --git a/third_party/cq_client/cq.pb.go b/third_party/cq_client/cq.pb.go index 1f48f1f9a..386053ca1 100644 --- a/third_party/cq_client/cq.pb.go +++ b/third_party/cq_client/cq.pb.go @@ -230,9 +230,12 @@ func (m *Rietveld) GetProjectBases() []string { // see it. This will come handy to enable and customize the CQ-related workflows // for your project. type Gerrit struct { - // If set, tells CQ to set score on a given label to mark result of CQ run. - // Typically, this is Commit-Queue-Verified label. - // If not set, CQ will just try to hit submit button. + // Optional. If set, tells CQ vote on a given label to mark result of CQ run. + // The vote is either -1 if failed or 1 on success, and will be given on + // non-dry runs only. + // This vote can then be used in Gerrit's rule for submitting issues, so as to + // require CQ run. CQ will attempt to submit issue only after setting this + // label. CqVerifiedLabel *string `protobuf:"bytes,1,opt,name=cq_verified_label" json:"cq_verified_label,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -306,12 +309,9 @@ func (m *Verifiers) GetSignCla() *Verifiers_SignCLAVerifier { } type Verifiers_ReviewerLgtmVerifier struct { - // Required. Name of the chrome-infra-auth group, which contains the - // list of identities authorized to approve (lgtm) a CL. This list is also - // known as a committer list and often corresponds to the list of accounts - // that have direct commit/push access to the repository. Some older lists - // are still stored in the CQ source code, but are being moved to the new - // location (https://crbug.com/511311). + // Required. Name of the chrome-infra-auth group, which contains the list of + // identities authorized to approve (lgtm) a CL and trigger CQ run or dry + // run. CommitterList *string `protobuf:"bytes,1,opt,name=committer_list" json:"committer_list,omitempty"` // Number of seconds to wait for LGTM on CQ. Default value is 0. MaxWaitSecs *int32 `protobuf:"varint,2,opt,name=max_wait_secs" json:"max_wait_secs,omitempty"` @@ -321,7 +321,11 @@ type Verifiers_ReviewerLgtmVerifier struct { // "non-committer,\n_not_ a full super star committer.\nSee " // "http://www.chromium.org/getting-involved/become-a-committer\nNote that " // "this has nothing to do with OWNERS files." - NoLgtmMsg *string `protobuf:"bytes,3,opt,name=no_lgtm_msg" json:"no_lgtm_msg,omitempty"` + NoLgtmMsg *string `protobuf:"bytes,3,opt,name=no_lgtm_msg" json:"no_lgtm_msg,omitempty"` + // Optional, but recommended. Name of the chrome-infra-auth group, + // which contains the list of identities authorized to trigger CQ dry run. + // This is usually the same group as tryjob-access. + DryRunAccessList *string `protobuf:"bytes,4,opt,name=dry_run_access_list" json:"dry_run_access_list,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -353,6 +357,13 @@ func (m *Verifiers_ReviewerLgtmVerifier) GetNoLgtmMsg() string { return "" } +func (m *Verifiers_ReviewerLgtmVerifier) GetDryRunAccessList() string { + if m != nil && m.DryRunAccessList != nil { + return *m.DryRunAccessList + } + return "" +} + type Verifiers_TreeStatusLgtmVerifier struct { // Required. URL of the project tree status app. TreeStatusUrl *string `protobuf:"bytes,1,opt,name=tree_status_url" json:"tree_status_url,omitempty"` @@ -559,48 +570,48 @@ func init() { } var fileDescriptor0 = []byte{ - // 674 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x54, 0x4d, 0x4f, 0xdb, 0x40, - 0x10, 0x55, 0x08, 0x49, 0x9c, 0x31, 0x90, 0x62, 0x02, 0x18, 0xd3, 0x0f, 0xa0, 0x52, 0x55, 0xb5, - 0x95, 0x25, 0x52, 0xa9, 0xf7, 0xc2, 0xa1, 0x6a, 0xcb, 0x09, 0xaa, 0x1e, 0x7a, 0x59, 0xad, 0xed, - 0x89, 0x59, 0xea, 0x0f, 0x58, 0xaf, 0x03, 0xf9, 0x57, 0xfd, 0x35, 0x3d, 0xf5, 0xd6, 0x3f, 0xd2, - 0xd9, 0xb5, 0x13, 0xe2, 0x14, 0x4e, 0x89, 0xe7, 0xbd, 0x19, 0xbf, 0x99, 0x79, 0x63, 0xb0, 0xc2, - 0x1b, 0xff, 0x5a, 0xe6, 0x2a, 0x3f, 0xfa, 0xbb, 0x02, 0xdd, 0xd3, 0x3c, 0x1b, 0x8b, 0xd8, 0x19, - 0x40, 0x6f, 0x82, 0xb2, 0x10, 0x79, 0xe6, 0xb6, 0x0e, 0x5a, 0xaf, 0x3b, 0x3a, 0x10, 0xde, 0xb0, - 0x8c, 0xa7, 0xe8, 0xae, 0x50, 0xa0, 0xef, 0x3c, 0x83, 0x3e, 0x31, 0xc4, 0x58, 0x10, 0xcd, 0x6d, - 0x53, 0xc8, 0x1e, 0x81, 0xff, 0x7d, 0x16, 0x71, 0xb6, 0x61, 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45, 0xc6, 0xd1, 0xff, 0x42, 0x73, 0x74, 0xf5, - 0xbc, 0xdf, 0x3e, 0x9e, 0x5f, 0x3d, 0x9e, 0xeb, 0x9c, 0xea, 0x4e, 0xbd, 0x33, 0xe8, 0x9d, 0x94, - 0x22, 0x89, 0x48, 0xc8, 0x1a, 0xac, 0x9a, 0xf3, 0x6c, 0xcd, 0x8c, 0xa9, 0xa4, 0x88, 0xc9, 0xdf, - 0xe4, 0x94, 0x60, 0x3a, 0x3f, 0xda, 0x6d, 0xbc, 0xbb, 0xa6, 0x72, 0x29, 0x66, 0x8a, 0xd1, 0x9f, - 0x90, 0x7e, 0x79, 0x8c, 0x66, 0x13, 0x2b, 0xde, 0x57, 0xe8, 0xd6, 0x12, 0x9b, 0xc5, 0xde, 0x83, - 0x15, 0x54, 0x6f, 0xa9, 0x4c, 0xb9, 0x6c, 0x8a, 0xa5, 0x26, 0x0d, 0xd3, 0xfb, 0xd5, 0x82, 0xcd, - 0xff, 0x04, 0xeb, 0xd3, 0x68, 0xf6, 0x7e, 0x53, 0xe6, 0x8a, 0xd7, 0x1f, 0x19, 0x3a, 0xfd, 0x38, - 0xc9, 0x03, 0x9e, 0x34, 0xb0, 0x6a, 0x85, 0x4f, 0x61, 0x38, 0xe6, 0x22, 0x29, 0x25, 0xd6, 0xe0, - 0x2d, 0x8a, 0xf8, 0x52, 0x99, 0x5d, 0x76, 0x9c, 0x57, 0xf0, 0x5c, 0x49, 0x9e, 0x15, 0x42, 0xf7, - 0xf5, 0x20, 0x6f, 0x75, 0x56, 0x45, 0x9f, 0x62, 0x5e, 0xaa, 0x26, 0xaa, 0x3f, 0x3d, 0x1d, 0x6f, - 0x13, 0x06, 0x4b, 0x06, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0x0c, 0x91, 0xda, 0xff, 0x1e, 0x05, - 0x00, 0x00, + // 687 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0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0x7e, 0xb2, 0x51, 0x30, 0x99, + 0x9d, 0xe8, 0x7d, 0x7c, 0xbc, 0xa7, 0x72, 0x29, 0x66, 0x9a, 0xd1, 0x4b, 0x48, 0x4f, 0x1e, 0xa3, + 0x51, 0x64, 0xc3, 0xfb, 0x0a, 0xed, 0xba, 0xc5, 0xe5, 0x62, 0xef, 0xc1, 0x0a, 0xaa, 0xbf, 0x54, + 0x8e, 0x5d, 0x75, 0xcc, 0xca, 0x90, 0x86, 0xe9, 0xfd, 0x6c, 0xc0, 0xee, 0x3f, 0x0d, 0x97, 0x1b, + 0x59, 0x9e, 0xfd, 0xa1, 0xc8, 0x35, 0xaf, 0x6f, 0x20, 0xba, 0x17, 0xe2, 0x24, 0x0f, 0x78, 0xb2, + 0x84, 0x55, 0xfb, 0xfd, 0x1f, 0xfa, 0x43, 0x2e, 0x92, 0x42, 0x62, 0x0d, 0x8e, 0x51, 0xc4, 0xb7, + 0xda, 0x2c, 0xba, 0xe5, 0xbc, 0x82, 0xe7, 0x5a, 0xf2, 0x4c, 0x89, 0x72, 0xae, 0x27, 0x79, 0x9b, + 0xd3, 0x2a, 0xe5, 0x39, 0xcd, 0x0b, 0xbd, 0x8c, 0x96, 0xf7, 0x52, 0xcb, 0xdb, 0x85, 0xde, 0x8a, + 0x3b, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x92, 0xf5, 0x6a, 0x3b, 0x05, 0x00, 0x00, } diff --git a/third_party/cq_client/cq.proto b/third_party/cq_client/cq.proto index 2e57970a3..1727d273f 100644 --- a/third_party/cq_client/cq.proto +++ b/third_party/cq_client/cq.proto @@ -95,9 +95,12 @@ message Rietveld { // see it. This will come handy to enable and customize the CQ-related workflows // for your project. message Gerrit { - // If set, tells CQ to set score on a given label to mark result of CQ run. - // Typically, this is Commit-Queue-Verified label. - // If not set, CQ will just try to hit submit button. + // Optional. If set, tells CQ vote on a given label to mark result of CQ run. + // The vote is either -1 if failed or 1 on success, and will be given on + // non-dry runs only. + // This vote can then be used in Gerrit's rule for submitting issues, so as to + // require CQ run. CQ will attempt to submit issue only after setting this + // label. optional string cq_verified_label = 1; } @@ -126,12 +129,9 @@ message Verifiers { optional SignCLAVerifier sign_cla = 4; message ReviewerLgtmVerifier { - // Required. Name of the chrome-infra-auth group, which contains the - // list of identities authorized to approve (lgtm) a CL. This list is also - // known as a committer list and often corresponds to the list of accounts - // that have direct commit/push access to the repository. Some older lists - // are still stored in the CQ source code, but are being moved to the new - // location (https://crbug.com/511311). + // Required. Name of the chrome-infra-auth group, which contains the list of + // identities authorized to approve (lgtm) a CL and trigger CQ run or dry + // run. optional string committer_list = 1; // Number of seconds to wait for LGTM on CQ. Default value is 0. @@ -144,6 +144,11 @@ message Verifiers { // "http://www.chromium.org/getting-involved/become-a-committer\nNote that " // "this has nothing to do with OWNERS files." optional string no_lgtm_msg = 3; + + // Optional, but recommended. Name of the chrome-infra-auth group, + // which contains the list of identities authorized to trigger CQ dry run. + // This is usually the same group as tryjob-access. + optional string dry_run_access_list = 4; } message TreeStatusLgtmVerifier { diff --git a/third_party/cq_client/cq_pb2.py b/third_party/cq_client/cq_pb2.py index 788566385..117c199f6 100644 --- a/third_party/cq_client/cq_pb2.py +++ b/third_party/cq_client/cq_pb2.py @@ -26,7 +26,7 @@ _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor.FileDescriptor( name='cq.proto', package='', - serialized_pb=_b('\n\x08\x63q.proto\"\xe3\x02\n\x06\x43onfig\x12\x0f\n\x07version\x18\x01 \x01(\x05\x12\x0f\n\x07\x63q_name\x18\x02 \x01(\t\x12\x1d\n\tverifiers\x18\x03 \x01(\x0b\x32\n.Verifiers\x12\x15\n\rcq_status_url\x18\x04 \x01(\t\x12!\n\x19hide_ref_in_committed_msg\x18\x05 \x01(\x08\x12\x1a\n\x12\x63ommit_burst_delay\x18\x06 \x01(\x05\x12\x18\n\x10max_commit_burst\x18\x07 \x01(\x05\x12\x15\n\rin_production\x18\x08 \x01(\x08\x12\x1b\n\x08rietveld\x18\t \x01(\x0b\x32\t.Rietveld\x12\x17\n\x06gerrit\x18\x0f \x01(\x0b\x32\x07.Gerrit\x12\x14\n\x0cgit_repo_url\x18\n \x01(\t\x12\x12\n\ntarget_ref\x18\x0b \x01(\t\x12\x14\n\x0csvn_repo_url\x18\x0c \x01(\t\x12\x1b\n\x13\x64raining_start_time\x18\r \x01(\t\".\n\x08Rietveld\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x15\n\rproject_bases\x18\x02 \x03(\t\"#\n\x06Gerrit\x12\x19\n\x11\x63q_verified_label\x18\x01 \x01(\t\"\xd6\x06\n\tVerifiers\x12\x36\n\rreviewer_lgtm\x18\x01 \x01(\x0b\x32\x1f.Verifiers.ReviewerLgtmVerifier\x12\x36\n\x0btree_status\x18\x02 \x01(\x0b\x32!.Verifiers.TreeStatusLgtmVerifier\x12*\n\x07try_job\x18\x03 \x01(\x0b\x32\x19.Verifiers.TryJobVerifier\x12,\n\x08sign_cla\x18\x04 \x01(\x0b\x32\x1a.Verifiers.SignCLAVerifier\x1aZ\n\x14ReviewerLgtmVerifier\x12\x16\n\x0e\x63ommitter_list\x18\x01 \x01(\t\x12\x15\n\rmax_wait_secs\x18\x02 \x01(\x05\x12\x13\n\x0bno_lgtm_msg\x18\x03 \x01(\t\x1a\x31\n\x16TreeStatusLgtmVerifier\x12\x17\n\x0ftree_status_url\x18\x01 \x01(\t\x1a\xdc\x03\n\x0eTryJobVerifier\x12\x31\n\x07\x62uckets\x18\x01 \x03(\x0b\x32 .Verifiers.TryJobVerifier.Bucket\x12I\n\x14try_job_retry_config\x18\x02 \x01(\x0b\x32+.Verifiers.TryJobVerifier.TryJobRetryConfig\x1aL\n\x07\x42uilder\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0ctriggered_by\x18\x02 \x01(\t\x12\x1d\n\x15\x65xperiment_percentage\x18\x04 \x01(\x02\x1aK\n\x06\x42ucket\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x33\n\x08\x62uilders\x18\x02 \x03(\x0b\x32!.Verifiers.TryJobVerifier.Builder\x1a\xb0\x01\n\x11TryJobRetryConfig\x12\x1b\n\x13try_job_retry_quota\x18\x01 \x01(\x05\x12\x1a\n\x12global_retry_quota\x18\x02 \x01(\x05\x12\x1c\n\x14\x66\x61ilure_retry_weight\x18\x03 \x01(\x05\x12&\n\x1etransient_failure_retry_weight\x18\x04 \x01(\x05\x12\x1c\n\x14timeout_retry_weight\x18\x05 \x01(\x05\x1a\x11\n\x0fSignCLAVerifier') + serialized_pb=_b('\n\x08\x63q.proto\"\xe3\x02\n\x06\x43onfig\x12\x0f\n\x07version\x18\x01 \x01(\x05\x12\x0f\n\x07\x63q_name\x18\x02 \x01(\t\x12\x1d\n\tverifiers\x18\x03 \x01(\x0b\x32\n.Verifiers\x12\x15\n\rcq_status_url\x18\x04 \x01(\t\x12!\n\x19hide_ref_in_committed_msg\x18\x05 \x01(\x08\x12\x1a\n\x12\x63ommit_burst_delay\x18\x06 \x01(\x05\x12\x18\n\x10max_commit_burst\x18\x07 \x01(\x05\x12\x15\n\rin_production\x18\x08 \x01(\x08\x12\x1b\n\x08rietveld\x18\t \x01(\x0b\x32\t.Rietveld\x12\x17\n\x06gerrit\x18\x0f \x01(\x0b\x32\x07.Gerrit\x12\x14\n\x0cgit_repo_url\x18\n \x01(\t\x12\x12\n\ntarget_ref\x18\x0b \x01(\t\x12\x14\n\x0csvn_repo_url\x18\x0c \x01(\t\x12\x1b\n\x13\x64raining_start_time\x18\r \x01(\t\".\n\x08Rietveld\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x15\n\rproject_bases\x18\x02 \x03(\t\"#\n\x06Gerrit\x12\x19\n\x11\x63q_verified_label\x18\x01 \x01(\t\"\xf3\x06\n\tVerifiers\x12\x36\n\rreviewer_lgtm\x18\x01 \x01(\x0b\x32\x1f.Verifiers.ReviewerLgtmVerifier\x12\x36\n\x0btree_status\x18\x02 \x01(\x0b\x32!.Verifiers.TreeStatusLgtmVerifier\x12*\n\x07try_job\x18\x03 \x01(\x0b\x32\x19.Verifiers.TryJobVerifier\x12,\n\x08sign_cla\x18\x04 \x01(\x0b\x32\x1a.Verifiers.SignCLAVerifier\x1aw\n\x14ReviewerLgtmVerifier\x12\x16\n\x0e\x63ommitter_list\x18\x01 \x01(\t\x12\x15\n\rmax_wait_secs\x18\x02 \x01(\x05\x12\x13\n\x0bno_lgtm_msg\x18\x03 \x01(\t\x12\x1b\n\x13\x64ry_run_access_list\x18\x04 \x01(\t\x1a\x31\n\x16TreeStatusLgtmVerifier\x12\x17\n\x0ftree_status_url\x18\x01 \x01(\t\x1a\xdc\x03\n\x0eTryJobVerifier\x12\x31\n\x07\x62uckets\x18\x01 \x03(\x0b\x32 .Verifiers.TryJobVerifier.Bucket\x12I\n\x14try_job_retry_config\x18\x02 \x01(\x0b\x32+.Verifiers.TryJobVerifier.TryJobRetryConfig\x1aL\n\x07\x42uilder\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0ctriggered_by\x18\x02 \x01(\t\x12\x1d\n\x15\x65xperiment_percentage\x18\x04 \x01(\x02\x1aK\n\x06\x42ucket\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x33\n\x08\x62uilders\x18\x02 \x03(\x0b\x32!.Verifiers.TryJobVerifier.Builder\x1a\xb0\x01\n\x11TryJobRetryConfig\x12\x1b\n\x13try_job_retry_quota\x18\x01 \x01(\x05\x12\x1a\n\x12global_retry_quota\x18\x02 \x01(\x05\x12\x1c\n\x14\x66\x61ilure_retry_weight\x18\x03 \x01(\x05\x12&\n\x1etransient_failure_retry_weight\x18\x04 \x01(\x05\x12\x1c\n\x14timeout_retry_weight\x18\x05 \x01(\x05\x1a\x11\n\x0fSignCLAVerifier') ) _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -249,6 +249,13 @@ _VERIFIERS_REVIEWERLGTMVERIFIER = _descriptor.Descriptor( message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), + _descriptor.FieldDescriptor( + name='dry_run_access_list', full_name='Verifiers.ReviewerLgtmVerifier.dry_run_access_list', index=3, + number=4, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), ], extensions=[ ], @@ -261,7 +268,7 @@ _VERIFIERS_REVIEWERLGTMVERIFIER = _descriptor.Descriptor( oneofs=[ ], serialized_start=671, - serialized_end=761, + serialized_end=790, ) _VERIFIERS_TREESTATUSLGTMVERIFIER = _descriptor.Descriptor( @@ -289,8 +296,8 @@ _VERIFIERS_TREESTATUSLGTMVERIFIER = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=763, - serialized_end=812, + serialized_start=792, + serialized_end=841, ) _VERIFIERS_TRYJOBVERIFIER_BUILDER = _descriptor.Descriptor( @@ -332,8 +339,8 @@ _VERIFIERS_TRYJOBVERIFIER_BUILDER = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=959, - serialized_end=1035, + serialized_start=988, + serialized_end=1064, ) _VERIFIERS_TRYJOBVERIFIER_BUCKET = _descriptor.Descriptor( @@ -368,8 +375,8 @@ _VERIFIERS_TRYJOBVERIFIER_BUCKET = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1037, - serialized_end=1112, + serialized_start=1066, + serialized_end=1141, ) _VERIFIERS_TRYJOBVERIFIER_TRYJOBRETRYCONFIG = _descriptor.Descriptor( @@ -425,8 +432,8 @@ _VERIFIERS_TRYJOBVERIFIER_TRYJOBRETRYCONFIG = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1115, - serialized_end=1291, + serialized_start=1144, + serialized_end=1320, ) _VERIFIERS_TRYJOBVERIFIER = _descriptor.Descriptor( @@ -461,8 +468,8 @@ _VERIFIERS_TRYJOBVERIFIER = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=815, - serialized_end=1291, + serialized_start=844, + serialized_end=1320, ) _VERIFIERS_SIGNCLAVERIFIER = _descriptor.Descriptor( @@ -483,8 +490,8 @@ _VERIFIERS_SIGNCLAVERIFIER = _descriptor.Descriptor( extension_ranges=[], oneofs=[ ], - serialized_start=1293, - serialized_end=1310, + serialized_start=1322, + serialized_end=1339, ) _VERIFIERS = _descriptor.Descriptor( @@ -534,7 +541,7 @@ _VERIFIERS = _descriptor.Descriptor( oneofs=[ ], serialized_start=456, - serialized_end=1310, + serialized_end=1339, ) _CONFIG.fields_by_name['verifiers'].message_type = _VERIFIERS diff --git a/third_party/cq_client/test/__init__.py b/third_party/cq_client/test/__init__.py deleted file mode 100644 index 139597f9c..000000000 --- a/third_party/cq_client/test/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/third_party/cq_client/test/validate_config_test.py b/third_party/cq_client/test/validate_config_test.py deleted file mode 100755 index 3e5121afc..000000000 --- a/third_party/cq_client/test/validate_config_test.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Unit tests for tools/validate_config.py.""" - -import mock -import os -import unittest - -from cq_client import cq_pb2 -from cq_client import validate_config - - -TEST_DIR = os.path.dirname(os.path.abspath(__file__)) - - -class TestValidateConfig(unittest.TestCase): - def test_is_valid_rietveld(self): - with open(os.path.join(TEST_DIR, 'cq_rietveld.cfg'), 'r') as test_config: - self.assertTrue(validate_config.IsValid(test_config.read())) - - def test_is_valid_gerrit(self): - with open(os.path.join(TEST_DIR, 'cq_gerrit.cfg'), 'r') as test_config: - self.assertTrue(validate_config.IsValid(test_config.read())) - - def test_one_codereview(self): - with open(os.path.join(TEST_DIR, 'cq_gerrit.cfg'), 'r') as gerrit_config: - data = gerrit_config.read() - data += '\n'.join([ - 'rietveld{', - 'url: "https://blabla.com"', - '}' - ]) - self.assertFalse(validate_config.IsValid(data)) - - def test_has_field(self): - config = cq_pb2.Config() - - self.assertFalse(validate_config._HasField(config, 'version')) - config.version = 1 - self.assertTrue(validate_config._HasField(config, 'version')) - - self.assertFalse(validate_config._HasField( - config, 'rietveld.project_bases')) - config.rietveld.project_bases.append('foo://bar') - self.assertTrue(validate_config._HasField( - config, 'rietveld.project_bases')) - - self.assertFalse(validate_config._HasField( - config, 'verifiers.try_job.buckets')) - self.assertFalse(validate_config._HasField( - config, 'verifiers.try_job.buckets.name')) - - bucket = config.verifiers.try_job.buckets.add() - bucket.name = 'tryserver.chromium.linux' - - - self.assertTrue(validate_config._HasField( - config, 'verifiers.try_job.buckets')) - self.assertTrue(validate_config._HasField( - config, 'verifiers.try_job.buckets.name')) - - config.verifiers.try_job.buckets.add() - self.assertFalse(validate_config._HasField( - config, 'verifiers.try_job.buckets.name')) diff --git a/third_party/cq_client/test/cq_gerrit.cfg b/third_party/cq_client/testdata/cq_gerrit.cfg similarity index 100% rename from third_party/cq_client/test/cq_gerrit.cfg rename to third_party/cq_client/testdata/cq_gerrit.cfg diff --git a/third_party/cq_client/test/cq_rietveld.cfg b/third_party/cq_client/testdata/cq_rietveld.cfg similarity index 96% rename from third_party/cq_client/test/cq_rietveld.cfg rename to third_party/cq_client/testdata/cq_rietveld.cfg index dd7307c24..941fecc06 100644 --- a/third_party/cq_client/test/cq_rietveld.cfg +++ b/third_party/cq_client/testdata/cq_rietveld.cfg @@ -16,6 +16,7 @@ rietveld { verifiers { reviewer_lgtm: { committer_list: "project-chromium-committers" + dry_run_access_list: "project-chromium-tryjob-access" max_wait_secs: 600 no_lgtm_msg: "LGTM is missing" } diff --git a/third_party/cq_client/validate_config.py b/third_party/cq_client/validate_config.py deleted file mode 100644 index b6d73db9b..000000000 --- a/third_party/cq_client/validate_config.py +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env python -# Copyright 2015 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""CQ config validation library.""" - -import argparse -# This file was originally copied together with the cq_client library from the -# internal commit_queue repository and then modified to import protobuf26 -# instead of google.protobuf to prevent conflicts with a different version of -# google.protobuf that some users of depot_tools have installed. If you need to -# update this file, please make similar changes again and add this comment back. -# More details on why we chose to rename the package can be found in the file -# depot_tools/third_party/protobuf26/README.chromium. -import protobuf26 as protobuf -import logging -import re -import sys - -from cq_client import cq_pb2 - - -REQUIRED_FIELDS = [ - 'version', - 'verifiers', - 'cq_name', -] - -LEGACY_FIELDS = [ - 'svn_repo_url', -] - -EMAIL_REGEXP = '^[^@]+@[^@]+\.[^@]+$' - - -def _HasField(message, field_path): - """Checks that at least one field with given path exist in the proto message. - - This function correctly handles repeated fields and will make sure that each - repeated field will have required sub-path, e.g. if 'abc' is a repeated field - and field_path is 'abc.def', then the function will only return True when each - entry for 'abc' will contain at least one value for 'def'. - - Args: - message (google.protobuf.message.Message): Protocol Buffer message to check. - field_path (string): Path to the target field separated with ".". - - Return: - True if at least one such field is explicitly set in the message. - """ - path_parts = field_path.split('.', 1) - field_name = path_parts[0] - sub_path = path_parts[1] if len(path_parts) == 2 else None - - field_labels = {fd.name: fd.label for fd in message.DESCRIPTOR.fields} - repeated_field = (field_labels[field_name] == - protobuf.descriptor.FieldDescriptor.LABEL_REPEATED) - - if sub_path: - field = getattr(message, field_name) - if repeated_field: - if not field: - return False - return all(_HasField(entry, sub_path) for entry in field) - else: - return _HasField(field, sub_path) - else: - if repeated_field: - return len(getattr(message, field_name)) > 0 - else: - return message.HasField(field_name) - - -def IsValid(cq_config): - """Validates a CQ config and prints errors/warnings to the screen. - - Args: - cq_config (string): Unparsed text format of the CQ config proto. - - Returns: - True if the config is valid. - """ - try: - config = cq_pb2.Config() - protobuf.text_format.Merge(cq_config, config) - except protobuf.text_format.ParseError as e: - logging.error('Failed to parse config as protobuf:\n%s', e) - return False - - if _HasField(config, 'gerrit'): - if _HasField(config, 'rietveld'): - logging.error('gerrit and rietveld are not supported at the same time.') - return False - # TODO(tandrii): validate gerrit. - required_fields = REQUIRED_FIELDS + ['gerrit.cq_verified_label'] - if _HasField(config, 'verifiers.reviewer_lgtm'): - logging.error('reviewer_lgtm verifier is not supported with Gerrit.') - return False - elif _HasField(config, 'rietveld'): - required_fields = REQUIRED_FIELDS + ['rietveld.url'] - else: - logging.error('either rietveld gerrit are required fields.') - return False - - for fname in required_fields: - if not _HasField(config, fname): - logging.error('%s is a required field', fname) - return False - - for fname in LEGACY_FIELDS: - if _HasField(config, fname): - logging.warn('%s is a legacy field', fname) - - - for base in config.rietveld.project_bases: - try: - re.compile(base) - except re.error: - logging.error('failed to parse "%s" in project_bases as a regexp', base) - return False - - # TODO(sergiyb): For each field, check valid values depending on its - # semantics, e.g. email addresses, regular expressions etc. - return True