Documentation
¶
Overview ¶
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Brad Rydzewski, project contributors, Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Brad Rydzewski, project contributors, Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Code generated by "enumer -type=CommitRange"; DO NOT EDIT
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Brad Rydzewski, project contributors, Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Brad Rydzewski, project contributors, Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Code generated by "enumer -type=FeedbackType"; DO NOT EDIT
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Brad Rydzewski, project contributors, Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Brad Rydzewski, project contributors, Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Brad Rydzewski, project contributors, Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Brad Rydzewski, project contributors, Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Brad Rydzewski, project contributors, Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Brad Rydzewski, project contributors, Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Code generated by "enumer -type=Semver"; DO NOT EDIT
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-Copyright: Copyright (c) Brad Rydzewski, project contributors, Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Brad Rydzewski, project contributors, Capital One Services, LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func Approve(request *ApprovalRequest, policy *ApprovalPolicy, p Processor) (bool, error)
- func Rand() string
- type AndMatch
- type AnonymousMatch
- type ApprovalOp
- type ApprovalPolicy
- type ApprovalRequest
- type ApprovalScope
- type AtLeastMatch
- type AuditConfig
- type AuthorMatch
- type Branch
- type BranchCompare
- type Capabilities
- type ChangePolicy
- type CombinedStatus
- type Comment
- type CommentConfig
- type CommentMessage
- type CommentTarget
- type Commit
- type CommitConfig
- type CommitFile
- type CommitRange
- type CommitStatus
- type CommonMatch
- type Config
- type DeployConfig
- type DeploymentConfig
- type DeploymentConfigs
- type DeploymentInfo
- type DisableMatch
- func (match *DisableMatch) ChangePolicy(policy *ApprovalPolicy)
- func (match *DisableMatch) GetType() string
- func (match DisableMatch) MarshalJSON() ([]byte, error)
- func (match *DisableMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
- func (match *DisableMatch) Validate(_ *MaintainerSnapshot) error
- type EntityMatch
- type FalseMatch
- type Feedback
- type FeedbackConfig
- type FeedbackType
- type GitHubOrg
- type Issue
- type IssueAuthorMatch
- func (match *IssueAuthorMatch) GetType() string
- func (match IssueAuthorMatch) MarshalJSON() ([]byte, error)
- func (match *IssueAuthorMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
- func (match *IssueAuthorMatch) Validate(_ *MaintainerSnapshot) error
- type Maintainer
- type MaintainerMatch
- type MaintainerSnapshot
- type MaintainersConfig
- type MatchAction
- type Matcher
- type MatcherHolder
- type MergeConfig
- type NotMatch
- type OrMatch
- type Org
- type OrgDb
- type OrgSerde
- type Perm
- type Person
- type Processor
- type PullRequest
- type Repo
- type Review
- type Semver
- type Tag
- type TagConfig
- type TargetConfig
- type TemplateTag
- type ThemMatch
- type TrueMatch
- type UniverseMatch
- type UsMatch
- type User
Constants ¶
This section is empty.
Variables ¶
var AuditName = fmt.Sprintf("audit/%s", envvars.Env.Branding.Name)
AuditName is the prefix of the audit context posted to remote
var CommentPrefix = fmt.Sprintf("Message from %s --", envvars.Env.Branding.ShortName)
var MaintTypes = set.New("text", "hjson", "toml", "legacy")
var ServiceName = fmt.Sprintf("approvals/%s", envvars.Env.Branding.Name)
ServiceName is the status context posted to remote
Functions ¶
func Approve ¶
func Approve(request *ApprovalRequest, policy *ApprovalPolicy, p Processor) (bool, error)
Types ¶
type AndMatch ¶
type AndMatch struct {
And []MatcherHolder `json:"and"`
}
AndMatch performs a boolean 'and' operation on two or more Matchers.
func (AndMatch) MarshalJSON ¶
func (*AndMatch) Match ¶
func (match *AndMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
func (*AndMatch) Validate ¶
func (match *AndMatch) Validate(m *MaintainerSnapshot) error
type AnonymousMatch ¶
type AnonymousMatch struct { CommonMatch // restrict the approvers to this set Entities set.LowerSet `json:"entities"` }
AnonymousMatch accepts the request when the number of people who have approved is greater than or equal to the threshold.
func DefaultAnonymousMatch ¶
func DefaultAnonymousMatch() *AnonymousMatch
func (*AnonymousMatch) GetType ¶
func (match *AnonymousMatch) GetType() string
func (AnonymousMatch) MarshalJSON ¶
func (match AnonymousMatch) MarshalJSON() ([]byte, error)
func (*AnonymousMatch) Match ¶
func (match *AnonymousMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
func (*AnonymousMatch) Validate ¶
func (match *AnonymousMatch) Validate(m *MaintainerSnapshot) error
type ApprovalOp ¶
type ApprovalOp int
const ( Approval ApprovalOp = iota DisapprovalInsert DisapprovalRemove ValidAuthor ValidTitle )
type ApprovalPolicy ¶
type ApprovalPolicy struct { // Name is used to describe this policy to humans. // Optional but if specified it must be unique. Name string `json:"name,omitempty"` // Position is the 1-based index of this policy in the approval array. Position int `json:"-"` // ApprovalScope determines when the policy can be applied Scope *ApprovalScope `json:"scope,omitempty"` // Match is a JSON object that stores the approval match. // every approval policy needs a Match Match MatcherHolder `json:"match"` // AntiMatch is a JSON object that stores the disapproval match. AntiMatch *MatcherHolder `json:"antimatch,omitempty"` // AntiMatch is a JSON object that stores the author match. AuthorMatch *MatcherHolder `json:"authormatch,omitempty"` // Tag is an optional tag section to be used for this // approval scope. If this field is empty then the // global tag section is used. Tag *TagConfig `json:"tag,omitempty"` // Merge is an optional merge section to be used for this // approval scope. If this field is empty then the // global merge section is used. Merge *MergeConfig `json:"merge,omitempty"` // Pattern is an optional regular expression to be used for this // approval scope. If this field is empty then the // global pattern is used. Pattern *rxserde.RegexSerde `json:"pattern,omitempty"` // AntiPattern is an optional regular expression to be used for this // approval scope. If this field is empty then the // global antipattern is used. AntiPattern *rxserde.RegexSerde `json:"antipattern,omitempty"` // AntiTitle is an optional regular expression to be used for this // approval scope. If this field is empty then the // global antititle is used. AntiTitle *rxserde.RegexSerde `json:"antititle,omitempty"` // Feedback is an optional feedback section to be used for this // approval scope. If this field is empty then the // global feedback section is used. Feedback *FeedbackConfig `json:"feedback,omitempty"` }
ApprovalPolicy combines an approval scope (that determines when the policy can be applied) and an approval match (that determines whether the match is successful)
func DefaultApprovalPolicy ¶
func DefaultApprovalPolicy() *ApprovalPolicy
func FindApprovalPolicy ¶
func FindApprovalPolicy(req *ApprovalRequest) *ApprovalPolicy
func (*ApprovalPolicy) Validate ¶
func (a *ApprovalPolicy) Validate() error
type ApprovalRequest ¶
type ApprovalRequest struct { Config *Config Maintainer *MaintainerSnapshot PullRequest *PullRequest Repository *Repo Issues []*Issue ApprovalComments []Feedback DisapprovalComments []Feedback Files []CommitFile Commits []Commit }
func (*ApprovalRequest) IsTitleMatch ¶
func (req *ApprovalRequest) IsTitleMatch() bool
IsTitleMatch returns true if the text matches the antititle regular expression.
type ApprovalScope ¶
type ApprovalScope struct { Paths []miniglob.MiniGlob `json:"paths,omitempty"` Branches set.Set `json:"branches,omitempty"` PathRegexp []rxserde.RegexSerde `json:"regexpaths,omitempty"` BaseRegexp []rxserde.RegexSerde `json:"regexbase,omitempty"` CompareRegexp []rxserde.RegexSerde `json:"regexcompare,omitempty"` }
ApprovalScope determines when the policy can be applied
func DefaultApprovalScope ¶
func DefaultApprovalScope() *ApprovalScope
func (*ApprovalScope) ValidateFinal ¶
func (a *ApprovalScope) ValidateFinal() error
type AtLeastMatch ¶
type AtLeastMatch struct { // minimum number of approvals required Approvals int `json:"approvals"` Choose []MatcherHolder `json:"choose"` }
func (*AtLeastMatch) GetType ¶
func (match *AtLeastMatch) GetType() string
func (AtLeastMatch) MarshalJSON ¶
func (match AtLeastMatch) MarshalJSON() ([]byte, error)
func (*AtLeastMatch) Match ¶
func (match *AtLeastMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
func (*AtLeastMatch) Validate ¶
func (match *AtLeastMatch) Validate(m *MaintainerSnapshot) error
type AuditConfig ¶
type AuditConfig struct { // enable auditing of commits. Default is false. Enable bool `json:"enable"` // which branches to audit Branches set.Set `json:"branches"` }
func DefaultAudit ¶
func DefaultAudit() AuditConfig
type AuthorMatch ¶
type AuthorMatch struct {
Inner MatcherHolder `json:"inner"`
}
func (*AuthorMatch) GetType ¶
func (match *AuthorMatch) GetType() string
func (AuthorMatch) MarshalJSON ¶
func (match AuthorMatch) MarshalJSON() ([]byte, error)
func (*AuthorMatch) Match ¶
func (match *AuthorMatch) Match(req *ApprovalRequest, proc Processor, _ MatchAction, feedback []Feedback) (bool, error)
func (*AuthorMatch) Validate ¶
func (match *AuthorMatch) Validate(m *MaintainerSnapshot) error
type BranchCompare ¶
type Capabilities ¶
type Capabilities struct { Org struct { Read bool } Repo struct { Tag bool Merge bool DeleteBranch bool CommitStatus bool PRWriteComment bool DeploymentStatus bool } }
func AllowAll ¶
func AllowAll() *Capabilities
type ChangePolicy ¶
type ChangePolicy interface {
ChangePolicy(policy *ApprovalPolicy)
}
type CombinedStatus ¶
type CombinedStatus struct { State string Statuses map[string]CommitStatus }
type Comment ¶
func (*Comment) GetSubmittedAt ¶
func (*Comment) IsApproval ¶
func (c *Comment) IsApproval(req *ApprovalRequest) bool
IsApproval returns true if the comment body matches the regular expression pattern.
func (*Comment) IsDisapproval ¶
func (c *Comment) IsDisapproval(req *ApprovalRequest) bool
IsDisapproval returns true if the comment body matches the antipattern regular expression.
type CommentConfig ¶
type CommentConfig struct { Enable bool `json:"enable"` Targets []TargetConfig `json:"targets"` }
type CommentMessage ¶
type CommentMessage int
const ( //error while processing webhook CommentError CommentMessage //pr is opened CommentOpen //pr is closed without being merged CommentClose //pr has been closed and merged CommentAccept //an approval comment has been added to the PR CommentApprove //a blocking comment has been added to the PR CommentBlock //new push on PR branch has reset previous approvals CommentReset //a merge via the user interface has been ignored CommentPushIgnore //pr was auto-merged after all status checks passed CommentMerge //repo was tagged after merge CommentTag //branch for pr was auto-deleted after merge CommentDelete //deployment was triggered after merge CommentDeployment //pull request blocked because of author CommentAuthor )
func (CommentMessage) Known ¶
func (s CommentMessage) Known() bool
Known says whether or not this value is a known enum value.
func (CommentMessage) MarshalJSON ¶
func (s CommentMessage) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the json.Marshaler
func (CommentMessage) String ¶
func (s CommentMessage) String() string
String is for the standard stringer interface.
func (*CommentMessage) UnmarshalJSON ¶
func (s *CommentMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON satisfies the json.Unmarshaler
type CommentTarget ¶
type CommentTarget int
const ( Github CommentTarget Slack )
func ToCommentTarget ¶
func ToCommentTarget(s string) CommentTarget
func (CommentTarget) Known ¶
func (s CommentTarget) Known() bool
Known says whether or not this value is a known enum value.
func (CommentTarget) MarshalJSON ¶
func (s CommentTarget) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the json.Marshaler
func (CommentTarget) String ¶
func (s CommentTarget) String() string
String is for the standard stringer interface.
func (*CommentTarget) UnmarshalJSON ¶
func (s *CommentTarget) UnmarshalJSON(data []byte) error
UnmarshalJSON satisfies the json.Unmarshaler
type CommitConfig ¶
type CommitConfig struct { Range CommitRange `json:"range"` AntiRange CommitRange `json:"antirange"` TagRange CommitRange `json:"tagrange"` IgnoreUIMerge bool `json:"ignoreuimerge,omitempty"` }
func DefaultCommit ¶
func DefaultCommit() CommitConfig
type CommitFile ¶
type CommitFile struct {
Filename string
}
type CommitRange ¶
type CommitRange int
const ( Head CommitRange = iota All )
func (CommitRange) Known ¶
func (s CommitRange) Known() bool
Known says whether or not this value is a known enum value.
func (CommitRange) MarshalJSON ¶
func (s CommitRange) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the json.Marshaler
func (CommitRange) String ¶
func (s CommitRange) String() string
String is for the standard stringer interface.
func (*CommitRange) UnmarshalJSON ¶
func (s *CommitRange) UnmarshalJSON(data []byte) error
UnmarshalJSON satisfies the json.Unmarshaler
type CommitStatus ¶
type CommonMatch ¶
type CommonMatch struct { // minimum number of approvals required Approvals int `json:"approvals"` // if true then author can self-approve request Self bool `json:"self"` }
func (CommonMatch) Validate ¶
func (match CommonMatch) Validate(_ *MaintainerSnapshot) error
type Config ¶
type Config struct { Approvals []*ApprovalPolicy `json:"approvals"` Pattern rxserde.RegexSerde `json:"pattern"` AntiPattern *rxserde.RegexSerde `json:"antipattern,omitempty"` AntiTitle *rxserde.RegexSerde `json:"antititle,omitempty"` Commit CommitConfig `json:"commit,omitempty"` Maintainers MaintainersConfig `json:"maintainers,omitempty"` Merge MergeConfig `json:"merge,omitempty"` Feedback FeedbackConfig `json:"feedback,omitempty"` Tag TagConfig `json:"tag,omitempty"` Comment CommentConfig `json:"comment,omitempty"` Deployment DeployConfig `json:"deploy,omitempty"` Audit AuditConfig `json:"audit,omitempty"` IsOld bool `json:"-"` }
func DefaultConfig ¶
func DefaultConfig() *Config
func NonEmptyConfig ¶
func NonEmptyConfig() *Config
func ParseConfig ¶
func ParseConfig(data []byte, caps *Capabilities) (*Config, error)
ParseConfig parses a project configuration file.
func ParseOldConfig ¶
ParseOldConfig parses a projects .lgtm file
func (*Config) GetFeedbackConfig ¶
func (c *Config) GetFeedbackConfig(policy *ApprovalPolicy) *FeedbackConfig
func (*Config) GetMergeConfig ¶
func (c *Config) GetMergeConfig(policy *ApprovalPolicy) *MergeConfig
func (*Config) LoadDeploymentMap ¶
func (*Config) Validate ¶
func (c *Config) Validate(caps *Capabilities) error
type DeployConfig ¶
type DeployConfig struct { Enable bool `json:"enable"` Path string `json:"path"` DeploymentMap DeploymentConfigs `json:"-"` }
type DeploymentConfig ¶
type DeploymentConfigs ¶
type DeploymentConfigs map[string]DeploymentConfig
type DeploymentInfo ¶
type DisableMatch ¶
type DisableMatch struct{}
DisableMatch always returns true and disables service.
func (*DisableMatch) ChangePolicy ¶
func (match *DisableMatch) ChangePolicy(policy *ApprovalPolicy)
func (*DisableMatch) GetType ¶
func (match *DisableMatch) GetType() string
func (DisableMatch) MarshalJSON ¶
func (match DisableMatch) MarshalJSON() ([]byte, error)
func (*DisableMatch) Match ¶
func (match *DisableMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
func (*DisableMatch) Validate ¶
func (match *DisableMatch) Validate(_ *MaintainerSnapshot) error
type EntityMatch ¶
type EntityMatch struct { CommonMatch // name of the group or person to match Entity lowercase.String `json:"entity"` }
EntityMatch accepts the request when the group or person meets the minimum number of approvals.
func DefaultEntityMatch ¶
func DefaultEntityMatch() *EntityMatch
func (*EntityMatch) GetType ¶
func (match *EntityMatch) GetType() string
func (EntityMatch) MarshalJSON ¶
func (match EntityMatch) MarshalJSON() ([]byte, error)
func (*EntityMatch) Match ¶
func (match *EntityMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
func (*EntityMatch) Validate ¶
func (match *EntityMatch) Validate(m *MaintainerSnapshot) error
type FalseMatch ¶
type FalseMatch struct{}
FalseMatch always returns false.
func (*FalseMatch) GetType ¶
func (match *FalseMatch) GetType() string
func (FalseMatch) MarshalJSON ¶
func (match FalseMatch) MarshalJSON() ([]byte, error)
func (*FalseMatch) Match ¶
func (match *FalseMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
func (*FalseMatch) Validate ¶
func (match *FalseMatch) Validate(_ *MaintainerSnapshot) error
type Feedback ¶
type Feedback interface { IsApproval(req *ApprovalRequest) bool IsDisapproval(req *ApprovalRequest) bool GetAuthor() lowercase.String GetBody() string GetSubmittedAt() time.Time }
type FeedbackConfig ¶
type FeedbackConfig struct { Types []FeedbackType `json:"types,omitempty"` AuthorAffirm bool `json:"authoraffirm"` }
func DefaultFeedback ¶
func DefaultFeedback() FeedbackConfig
func (*FeedbackConfig) UnmarshalJSON ¶
func (c *FeedbackConfig) UnmarshalJSON(text []byte) error
type FeedbackType ¶
type FeedbackType int
const ( CommentType FeedbackType = iota ReviewType )
func (FeedbackType) Known ¶
func (s FeedbackType) Known() bool
Known says whether or not this value is a known enum value.
func (FeedbackType) MarshalJSON ¶
func (s FeedbackType) MarshalJSON() ([]byte, error)
MarshalJSON satisfies the json.Marshaler
func (FeedbackType) String ¶
func (s FeedbackType) String() string
String is for the standard stringer interface.
func (*FeedbackType) UnmarshalJSON ¶
func (s *FeedbackType) UnmarshalJSON(data []byte) error
UnmarshalJSON satisfies the json.Unmarshaler
type IssueAuthorMatch ¶
type IssueAuthorMatch struct{}
func (*IssueAuthorMatch) GetType ¶
func (match *IssueAuthorMatch) GetType() string
func (IssueAuthorMatch) MarshalJSON ¶
func (match IssueAuthorMatch) MarshalJSON() ([]byte, error)
func (*IssueAuthorMatch) Match ¶
func (match *IssueAuthorMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
func (*IssueAuthorMatch) Validate ¶
func (match *IssueAuthorMatch) Validate(_ *MaintainerSnapshot) error
type Maintainer ¶
type Maintainer struct { RawPeople map[string]*Person `json:"people" toml:"people"` RawOrg map[string]*OrgSerde `json:"org" toml:"org"` }
Maintainer represents a MAINTAINERS file.
type MaintainerMatch ¶
type MaintainerMatch struct {
CommonMatch
}
MaintainerMatch accepts the request when the number of people who have approved is greater than or equal to the threshold. Approvals are restricted to project maintainers.
func DefaultMaintainerMatch ¶
func DefaultMaintainerMatch() *MaintainerMatch
func (*MaintainerMatch) GetType ¶
func (match *MaintainerMatch) GetType() string
func (MaintainerMatch) MarshalJSON ¶
func (match MaintainerMatch) MarshalJSON() ([]byte, error)
func (*MaintainerMatch) Match ¶
func (match *MaintainerMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
type MaintainerSnapshot ¶
func (*MaintainerSnapshot) PersonToOrg ¶
func (m *MaintainerSnapshot) PersonToOrg() (map[string]set.Set, error)
type MaintainersConfig ¶
type MatchAction ¶
type MatchAction func(*ApprovalRequest, Feedback, set.Set, Processor)
MatchAction decides whether to invoke the Processor
type Matcher ¶
type Matcher interface { Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error) GetType() string Validate(m *MaintainerSnapshot) error }
Matcher determines whether the match is successful)
func DefaultMatcher ¶
func DefaultMatcher() Matcher
func GenerateMatcher ¶
type MatcherHolder ¶
type MatcherHolder struct {
Matcher
}
MatcherHolder stores an an Matcher JSON marshal and unmarshal are implemented on this struct.
func (MatcherHolder) MarshalJSON ¶
func (match MatcherHolder) MarshalJSON() ([]byte, error)
func (*MatcherHolder) UnmarshalJSON ¶
func (match *MatcherHolder) UnmarshalJSON(data []byte) error
type MergeConfig ¶
type MergeConfig struct { Enable bool `json:"enable"` UpToDate bool `json:"uptodate"` Method string `json:"method"` Delete bool `json:"delete"` }
func DefaultMerge ¶
func DefaultMerge() MergeConfig
func (*MergeConfig) UnmarshalJSON ¶
func (m *MergeConfig) UnmarshalJSON(text []byte) error
type NotMatch ¶
type NotMatch struct {
Not MatcherHolder `json:"not"`
}
NotMatch performs a boolean 'not' operation on a matcher.
func (NotMatch) MarshalJSON ¶
func (*NotMatch) Match ¶
func (match *NotMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
func (*NotMatch) Validate ¶
func (match *NotMatch) Validate(m *MaintainerSnapshot) error
type OrMatch ¶
type OrMatch struct {
Or []MatcherHolder `json:"or"`
}
OrMatch performs a boolean 'or' operation on two or more Matchers.
func (OrMatch) MarshalJSON ¶
func (*OrMatch) Match ¶
func (match *OrMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
func (*OrMatch) Validate ¶
func (match *OrMatch) Validate(m *MaintainerSnapshot) error
type OrgDb ¶
type OrgDb struct { ID int64 `json:"id,omitempty" meddler:"org_id,pk"` UserID int64 `json:"-" meddler:"org_user_id"` Owner string `json:"owner" meddler:"org_owner"` Link string `json:"link_url" meddler:"org_link"` Private bool `json:"private" meddler:"org_private"` Secret string `json:"-" meddler:"org_secret"` }
type Person ¶
type Person struct { Name string `json:"name" toml:"name"` Email string `json:"email" toml:"email"` Login string `json:"login" toml:"login"` }
Person represets an individual in the MAINTAINERS file.
type Processor ¶
type Processor func(Feedback, ApprovalOp)
Processor updates bookkepping for comment tracking.
type PullRequest ¶
type Repo ¶
type Repo struct { ID int64 `json:"id,omitempty" meddler:"repo_id,pk"` UserID int64 `json:"-" meddler:"repo_user_id"` Owner string `json:"owner" meddler:"repo_owner"` Name string `json:"name" meddler:"repo_name"` Slug string `json:"slug" meddler:"repo_slug"` Link string `json:"link_url" meddler:"repo_link"` Private bool `json:"private" meddler:"repo_private"` Secret string `json:"-" meddler:"repo_secret"` Org bool `json:"org" meddler:"repo_org"` }
type Review ¶
type Review struct { ID int64 Author lowercase.String Body string SubmittedAt time.Time State lowercase.String }
func (*Review) GetSubmittedAt ¶
func (*Review) IsApproval ¶
func (r *Review) IsApproval(req *ApprovalRequest) bool
IsApproval returns true if the review has been approved
func (*Review) IsDisapproval ¶
func (r *Review) IsDisapproval(req *ApprovalRequest) bool
IsDisapproval returns true if changes have been requested
type Semver ¶
type Semver int
func (Semver) MarshalJSON ¶
MarshalJSON satisfies the json.Marshaler
func (*Semver) UnmarshalJSON ¶
UnmarshalJSON satisfies the json.Unmarshaler
type TagConfig ¶
type TagConfig struct { // enable automatic tagging of merges. Default is false. Enable bool `json:"enable"` // algorithm for generating tag name. Allowed values are // "explicit", "semver", "timestamp-rfc3339", and "timestamp-millis". // Default is "semver". Alg string `json:"algorithm"` // golang text/template for producing tag name. // Container struct is TemplateTag. // Default template is "{{.Version}}" TemplateRaw string `json:"template"` Template *template.Template `json:"-"` // If true then perform stricter validation // of templates to comply with Docker tag requirements Docker bool `json:"docker"` // Version increment policy for the "semver" algorithm. // Allowed values are "major", "minor", "patch", and "none". // Default is "patch". Increment Semver `json:"increment"` }
func DefaultTag ¶
func DefaultTag() TagConfig
func (*TagConfig) GenerateTag ¶
func (t *TagConfig) GenerateTag(body TemplateTag) (string, error)
func (*TagConfig) UnmarshalJSON ¶
type TargetConfig ¶
type TargetConfig struct { Target string `json:"target"` Pattern *rxserde.RegexSerde `json:"pattern"` Types []CommentMessage `json:"types"` Names []string `json:"names"` Url string `json:"-"` }
type TemplateTag ¶
type TemplateTag struct {
Version string
}
type ThemMatch ¶
type ThemMatch struct {
CommonMatch
}
ThemMatch is restricted to maintainers who do not share a group with the author of the pull request.
func DefaultThemMatch ¶
func DefaultThemMatch() *ThemMatch
func (ThemMatch) MarshalJSON ¶
func (*ThemMatch) Match ¶
func (match *ThemMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
type TrueMatch ¶
type TrueMatch struct{}
TrueMatch always returns true.
func (TrueMatch) MarshalJSON ¶
func (*TrueMatch) Match ¶
func (match *TrueMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
func (*TrueMatch) Validate ¶
func (match *TrueMatch) Validate(_ *MaintainerSnapshot) error
type UniverseMatch ¶
type UniverseMatch struct {
CommonMatch
}
UniverseMatch accepts the request when the number of people who have approved is greater than or equal to the threshold. Approvals are not restricted to project maintainers.
func DefaultUniverseMatch ¶
func DefaultUniverseMatch() *UniverseMatch
func (*UniverseMatch) GetType ¶
func (match *UniverseMatch) GetType() string
func (UniverseMatch) MarshalJSON ¶
func (match UniverseMatch) MarshalJSON() ([]byte, error)
func (*UniverseMatch) Match ¶
func (match *UniverseMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
type UsMatch ¶
type UsMatch struct {
CommonMatch
}
UsMatch is restricted to maintainers who share a group with the author of the pull request.
func DefaultUsMatch ¶
func DefaultUsMatch() *UsMatch
func (UsMatch) MarshalJSON ¶
func (*UsMatch) Match ¶
func (match *UsMatch) Match(req *ApprovalRequest, proc Processor, a MatchAction, feedback []Feedback) (bool, error)
type User ¶
type User struct { ID int64 `json:"id" meddler:"user_id,pk"` Login string `json:"login" meddler:"user_login"` Token string `json:"-" meddler:"user_token"` Avatar string `json:"avatar" meddler:"user_avatar"` Secret string `json:"-" meddler:"user_secret"` Scopes string `json:"-" meddler:"user_scopes"` }
Source Files
¶
- approval.go
- approval_op.go
- approval_validate.go
- audit.go
- branch.go
- capabilities.go
- comment.go
- commentsupport.go
- commit.go
- commitfile.go
- commitrange.go
- commitrange_enumer.go
- commitstatus.go
- config.go
- deployment.go
- feedback.go
- feedback_enumer.go
- issue.go
- maintainer.go
- matcher_translator.go
- matchpolicy.go
- merge.go
- org.go
- repo.go
- review.go
- scopepolicy.go
- semver.go
- semver_enumer.go
- snapshot.go
- tag.go
- user.go
- util.go