Skip to content

Commit

Permalink
fix(config): Replace json tag with yaml for VerifyEnvVar (#9558)
Browse files Browse the repository at this point in the history
* fix(config): Replace json tag with yaml for VerifyEnvVar

Signed-off-by: Suleiman Dibirov <[email protected]>

* fixed modify_test.go

Signed-off-by: Suleiman Dibirov <[email protected]>

---------

Signed-off-by: Suleiman Dibirov <[email protected]>
  • Loading branch information
idsulik authored Nov 12, 2024
1 parent 144142d commit fd26f04
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 11 deletions.
31 changes: 30 additions & 1 deletion docs-v2/content/en/schemas/v4beta12.json
Original file line number Diff line number Diff line change
Expand Up @@ -4639,6 +4639,14 @@
"x-intellij-html-description": "entrypoint array. Not executed within a shell. The container image's ENTRYPOINT is used if this is not provided.",
"default": "[]"
},
"env": {
"items": {
"$ref": "#/definitions/VerifyEnvVar"
},
"type": "array",
"description": "list of environment variables to set in the container.",
"x-intellij-html-description": "list of environment variables to set in the container."
},
"image": {
"type": "string",
"description": "container image name.",
Expand All @@ -4654,14 +4662,35 @@
"name",
"image",
"command",
"args"
"args",
"env"
],
"additionalProperties": false,
"type": "object",
"description": "a list of tests to run on images that Skaffold builds.",
"x-intellij-html-description": "a list of tests to run on images that Skaffold builds."
},
"VerifyEnvVar": {
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
"description": "of the environment variable. Must be a C_IDENTIFIER.",
"x-intellij-html-description": "of the environment variable. Must be a C_IDENTIFIER."
},
"value": {
"type": "string",
"description": "of the environment variable.",
"x-intellij-html-description": "of the environment variable."
}
},
"preferredOrder": [
"name",
"value"
],
"additionalProperties": false,
"type": "object",
"description": "represents an environment variable present in a Container.",
"x-intellij-html-description": "represents an environment variable present in a Container."
Expand Down
15 changes: 9 additions & 6 deletions pkg/skaffold/inspect/jobManifestPaths/modify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ verify:
container:
name: foo
image: foo
env: []
env:
- name: key
value: value
executionMode:
kubernetesCluster:
jobManifestPath: modified-foo.yaml
Expand All @@ -60,6 +62,12 @@ verify:
Container: latest.VerifyContainer{
Name: "foo",
Image: "foo",
Env: []latest.VerifyEnvVar{
{
Name: "key",
Value: "value",
},
},
},
ExecutionMode: latest.VerifyExecutionModeConfig{
VerifyExecutionModeType: latest.VerifyExecutionModeType{
Expand Down Expand Up @@ -88,7 +96,6 @@ verify:
container:
name: foo
image: foo
env: []
executionMode:
kubernetesCluster:
jobManifestPath: verify-manifest.yaml
Expand All @@ -100,15 +107,13 @@ customActions:
containers:
- name: task1
image: task1-img
env: []
- name: action2
executionMode:
kubernetesCluster:
jobManifestPath: custom-action-job-manifest.yaml
containers:
- name: task2
image: task2-img
env: []
`,
originalCfg: latest.SkaffoldConfig{
APIVersion: "skaffold/v4beta5",
Expand Down Expand Up @@ -177,7 +182,6 @@ verify:
container:
name: foo
image: foo
env: []
executionMode:
kubernetesCluster:
jobManifestPath: modified-foo.yaml
Expand All @@ -189,7 +193,6 @@ customActions:
containers:
- name: task1
image: task1-img
env: []
`,
originalCfg: latest.SkaffoldConfig{
APIVersion: "skaffold/v4beta5",
Expand Down
8 changes: 4 additions & 4 deletions pkg/skaffold/schema/latest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,16 +724,16 @@ type VerifyContainer struct {
// The container image's CMD is used if this is not provided.
Args []string `yaml:"args,omitempty"`
// Env is the list of environment variables to set in the container.
Env []VerifyEnvVar `json:"env,omitempty"`
Env []VerifyEnvVar `yaml:"env,omitempty"`
}

// VerifyEnvVar represents an environment variable present in a Container.
type VerifyEnvVar struct {
// Name of the environment variable. Must be a C_IDENTIFIER.
Name string `json:"name" yamltags:"required"`
Name string `yaml:"name" yamltags:"required"`

// Value of the environment variable
Value string `json:"value"`
// Value of the environment variable.
Value string `yaml:"value"`
}

// RenderConfig contains all the configuration needed by the render steps.
Expand Down

0 comments on commit fd26f04

Please sign in to comment.