Skip to content

Commit

Permalink
feat(#227): restrict to explicit paths and files
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanHCB committed Nov 8, 2023
1 parent 06b19de commit a83b62b
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions api/generated_apimodel.go

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

4 changes: 2 additions & 2 deletions api/openapi-v3-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2917,15 +2917,15 @@
},
"RepositoryFileCategoriesDto": {
"type": "object",
"description": "Assign a category to a list of file globs, e.g. to mark them for caching purposes. The key is the category name, and the value is a list of globs. Files are considered to have that category if their path matches any of the given globs.",
"description": "Assign a category to a list of files, e.g. to mark them for caching purposes. The key is the category name, and the value is a list of paths. Files are considered to have that category if their path is in the list.",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
},
"example": {
"cache-template": ["templates/*.yaml", "another/path/*/*.json"]
"cache-template": ["templates/template1.yaml", "another/path/template2.json"]
}
},
"ConditionReferenceDto": {
Expand Down
6 changes: 3 additions & 3 deletions internal/service/repositories/repositories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func createRepositoryDto() openapi.RepositoryDto {
DefaultReviewers: []string{"defaultreviewer1"},
SignedApprovers: []string{"signedapprover1"},
},
Filecategory: &map[string][]string{"a": {"path/*.yaml"}},
Filecategory: &map[string][]string{"a": {"path/a.yaml"}},
TimeStamp: "ts",
CommitHash: "hash",
}
Expand Down Expand Up @@ -135,7 +135,7 @@ func TestPatchRepository_ReplaceAll(t *testing.T) {
DefaultReviewers: []string{"newdefaultreviewer1"},
SignedApprovers: []string{"newsignedapprover1"},
},
Filecategory: &map[string][]string{"b": {"*.yaml", "*.json"}},
Filecategory: &map[string][]string{"b": {"b.yaml", "b.json"}},
TimeStamp: "newts",
CommitHash: "newhash",
}, openapi.RepositoryDto{
Expand Down Expand Up @@ -169,7 +169,7 @@ func TestPatchRepository_ReplaceAll(t *testing.T) {
DefaultReviewers: []string{"newdefaultreviewer1"},
SignedApprovers: []string{"newsignedapprover1"},
},
Filecategory: &map[string][]string{"b": {"*.yaml", "*.json"}},
Filecategory: &map[string][]string{"b": {"b.yaml", "b.json"}},
TimeStamp: "newts",
CommitHash: "newhash",
})
Expand Down
6 changes: 3 additions & 3 deletions test/acceptance/util_dtos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func tstUpdatedServicePayload(name string) openapi.NotificationPayload {

func tstRepository() openapi.RepositoryDto {
fc := map[string][]string{
"cached-template": {"cached-templates/*.yaml", "more/cached/templates/*.yaml"},
"cached-template": {"cached-templates/tpl1.yaml", "more/cached/templates/tpl2.yaml"},
}
return openapi.RepositoryDto{
Owner: "some-owner",
Expand Down Expand Up @@ -316,8 +316,8 @@ configuration:
- some-user
filecategory:
cached-template:
- cached-templates/*.yaml
- more/cached/templates/*.yaml
- cached-templates/tpl1.yaml
- more/cached/templates/tpl2.yaml
`
}

Expand Down
4 changes: 2 additions & 2 deletions test/resources/acceptance-expected/repository-create.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
},
"filecategory": {
"cached-template": [
"cached-templates/*.yaml",
"more/cached/templates/*.yaml"
"cached-templates/tpl1.yaml",
"more/cached/templates/tpl2.yaml"
]
},
"jiraIssue": "ISSUE-2345",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
},
"filecategory": {
"cached-template": [
"cached-templates/*.yaml",
"more/cached/templates/*.yaml"
"cached-templates/tpl1.yaml",
"more/cached/templates/tpl2.yaml"
]
},
"jiraIssue": "ISSUE-2345",
Expand Down
4 changes: 2 additions & 2 deletions test/resources/acceptance-expected/repository-update.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
},
"filecategory": {
"cached-template": [
"cached-templates/*.yaml",
"more/cached/templates/*.yaml"
"cached-templates/tpl1.yaml",
"more/cached/templates/tpl2.yaml"
]
},
"jiraIssue": "ISSUE-2345",
Expand Down

0 comments on commit a83b62b

Please sign in to comment.