diff --git a/api/generated_apimodel.go b/api/generated_apimodel.go index fd8e232..f7b0a12 100644 --- a/api/generated_apimodel.go +++ b/api/generated_apimodel.go @@ -173,7 +173,7 @@ type RepositoryCreateDto struct { // this repository contains unit tests (currently ignored except for helm charts) Unittest *bool `yaml:"unittest,omitempty" json:"unittest,omitempty"` Configuration *RepositoryConfigurationDto `yaml:"configuration,omitempty" json:"configuration,omitempty"` - // 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. + // 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. Filecategory *map[string][]string `yaml:"filecategory,omitempty" json:"filecategory,omitempty"` // The jira issue to use for committing a change, or the last jira issue used. JiraIssue string `yaml:"-" json:"jiraIssue"` @@ -189,7 +189,7 @@ type RepositoryDto struct { // this repository contains unit tests (currently ignored except for helm charts) Unittest *bool `yaml:"unittest,omitempty" json:"unittest,omitempty"` Configuration *RepositoryConfigurationDto `yaml:"configuration,omitempty" json:"configuration,omitempty"` - // 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. + // 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. Filecategory *map[string][]string `yaml:"filecategory,omitempty" json:"filecategory,omitempty"` // ISO-8601 UTC date time at which this information was originally committed. When sending an update, include the original timestamp you got so we can detect concurrent updates. TimeStamp string `yaml:"-" json:"timeStamp"` @@ -215,7 +215,7 @@ type RepositoryPatchDto struct { // this repository contains unit tests (currently ignored except for helm charts) Unittest *bool `yaml:"unittest,omitempty" json:"unittest,omitempty"` Configuration *RepositoryConfigurationDto `yaml:"configuration,omitempty" json:"configuration,omitempty"` - // 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. + // 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. Filecategory *map[string][]string `yaml:"filecategory,omitempty" json:"filecategory,omitempty"` // ISO-8601 UTC date time at which this information was originally committed. When sending an update, include the original timestamp you got so we can detect concurrent updates. TimeStamp string `yaml:"-" json:"timeStamp"` diff --git a/api/openapi-v3-spec.json b/api/openapi-v3-spec.json index 2b8f300..89c7de2 100644 --- a/api/openapi-v3-spec.json +++ b/api/openapi-v3-spec.json @@ -2917,7 +2917,7 @@ }, "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": { @@ -2925,7 +2925,7 @@ } }, "example": { - "cache-template": ["templates/*.yaml", "another/path/*/*.json"] + "cache-template": ["templates/template1.yaml", "another/path/template2.json"] } }, "ConditionReferenceDto": { diff --git a/internal/service/repositories/repositories_test.go b/internal/service/repositories/repositories_test.go index 5f88f55..0572b7f 100644 --- a/internal/service/repositories/repositories_test.go +++ b/internal/service/repositories/repositories_test.go @@ -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", } @@ -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{ @@ -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", }) diff --git a/test/acceptance/util_dtos_test.go b/test/acceptance/util_dtos_test.go index d030cb2..3f0aa34 100644 --- a/test/acceptance/util_dtos_test.go +++ b/test/acceptance/util_dtos_test.go @@ -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", @@ -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 ` } diff --git a/test/resources/acceptance-expected/repository-create.json b/test/resources/acceptance-expected/repository-create.json index 3a94e2f..70980d1 100644 --- a/test/resources/acceptance-expected/repository-create.json +++ b/test/resources/acceptance-expected/repository-create.json @@ -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", diff --git a/test/resources/acceptance-expected/repository-update-newowner.json b/test/resources/acceptance-expected/repository-update-newowner.json index 4980b0d..609686e 100644 --- a/test/resources/acceptance-expected/repository-update-newowner.json +++ b/test/resources/acceptance-expected/repository-update-newowner.json @@ -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", diff --git a/test/resources/acceptance-expected/repository-update.json b/test/resources/acceptance-expected/repository-update.json index 3a94e2f..70980d1 100644 --- a/test/resources/acceptance-expected/repository-update.json +++ b/test/resources/acceptance-expected/repository-update.json @@ -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",