Skip to content

Commit

Permalink
core(config): add resolvers to schema
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Braun <[email protected]>
  • Loading branch information
bluebrown committed Jul 25, 2023
1 parent 01f72fc commit 2dabbca
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 12 deletions.
20 changes: 20 additions & 0 deletions assets/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,26 @@
"type": "string"
}
}
},
"resolvers": {
"description": "List of custom resolvers",
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"description": "The name of the resolver",
"type": "string"
},
"paths": {
"description": "List of paths to search for image refs. Does not stop on first match",
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
},
"required": [
Expand Down
4 changes: 2 additions & 2 deletions kobold/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ const (
)

type FileTypeSpec struct {
Kind string
Pattern string
Kind string `json:"kind,omitempty"`
Pattern string `json:"pattern,omitempty"`
}

type EndpointRef struct {
Expand Down
16 changes: 12 additions & 4 deletions kobold/config/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ repositories:

subscriptions:
- name: nonprod
endpointRefs: [{ name: my-acr }]
repositoryRef: { name: test }
endpointRefs: [{name: my-acr}]
repositoryRef: {name: test}
branch: main
strategy: commit
scopes:
- /env/dev/
- /env/stage/

- name: prod
endpointRefs: [{ name: my-acr }]
repositoryRef: { name: test }
endpointRefs: [{name: my-acr}]
repositoryRef: {name: test}
branch: main
strategy: pull-request
scopes:
Expand All @@ -45,5 +45,13 @@ subscriptions:
pattern: ".ko.yaml"
- kind: docker-compose
pattern: "compose.yaml"
- kind: custom-helm
pattern: "values*.yaml"
- kind: kubernetes
pattern: "*"

resolvers:
- name: custom-helm
paths:
- some.path.to.image
- some.other
19 changes: 13 additions & 6 deletions kobold/config/testdata/expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ repositories:
provider: github
url: https://github.com/bluebrown/kobold-test
username: test-usr
resolvers:
- name: custom-helm
paths:
- some.path.to.image
- some.other
subscriptions:
- branch: main
endpointRefs:
Expand All @@ -32,12 +37,14 @@ subscriptions:
endpointRefs:
- name: my-acr
fileAssociations:
- Kind: ko-build
Pattern: .ko.yaml
- Kind: docker-compose
Pattern: compose.yaml
- Kind: kubernetes
Pattern: '*'
- kind: ko-build
pattern: .ko.yaml
- kind: docker-compose
pattern: compose.yaml
- kind: custom-helm
pattern: values*.yaml
- kind: kubernetes
pattern: '*'
name: prod
repositoryRef:
name: test
Expand Down

0 comments on commit 2dabbca

Please sign in to comment.