Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gitlab-ci] Various fixes for scheme #1542

Merged
merged 3 commits into from
Mar 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"gitlab-ci-variables-object": {
"stage": "test",
"script": ["true"],
"variables": {
"DEPLOY_ENVIRONMENT": {
"value": "staging",
"description": "The deployment target. Change this variable to 'canary' or 'production' if needed."
}
}
}
}
1 change: 0 additions & 1 deletion src/schema-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
"expo-37.0.0.json",
"geojson.json",
"github-workflow.json",
"gitlab-ci.json",
"jasonette.json",
"jdt.json",
"ksp-avc.json",
Expand Down
83 changes: 61 additions & 22 deletions src/schemas/json/gitlab-ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"services": { "$ref": "#/definitions/services" },
"before_script": { "$ref": "#/definitions/before_script" },
"after_script": { "$ref": "#/definitions/after_script" },
"variables": { "$ref": "#/definitions/variables" },
"variables": { "$ref": "#/definitions/globalVariables" },
"cache": { "$ref": "#/definitions/cache" },
"default": {
"type": "object",
Expand Down Expand Up @@ -101,15 +101,15 @@
"items": {
"type": "string"
},
"minLength": 1
"minItems": 1
},
"exclude": {
"type": "array",
"description": "A list of paths to files/folders that should be excluded in the artifact.",
"items": {
"type": "string"
},
"minLength": 1
"minItems": 1
},
"expose_as": {
"type": "string",
Expand Down Expand Up @@ -165,7 +165,7 @@
"items": {
"type": "string"
},
"minLength": 1
"minItems": 1
}
]
},
Expand All @@ -182,7 +182,7 @@
"items": {
"type": "string"
},
"minLength": 1
"minItems": 1
}
]
},
Expand Down Expand Up @@ -419,7 +419,40 @@
"secrets": {
"type": "object",
"description": "Defines secrets to be injected as environment variables",
"items": {}
"additionalProperties": {
"type": "object",
"additionalProperties": {
"type": "object",
"description": "Environment variable name",
"properties": {
"vault": {
"oneOf": [
{
"type": "string",
"description": "The secret to be fetched from Vault (e.g. 'production/db/password@ops' translates to secret 'ops/data/production/db', field `password`)"
},
{
"type": "object",
"properties": {
"engine": {
"type": "object",
"properties": {
"name": { "type": "string" },
"path": { "type": "string" }
},
"required": ["name", "path"]
},
"path": { "type": "string" },
"field": { "type": "string" }
},
"required": ["engine", "path", "field"]
}
]
}
},
"required": ["vault"]
}
}
},
"before_script": {
"type": "array",
Expand Down Expand Up @@ -491,11 +524,30 @@
}
}
},
"globalVariables": {
"description": "Defines environment variables globally. Job level property overrides global variables. If a job sets `variables: {}`, all global variables are turned off. You can use the value and description keywords to define variables that are prefilled when running a pipeline manually.",
"anyOf": [
{ "$ref": "#/definitions/variables" },
{
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"value": { "type": "string" },
"description": {
"type": "string",
"description": "Explains what the variable is used for, what the acceptable values are."
}
}
}
}
]
},
"variables": {
"type": "object",
"description": "Defines environment variables for specific jobs or globally. Job level property overrides global variables. If a job sets `variables: {}`, all global variables are turned off.",
"description": "Defines environment variables for specific jobs. Job level property overrides global variables. If a job sets `variables: {}`, all global variables are turned off.",
"additionalProperties": {
"type": ["string", "integer", "object"]
"type": ["string", "integer"]
}
},
"timeout": {
Expand Down Expand Up @@ -780,20 +832,7 @@
"rules": { "$ref": "#/definitions/rules" },
"variables": { "$ref": "#/definitions/variables" },
"cache": { "$ref": "#/definitions/cache" },
"secrets": {
"type": "object",
"description": "Defines secrets to be injected as environment variables",
"additionalProperties": {
"type": "object",
"description": "Environment variable name",
"properties": {
"vault": {
"type": "string",
"description": "The secret to be fetched from Vault (e.g. 'production/db/password@ops' translates to secret 'ops/data/production/db', field `password`)"
}
}
}
},
"secrets": { "$ref": "#/definitions/secrets" },
"script": {
"description": "Shell scripts executed by the Runner. The only required property of jobs. Be careful with special characters (e.g. `:`, `{`, `}`, `&`) and use single or double quotes to avoid issues.",
"oneOf": [
Expand Down
5 changes: 4 additions & 1 deletion src/test/gitlab-ci/gitlab-ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
{
"project": "my-group/my-project",
"ref": "master",
"file": [ "/templates/.gitlab-ci-template.yml", "/templates/another-template-to-include.yml" ]
"file": [
"/templates/.gitlab-ci-template.yml",
"/templates/another-template-to-include.yml"
]
}
],
"build": {
Expand Down
22 changes: 22 additions & 0 deletions src/test/gitlab-ci/variables.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"variables": {
"DEPLOY_ENVIRONMENT": {
"value": "staging",
"description": "The deployment target. Change this variable to 'canary' or 'production' if needed."
}
},
"gitlab-ci-variables-string": {
"stage": "test",
"script": ["true"],
"variables": {
"TEST_VAR": "String variable"
}
},
"gitlab-ci-variables-integer": {
"stage": "test",
"script": ["true"],
"variables": {
"canonical": 685230
}
}
}