Skip to content

Commit

Permalink
feat: This commit adds pull request support to SCM generator so the g…
Browse files Browse the repository at this point in the history
…enerator

can create ArgoCD apps for PRs as well.

Fixes argoproj#466

Signed-off-by: Fardin Khanjani <[email protected]>
  • Loading branch information
fardin01 committed Mar 4, 2022
1 parent 2e8d85e commit 24f0e75
Show file tree
Hide file tree
Showing 15 changed files with 10,235 additions and 35 deletions.
8 changes: 8 additions & 0 deletions api/v1alpha1/applicationset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ type SCMProviderGeneratorGithub struct {
TokenRef *SecretRef `json:"tokenRef,omitempty"`
// Scan all branches instead of just the default branch.
AllBranches bool `json:"allBranches,omitempty"`
// Scan all pull requests
AllPullRequests bool `json:"allPullRequests,omitempty"`
}

// SCMProviderGeneratorGitlab defines a connection info specific to Gitlab.
Expand All @@ -328,6 +330,8 @@ type SCMProviderGeneratorGitlab struct {
TokenRef *SecretRef `json:"tokenRef,omitempty"`
// Scan all branches instead of just the default branch.
AllBranches bool `json:"allBranches,omitempty"`
// Scan all pull requests
AllPullRequests bool `json:"allPullRequests,omitempty"`
}

// SCMProviderGeneratorFilter is a single repository filter.
Expand All @@ -342,6 +346,10 @@ type SCMProviderGeneratorFilter struct {
LabelMatch *string `json:"labelMatch,omitempty"`
// A regex which must match the branch name.
BranchMatch *string `json:"branchMatch,omitempty"`
// A regex which must match the branch name.
PullRequestBranchMatch *string `json:"pullRequestTitleMatch,omitempty"`
// A regex which must match at least one pull request label.
PullRequestLabelMatch *string `json:"pullRequestLabelMatch,omitempty"`
}

// PullRequestGenerator defines a generator that scrapes a PullRequest API to find candidate pull requests.
Expand Down
10 changes: 10 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.11.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
Expand Down
24 changes: 24 additions & 0 deletions manifests/crds/argoproj.io_applicationsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2778,6 +2778,10 @@ spec:
items:
type: string
type: array
pullRequestLabelMatch:
type: string
pullRequestTitleMatch:
type: string
repositoryMatch:
type: string
type: object
Expand All @@ -2786,6 +2790,8 @@ spec:
properties:
allBranches:
type: boolean
allPullRequests:
type: boolean
api:
type: string
organization:
Expand All @@ -2807,6 +2813,8 @@ spec:
properties:
allBranches:
type: boolean
allPullRequests:
type: boolean
api:
type: string
group:
Expand Down Expand Up @@ -4920,6 +4928,10 @@ spec:
items:
type: string
type: array
pullRequestLabelMatch:
type: string
pullRequestTitleMatch:
type: string
repositoryMatch:
type: string
type: object
Expand All @@ -4928,6 +4940,8 @@ spec:
properties:
allBranches:
type: boolean
allPullRequests:
type: boolean
api:
type: string
organization:
Expand All @@ -4949,6 +4963,8 @@ spec:
properties:
allBranches:
type: boolean
allPullRequests:
type: boolean
api:
type: string
group:
Expand Down Expand Up @@ -5851,6 +5867,10 @@ spec:
items:
type: string
type: array
pullRequestLabelMatch:
type: string
pullRequestTitleMatch:
type: string
repositoryMatch:
type: string
type: object
Expand All @@ -5859,6 +5879,8 @@ spec:
properties:
allBranches:
type: boolean
allPullRequests:
type: boolean
api:
type: string
organization:
Expand All @@ -5880,6 +5902,8 @@ spec:
properties:
allBranches:
type: boolean
allPullRequests:
type: boolean
api:
type: string
group:
Expand Down
Loading

0 comments on commit 24f0e75

Please sign in to comment.