Skip to content

Commit

Permalink
Add support for composable images when validating configs
Browse files Browse the repository at this point in the history
  • Loading branch information
akalipetis committed Jul 19, 2024
1 parent 2ddf43f commit 3191ebd
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 5 deletions.
39 changes: 36 additions & 3 deletions validator/schema/platformsh.application.json
Original file line number Diff line number Diff line change
Expand Up @@ -888,11 +888,44 @@
"type": "string"
},
"title": "Resolve additional IPs to domain names."
},
"stack": {
"oneOf": [
{
"type": "string"
},
{
"type": "object"
},
{
"type": "array",
"items": {
"oneOf": [
{
"type": "string"
},
{
"type": "object"
}
]
}
}
]
}
},
"required": [
"name",
"type"
"oneOf": [
{
"required": [
"name",
"type"
]
},
{
"required": [
"name",
"stack"
]
}
],
"additionalProperties": false
}
36 changes: 34 additions & 2 deletions validator/schema/upsun.json
Original file line number Diff line number Diff line change
Expand Up @@ -875,10 +875,42 @@
"type": "string"
},
"title": "Resolve additional IPs to domain names."
},
"stack": {
"oneOf": [
{
"type": "string"
},
{
"type": "object"
},
{
"type": "array",
"items": {
"oneOf": [
{
"type": "string"
},
{
"type": "object"
}
]
}
}
]
}
},
"required": [
"type"
"oneOf": [
{
"required": [
"type"
]
},
{
"required": [
"stack"
]
}
],
"additionalProperties": false
}
Expand Down
67 changes: 67 additions & 0 deletions validator/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,73 @@ services:
},
wantErr: false,
},
{
name: "stack",
args: args{
path: fstest.MapFS{
".upsun/config.yaml": &fstest.MapFile{
Data: []byte(`
applications:
app1:
stack:
- "[email protected]":
extensions:
- apcu
- sodium
- xsl
- pdo_sqlite
- "nodejs@20"
- "[email protected]"
`,
),
},
".upsun/services.yaml": &fstest.MapFile{
Data: []byte(`
services:
redis:
type: redis:6.2
size: AUTO
`,
),
},
},
},
wantErr: false,
},
{
name: "stack-and-type",
args: args{
path: fstest.MapFS{
".upsun/config.yaml": &fstest.MapFile{
Data: []byte(`
applications:
app1:
type: "python:3.11"
stack:
- "[email protected]":
extensions:
- apcu
- sodium
- xsl
- pdo_sqlite
- "nodejs@20"
- "[email protected]"
`,
),
},
".upsun/services.yaml": &fstest.MapFile{
Data: []byte(`
services:
redis:
type: redis:6.2
size: AUTO
`,
),
},
},
},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 3191ebd

Please sign in to comment.