Skip to content
This repository was archived by the owner on Jul 15, 2024. It is now read-only.

Commit 24f0e75

Browse files
author
Fardin Khanjani
committed
feat: This commit adds pull request support to SCM generator so the generator
can create ArgoCD apps for PRs as well. Fixes #466 Signed-off-by: Fardin Khanjani <[email protected]>
1 parent 2e8d85e commit 24f0e75

File tree

15 files changed

+10235
-35
lines changed

15 files changed

+10235
-35
lines changed

api/v1alpha1/applicationset_types.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,8 @@ type SCMProviderGeneratorGithub struct {
314314
TokenRef *SecretRef `json:"tokenRef,omitempty"`
315315
// Scan all branches instead of just the default branch.
316316
AllBranches bool `json:"allBranches,omitempty"`
317+
// Scan all pull requests
318+
AllPullRequests bool `json:"allPullRequests,omitempty"`
317319
}
318320

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

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

347355
// PullRequestGenerator defines a generator that scrapes a PullRequest API to find candidate pull requests.

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ require (
9797
github.com/opencontainers/go-digest v1.0.0 // indirect
9898
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
9999
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
100+
github.com/pkg/errors v0.9.1 // indirect
100101
github.com/pmezard/go-difflib v1.0.0 // indirect
101102
github.com/prometheus/client_golang v1.11.0 // indirect
102103
github.com/prometheus/client_model v0.2.0 // indirect

manifests/crds/argoproj.io_applicationsets.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2778,6 +2778,10 @@ spec:
27782778
items:
27792779
type: string
27802780
type: array
2781+
pullRequestLabelMatch:
2782+
type: string
2783+
pullRequestTitleMatch:
2784+
type: string
27812785
repositoryMatch:
27822786
type: string
27832787
type: object
@@ -2786,6 +2790,8 @@ spec:
27862790
properties:
27872791
allBranches:
27882792
type: boolean
2793+
allPullRequests:
2794+
type: boolean
27892795
api:
27902796
type: string
27912797
organization:
@@ -2807,6 +2813,8 @@ spec:
28072813
properties:
28082814
allBranches:
28092815
type: boolean
2816+
allPullRequests:
2817+
type: boolean
28102818
api:
28112819
type: string
28122820
group:
@@ -4920,6 +4928,10 @@ spec:
49204928
items:
49214929
type: string
49224930
type: array
4931+
pullRequestLabelMatch:
4932+
type: string
4933+
pullRequestTitleMatch:
4934+
type: string
49234935
repositoryMatch:
49244936
type: string
49254937
type: object
@@ -4928,6 +4940,8 @@ spec:
49284940
properties:
49294941
allBranches:
49304942
type: boolean
4943+
allPullRequests:
4944+
type: boolean
49314945
api:
49324946
type: string
49334947
organization:
@@ -4949,6 +4963,8 @@ spec:
49494963
properties:
49504964
allBranches:
49514965
type: boolean
4966+
allPullRequests:
4967+
type: boolean
49524968
api:
49534969
type: string
49544970
group:
@@ -5851,6 +5867,10 @@ spec:
58515867
items:
58525868
type: string
58535869
type: array
5870+
pullRequestLabelMatch:
5871+
type: string
5872+
pullRequestTitleMatch:
5873+
type: string
58545874
repositoryMatch:
58555875
type: string
58565876
type: object
@@ -5859,6 +5879,8 @@ spec:
58595879
properties:
58605880
allBranches:
58615881
type: boolean
5882+
allPullRequests:
5883+
type: boolean
58625884
api:
58635885
type: string
58645886
organization:
@@ -5880,6 +5902,8 @@ spec:
58805902
properties:
58815903
allBranches:
58825904
type: boolean
5905+
allPullRequests:
5906+
type: boolean
58835907
api:
58845908
type: string
58855909
group:

0 commit comments

Comments
 (0)