Skip to content

Commit

Permalink
Aspire schema fixes. (#4067)
Browse files Browse the repository at this point in the history
* Aspire schema fixes.

* latest update.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add test case to cover container.v1 resource.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
mitchdenny and pre-commit-ci[bot] authored Sep 12, 2024
1 parent 6b6a375 commit 07352f9
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 2 deletions.
122 changes: 120 additions & 2 deletions src/schemas/json/aspire-8.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"oneOf": [
{
"type": "object",
"description": "A resource that represents a Dockerfile that will be built into a container duing deployment.",
"description": "A resource that represents a Dockerfile that will be built into a container during deployment.",
"required": ["type", "path", "context"],
"properties": {
"type": {
Expand All @@ -38,6 +38,9 @@
},
"bindings": {
"$ref": "#/definitions/bindings"
},
"buildArgs": {
"$ref": "#/definitions/buildArgs"
}
},
"additionalProperties": false
Expand Down Expand Up @@ -73,6 +76,54 @@
"bindMounts": {
"$ref": "#/definitions/bindMounts"
},
"volumes": {
"$ref": "#/definitions/volumes"
},
"build": false
},
"additionalProperties": false
},
{
"type": "object",
"description": "A generic container resource.",
"oneOf": [
{
"required": ["type", "build"]
},
{
"required": ["type", "image"]
}
],
"properties": {
"type": {
"const": "container.v1"
},
"image": {
"type": "string",
"description": "A string representing the container image to be used."
},
"entrypoint": {
"type": "string",
"description": "The entrypoint to use for the container image when executed."
},
"args": {
"$ref": "#/definitions/args"
},
"build": {
"$ref": "#/definitions/build"
},
"connectionString": {
"$ref": "#/definitions/connectionString"
},
"env": {
"$ref": "#/definitions/env"
},
"bindings": {
"$ref": "#/definitions/bindings"
},
"bindMounts": {
"$ref": "#/definitions/bindMounts"
},
"volumes": {
"$ref": "#/definitions/volumes"
}
Expand Down Expand Up @@ -113,7 +164,7 @@
},
"workingDirectory": {
"type": "string",
"description": "The path to the working directory. Should be intepretted as being relative to the AppHost directory."
"description": "The path to the working directory. Should be interpreted as being relative to the AppHost directory."
},
"command": {
"type": "string",
Expand Down Expand Up @@ -377,6 +428,7 @@
"enum": [
"parameter.v0",
"container.v0",
"container.v1",
"dockerfile.v0",
"project.v0",
"value.v0",
Expand Down Expand Up @@ -416,6 +468,72 @@
"type": "string"
}
},
"build": {
"type": "object",
"description": "An object that captures properties that control the building of a container image.",
"required": ["context", "dockerfile"],
"properties": {
"context": {
"type": "string",
"description": "The path to the context directory for the container build. Can be relative of absolute. If relative it is relative to the location of the manifest file."
},
"dockerfile": {
"type": "string",
"description": "The path to the Dockerfile. Can be relative or absolute. If relative it is relative to the manifest file."
},
"args": {
"type": "object",
"description": "A list of build arguments which are used during container build.",
"additionalProperties": {
"type": "string"
}
},
"secrets": {
"type": "object",
"description": "A list of build arguments which are used during container build.",
"additionalProperties": {
"type": "object",
"required": ["type"],
"oneOf": [
{
"required": ["type", "value"],
"properties": {
"type": {
"type": "string",
"const": "env"
},
"value": {
"type": "string",
"description": "If provided use as the value for the environment variable when docker build is run."
}
}
},
{
"required": ["type", "source"],
"properties": {
"type": {
"type": "string",
"const": "file"
},
"source": {
"type": "string",
"description": "Path to secret file. If relative, the path is relative to the manifest file."
}
}
}
]
}
}
},
"additionalProperties": false
},
"buildArgs": {
"type": "object",
"description": "A list of build arguments which are used during container build (for dockerfile.v0 resource type).",
"additionalProperties": {
"type": "string"
}
},
"bindings": {
"type": "object",
"description": "A list of port bindings for the resource when it is deployed.",
Expand Down
44 changes: 44 additions & 0 deletions src/test/aspire-8.0/withdockerfile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "https://json.schemastore.org/aspire-8.0.json",
"resources": {
"goversion": {
"inputs": {
"value": {
"type": "string"
}
},
"type": "parameter.v0",
"value": "{goversion.inputs.value}"
},
"mycontainer": {
"build": {
"args": {
"GO_VERSION": "{goversion.value}"
},
"context": "qots",
"dockerfile": "qots/Dockerfile",
"secrets": {
"SECRET_ASENV": {
"type": "env",
"value": "{secret.value}"
},
"SECRET_ASFILE": {
"source": "Program.cs",
"type": "file"
}
}
},
"type": "container.v1"
},
"secret": {
"inputs": {
"value": {
"secret": true,
"type": "string"
}
},
"type": "parameter.v0",
"value": "{secret.inputs.value}"
}
}
}

0 comments on commit 07352f9

Please sign in to comment.