Updated cq_client

R=akuegel@chromium.org
BUG=562427

Review URL: https://codereview.chromium.org/1475033006

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@297726 0039d316-1c4b-4281-b951-d872f2087c98
changes/01/332501/1
sergiyb@chromium.org 10 years ago
parent f56c93bd17
commit 6a43185c75

@ -7,7 +7,18 @@ which should only be updated as a whole using Glyco (when available, see
The canonical version is located at `https://chrome-internal.googlesource.com/
infra/infra_internal/+/master/commit_queue/cq_client`.
To generate `cq_pb2.py` and `cq.pb.go`, please use protoc version 2.6.1:
You'll need to use protoc version 2.6.1 and
recent golang/protobuf package. Sadly, the latter has no tags no versions.
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
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
TODO(tandrii,sergiyb): decide how to pin the go protobuf generator.
To generate `cq_pb2.py` and `cq.pb.go`:
cd commit_queue/cq_client
protoc cq.proto --python_out $(pwd) --go_out $(pwd)
@ -15,3 +26,4 @@ To generate `cq_pb2.py` and `cq.pb.go`, please use protoc version 2.6.1:
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.

@ -11,6 +11,7 @@ It is generated from these files:
It has these top-level messages:
Config
Rietveld
Gerrit
Verifiers
*/
package cq
@ -54,6 +55,9 @@ type Config struct {
InProduction *bool `protobuf:"varint,8,opt,name=in_production" json:"in_production,omitempty"`
// Configuration options for Rietveld code review.
Rietveld *Rietveld `protobuf:"bytes,9,opt,name=rietveld" json:"rietveld,omitempty"`
// EXPERIMENTAL! Configuration options for Gerrit code review.
// TODO(tandrii): update this doc (GERRIT).
Gerrit *Gerrit `protobuf:"bytes,15,opt,name=gerrit" json:"gerrit,omitempty"`
// This can be used to override the Git repository URL used to checkout and
// commit changes on CQ host. This should only be used in case, when the
// source repository is not supported by luci-config (e.g. GitHub).
@ -63,15 +67,8 @@ type Config struct {
// that use gnumbd where CQ should commit into a pending ref.
TargetRef *string `protobuf:"bytes,11,opt,name=target_ref" json:"target_ref,omitempty"`
// Deprecated. URL of the SVN repository. We are deprecating SVN support.
SvnRepoUrl *string `protobuf:"bytes,12,opt,name=svn_repo_url" json:"svn_repo_url,omitempty"`
// Deprecated. Should be set to true, when the project's SVN repository does
// not have server-side hooks configured.
ServerHooksMissing *bool `protobuf:"varint,13,opt,name=server_hooks_missing" json:"server_hooks_missing,omitempty"`
// Deprecated. Specifies a list of verifiers that are run on a local checkout
// with patch applied. The only remaining use case for this is PRESUBMIT_CHECK
// verifier, which we are deprecating as well.
VerifiersWithPatch *Verifiers `protobuf:"bytes,14,opt,name=verifiers_with_patch" json:"verifiers_with_patch,omitempty"`
XXX_unrecognized []byte `json:"-"`
SvnRepoUrl *string `protobuf:"bytes,12,opt,name=svn_repo_url" json:"svn_repo_url,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Config) Reset() { *m = Config{} }
@ -141,6 +138,13 @@ func (m *Config) GetRietveld() *Rietveld {
return nil
}
func (m *Config) GetGerrit() *Gerrit {
if m != nil {
return m.Gerrit
}
return nil
}
func (m *Config) GetGitRepoUrl() string {
if m != nil && m.GitRepoUrl != nil {
return *m.GitRepoUrl
@ -162,20 +166,6 @@ func (m *Config) GetSvnRepoUrl() string {
return ""
}
func (m *Config) GetServerHooksMissing() bool {
if m != nil && m.ServerHooksMissing != nil {
return *m.ServerHooksMissing
}
return false
}
func (m *Config) GetVerifiersWithPatch() *Verifiers {
if m != nil {
return m.VerifiersWithPatch
}
return nil
}
type Rietveld struct {
// Required. URL of the codereview site.
Url *string `protobuf:"bytes,1,opt,name=url" json:"url,omitempty"`
@ -206,6 +196,44 @@ func (m *Rietveld) GetProjectBases() []string {
return nil
}
// Gerrit CQ is EXPERIMENTAL! See http://crbug.com/493899 for more info.
//
// Unlike Rietveld, Gerrit doesn't need a separate url.
// Instead, the git_repo_url must be specified on the Gerrit instance,
// and CQ will deduce Gerrit url from it.
//
// TODO(tandrii): support Rietveld and Gerrit at the same time.
// This basically requires to start two CQ instances, instead of one.
//
// For example, if https://chromium.googlesource.com/infra/infra.git is your
// repo url provided in `git_repo_url` above, then
// https://chromium-review.googlesource.com/#/admin/projects/infra/infra should
// show general properties of your project.
//
// Also,
// https://chromium-review.googlesource.com/#/admin/projects/infra/infra,access
// should show ACLs for refs in your project, but you may need to be admin to
// 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.
CqVerifiedLabel *string `protobuf:"bytes,1,opt,name=cq_verified_label" json:"cq_verified_label,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Gerrit) Reset() { *m = Gerrit{} }
func (m *Gerrit) String() string { return proto.CompactTextString(m) }
func (*Gerrit) ProtoMessage() {}
func (m *Gerrit) GetCqVerifiedLabel() string {
if m != nil && m.CqVerifiedLabel != nil {
return *m.CqVerifiedLabel
}
return ""
}
// Verifiers are various types of checks that a Commit Queue performs on a CL.
// All verifiers must pass in order for a CL to be landed. Configuration file
// describes types of verifiers that should be applied to each CL and their
@ -213,6 +241,7 @@ func (m *Rietveld) GetProjectBases() []string {
type Verifiers struct {
// This verifier is used to ensure that an LGTM was posted to the code review
// site from a valid project committer.
// This verifier is not supported with Gerrit.
ReviewerLgtm *Verifiers_ReviewerLgtmVerifier `protobuf:"bytes,1,opt,name=reviewer_lgtm" json:"reviewer_lgtm,omitempty"`
// This verifier is used to check tree status before committing a CL. If the
// tree is closed, then the verifier will wait until it is reopened.
@ -354,7 +383,7 @@ type Verifiers_TryJobVerifier_Builder struct {
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
// When true, the builder is triggered by CQ. Otherwise, it is expected to
// be triggered from another tryjob. Default value is true.
Triggered *bool `protobuf:"varint,2,opt,name=triggered" json:"triggered,omitempty"`
TriggeredByCq *bool `protobuf:"varint,2,opt,name=triggered_by_cq" json:"triggered_by_cq,omitempty"`
// When this field is present, it marks given builder as experimental. It
// is only executed on a given percentage of the CLs and the outcome does
// not affect the decicion whether a CL can land or not. This is typically
@ -374,9 +403,9 @@ func (m *Verifiers_TryJobVerifier_Builder) GetName() string {
return ""
}
func (m *Verifiers_TryJobVerifier_Builder) GetTriggered() bool {
if m != nil && m.Triggered != nil {
return *m.Triggered
func (m *Verifiers_TryJobVerifier_Builder) GetTriggeredByCq() bool {
if m != nil && m.TriggeredByCq != nil {
return *m.TriggeredByCq
}
return false
}
@ -480,3 +509,17 @@ type Verifiers_SignCLAVerifier struct {
func (m *Verifiers_SignCLAVerifier) Reset() { *m = Verifiers_SignCLAVerifier{} }
func (m *Verifiers_SignCLAVerifier) String() string { return proto.CompactTextString(m) }
func (*Verifiers_SignCLAVerifier) ProtoMessage() {}
func init() {
proto.RegisterType((*Config)(nil), "Config")
proto.RegisterType((*Rietveld)(nil), "Rietveld")
proto.RegisterType((*Gerrit)(nil), "Gerrit")
proto.RegisterType((*Verifiers)(nil), "Verifiers")
proto.RegisterType((*Verifiers_ReviewerLgtmVerifier)(nil), "Verifiers.ReviewerLgtmVerifier")
proto.RegisterType((*Verifiers_TreeStatusLgtmVerifier)(nil), "Verifiers.TreeStatusLgtmVerifier")
proto.RegisterType((*Verifiers_TryJobVerifier)(nil), "Verifiers.TryJobVerifier")
proto.RegisterType((*Verifiers_TryJobVerifier_Builder)(nil), "Verifiers.TryJobVerifier.Builder")
proto.RegisterType((*Verifiers_TryJobVerifier_Bucket)(nil), "Verifiers.TryJobVerifier.Bucket")
proto.RegisterType((*Verifiers_TryJobVerifier_TryJobRetryConfig)(nil), "Verifiers.TryJobVerifier.TryJobRetryConfig")
proto.RegisterType((*Verifiers_SignCLAVerifier)(nil), "Verifiers.SignCLAVerifier")
}

@ -39,6 +39,10 @@ message Config {
// Configuration options for Rietveld code review.
optional Rietveld rietveld = 9;
// EXPERIMENTAL! Configuration options for Gerrit code review.
// TODO(tandrii): update this doc (GERRIT).
optional Gerrit gerrit = 15;
// This can be used to override the Git repository URL used to checkout and
// commit changes on CQ host. This should only be used in case, when the
// source repository is not supported by luci-config (e.g. GitHub).
@ -51,15 +55,6 @@ message Config {
// Deprecated. URL of the SVN repository. We are deprecating SVN support.
optional string svn_repo_url = 12;
// Deprecated. Should be set to true, when the project's SVN repository does
// not have server-side hooks configured.
optional bool server_hooks_missing = 13;
// Deprecated. Specifies a list of verifiers that are run on a local checkout
// with patch applied. The only remaining use case for this is PRESUBMIT_CHECK
// verifier, which we are deprecating as well.
optional Verifiers verifiers_with_patch = 14;
}
message Rietveld {
@ -74,6 +69,32 @@ message Rietveld {
repeated string project_bases = 2;
}
// Gerrit CQ is EXPERIMENTAL! See http://crbug.com/493899 for more info.
//
// Unlike Rietveld, Gerrit doesn't need a separate url.
// Instead, the git_repo_url must be specified on the Gerrit instance,
// and CQ will deduce Gerrit url from it.
//
// TODO(tandrii): support Rietveld and Gerrit at the same time.
// This basically requires to start two CQ instances, instead of one.
//
// For example, if https://chromium.googlesource.com/infra/infra.git is your
// repo url provided in `git_repo_url` above, then
// https://chromium-review.googlesource.com/#/admin/projects/infra/infra should
// show general properties of your project.
//
// Also,
// https://chromium-review.googlesource.com/#/admin/projects/infra/infra,access
// should show ACLs for refs in your project, but you may need to be admin to
// 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 string cq_verified_label = 1;
}
// Verifiers are various types of checks that a Commit Queue performs on a CL.
// All verifiers must pass in order for a CL to be landed. Configuration file
// describes types of verifiers that should be applied to each CL and their
@ -81,6 +102,7 @@ message Rietveld {
message Verifiers {
// This verifier is used to ensure that an LGTM was posted to the code review
// site from a valid project committer.
// This verifier is not supported with Gerrit.
optional ReviewerLgtmVerifier reviewer_lgtm = 1;
// This verifier is used to check tree status before committing a CL. If the
@ -130,7 +152,7 @@ message Verifiers {
// When true, the builder is triggered by CQ. Otherwise, it is expected to
// be triggered from another tryjob. Default value is true.
optional bool triggered = 2;
optional bool triggered_by_cq = 2;
// When this field is present, it marks given builder as experimental. It
// is only executed on a given percentage of the CLs and the outcome does

@ -26,7 +26,7 @@ _sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='cq.proto',
package='',
serialized_pb=_b('\n\x08\x63q.proto\"\xf5\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\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\x1c\n\x14server_hooks_missing\x18\r \x01(\x08\x12(\n\x14verifiers_with_patch\x18\x0e \x01(\x0b\x32\n.Verifiers\".\n\x08Rietveld\x12\x0b\n\x03url\x18\x01 \x01(\t\x12\x15\n\rproject_bases\x18\x02 \x03(\t\"\xd3\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\xd9\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\x1aI\n\x07\x42uilder\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x11\n\ttriggered\x18\x02 \x01(\x08\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\"\xc6\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\".\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\"\xd9\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\xdf\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\x1aO\n\x07\x42uilder\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x17\n\x0ftriggered_by_cq\x18\x02 \x01(\x08\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)
@ -104,37 +104,30 @@ _CONFIG = _descriptor.Descriptor(
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='git_repo_url', full_name='Config.git_repo_url', index=9,
number=10, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
name='gerrit', full_name='Config.gerrit', index=9,
number=15, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='target_ref', full_name='Config.target_ref', index=10,
number=11, type=9, cpp_type=9, label=1,
name='git_repo_url', full_name='Config.git_repo_url', index=10,
number=10, 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),
_descriptor.FieldDescriptor(
name='svn_repo_url', full_name='Config.svn_repo_url', index=11,
number=12, type=9, cpp_type=9, label=1,
name='target_ref', full_name='Config.target_ref', index=11,
number=11, 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),
_descriptor.FieldDescriptor(
name='server_hooks_missing', full_name='Config.server_hooks_missing', index=12,
number=13, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='verifiers_with_patch', full_name='Config.verifiers_with_patch', index=13,
number=14, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
name='svn_repo_url', full_name='Config.svn_repo_url', index=12,
number=12, 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),
@ -150,7 +143,7 @@ _CONFIG = _descriptor.Descriptor(
oneofs=[
],
serialized_start=13,
serialized_end=386,
serialized_end=339,
)
@ -186,8 +179,38 @@ _RIETVELD = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=388,
serialized_end=434,
serialized_start=341,
serialized_end=387,
)
_GERRIT = _descriptor.Descriptor(
name='Gerrit',
full_name='Gerrit',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='cq_verified_label', full_name='Gerrit.cq_verified_label', index=0,
number=1, 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=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=389,
serialized_end=424,
)
@ -230,8 +253,8 @@ _VERIFIERS_REVIEWERLGTMVERIFIER = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=652,
serialized_end=742,
serialized_start=642,
serialized_end=732,
)
_VERIFIERS_TREESTATUSLGTMVERIFIER = _descriptor.Descriptor(
@ -259,8 +282,8 @@ _VERIFIERS_TREESTATUSLGTMVERIFIER = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=744,
serialized_end=793,
serialized_start=734,
serialized_end=783,
)
_VERIFIERS_TRYJOBVERIFIER_BUILDER = _descriptor.Descriptor(
@ -278,7 +301,7 @@ _VERIFIERS_TRYJOBVERIFIER_BUILDER = _descriptor.Descriptor(
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='triggered', full_name='Verifiers.TryJobVerifier.Builder.triggered', index=1,
name='triggered_by_cq', full_name='Verifiers.TryJobVerifier.Builder.triggered_by_cq', index=1,
number=2, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
@ -302,8 +325,8 @@ _VERIFIERS_TRYJOBVERIFIER_BUILDER = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=940,
serialized_end=1013,
serialized_start=930,
serialized_end=1009,
)
_VERIFIERS_TRYJOBVERIFIER_BUCKET = _descriptor.Descriptor(
@ -338,8 +361,8 @@ _VERIFIERS_TRYJOBVERIFIER_BUCKET = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1015,
serialized_end=1090,
serialized_start=1011,
serialized_end=1086,
)
_VERIFIERS_TRYJOBVERIFIER_TRYJOBRETRYCONFIG = _descriptor.Descriptor(
@ -395,8 +418,8 @@ _VERIFIERS_TRYJOBVERIFIER_TRYJOBRETRYCONFIG = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1093,
serialized_end=1269,
serialized_start=1089,
serialized_end=1265,
)
_VERIFIERS_TRYJOBVERIFIER = _descriptor.Descriptor(
@ -431,8 +454,8 @@ _VERIFIERS_TRYJOBVERIFIER = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=796,
serialized_end=1269,
serialized_start=786,
serialized_end=1265,
)
_VERIFIERS_SIGNCLAVERIFIER = _descriptor.Descriptor(
@ -453,8 +476,8 @@ _VERIFIERS_SIGNCLAVERIFIER = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=1271,
serialized_end=1288,
serialized_start=1267,
serialized_end=1284,
)
_VERIFIERS = _descriptor.Descriptor(
@ -503,13 +526,13 @@ _VERIFIERS = _descriptor.Descriptor(
extension_ranges=[],
oneofs=[
],
serialized_start=437,
serialized_end=1288,
serialized_start=427,
serialized_end=1284,
)
_CONFIG.fields_by_name['verifiers'].message_type = _VERIFIERS
_CONFIG.fields_by_name['rietveld'].message_type = _RIETVELD
_CONFIG.fields_by_name['verifiers_with_patch'].message_type = _VERIFIERS
_CONFIG.fields_by_name['gerrit'].message_type = _GERRIT
_VERIFIERS_REVIEWERLGTMVERIFIER.containing_type = _VERIFIERS
_VERIFIERS_TREESTATUSLGTMVERIFIER.containing_type = _VERIFIERS
_VERIFIERS_TRYJOBVERIFIER_BUILDER.containing_type = _VERIFIERS_TRYJOBVERIFIER
@ -526,6 +549,7 @@ _VERIFIERS.fields_by_name['try_job'].message_type = _VERIFIERS_TRYJOBVERIFIER
_VERIFIERS.fields_by_name['sign_cla'].message_type = _VERIFIERS_SIGNCLAVERIFIER
DESCRIPTOR.message_types_by_name['Config'] = _CONFIG
DESCRIPTOR.message_types_by_name['Rietveld'] = _RIETVELD
DESCRIPTOR.message_types_by_name['Gerrit'] = _GERRIT
DESCRIPTOR.message_types_by_name['Verifiers'] = _VERIFIERS
Config = _reflection.GeneratedProtocolMessageType('Config', (_message.Message,), dict(
@ -542,6 +566,13 @@ Rietveld = _reflection.GeneratedProtocolMessageType('Rietveld', (_message.Messag
))
_sym_db.RegisterMessage(Rietveld)
Gerrit = _reflection.GeneratedProtocolMessageType('Gerrit', (_message.Message,), dict(
DESCRIPTOR = _GERRIT,
__module__ = 'cq_pb2'
# @@protoc_insertion_point(class_scope:Gerrit)
))
_sym_db.RegisterMessage(Gerrit)
Verifiers = _reflection.GeneratedProtocolMessageType('Verifiers', (_message.Message,), dict(
ReviewerLgtmVerifier = _reflection.GeneratedProtocolMessageType('ReviewerLgtmVerifier', (_message.Message,), dict(

@ -0,0 +1,54 @@
version: 1
cq_name: "infra"
cq_status_url: "https://chromium-cq-status.appspot.com"
hide_ref_in_committed_msg: true
commit_burst_delay: 600
max_commit_burst: 10
in_production: false
git_repo_url: "https://chromium.googlesource.com/infra/infra.git"
target_ref: "refs/pending/heads/master"
gerrit {
cq_verified_label: "Commit-Queue-Verified"
}
verifiers {
tree_status: {
tree_status_url: "https://infra-status.appspot.com"
}
try_job {
buckets {
name: "tryserver.blink"
builders { name: "android_blink_compile_dbg" }
builders { name: "android_blink_compile_rel" }
builders {
name: "win_blink_rel"
triggered_by_cq: false
}
}
buckets {
name: "tryserver.chromium.linux"
builders {
name: "android_arm64_dbg_recipe"
}
builders {
name: "linux_chromium_rel_ng"
experiment_percentage: 10
}
}
buckets {
name: "tryserver.chromium.mac"
builders {
name: "ios_dbg_simulator_ninja"
experiment_percentage: 100
}
}
try_job_retry_config {
try_job_retry_quota: 10
global_retry_quota: 11
failure_retry_weight: 12
transient_failure_retry_weight: 13
}
}
}

@ -31,7 +31,7 @@ verifiers {
builders { name: "android_blink_compile_rel" }
builders {
name: "win_blink_rel"
triggered: true
triggered_by_cq: false
}
}
buckets {

@ -16,10 +16,24 @@ TEST_DIR = os.path.dirname(os.path.abspath(__file__))
class TestValidateConfig(unittest.TestCase):
def test_is_valid(self):
with open(os.path.join(TEST_DIR, 'cq_example.cfg'), 'r') as test_config:
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()

@ -23,16 +23,12 @@ from cq_client import cq_pb2
REQUIRED_FIELDS = [
'version',
'rietveld',
'rietveld.url',
'verifiers',
'cq_name',
]
LEGACY_FIELDS = [
'svn_repo_url',
'server_hooks_missing',
'verifiers_with_patch',
]
EMAIL_REGEXP = '^[^@]+@[^@]+\.[^@]+$'
@ -92,7 +88,22 @@ def IsValid(cq_config):
logging.error('Failed to parse config as protobuf:\n%s', e)
return False
for fname in REQUIRED_FIELDS:
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
@ -111,5 +122,4 @@ def IsValid(cq_config):
# TODO(sergiyb): For each field, check valid values depending on its
# semantics, e.g. email addresses, regular expressions etc.
return True

Loading…
Cancel
Save