Skip to content
Snippets Groups Projects
Commit 906b7b35 authored by Benguria Elguezabal, Gorka's avatar Benguria Elguezabal, Gorka
Browse files

adds tags to jobs

parent 946b8412
No related branches found
No related tags found
No related merge requests found
Pipeline #153296 passed
...@@ -417,6 +417,8 @@ Here are variables supported to configure review environments: ...@@ -417,6 +417,8 @@ Here are variables supported to configure review environments:
| :lock: `K8S_REVIEW_CA_CERT` | the Kubernetes server certificate authority for `review` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` | | :lock: `K8S_REVIEW_CA_CERT` | the Kubernetes server certificate authority for `review` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` |
| :lock: `K8S_REVIEW_TOKEN`| service account token for `review` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` | | :lock: `K8S_REVIEW_TOKEN`| service account token for `review` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` |
| `review-autostop-duration` / `K8S_REVIEW_AUTOSTOP_DURATION` | The amount of time before GitLab will automatically stop `review` environments | `4 hours` | | `review-autostop-duration` / `K8S_REVIEW_AUTOSTOP_DURATION` | The amount of time before GitLab will automatically stop `review` environments | `4 hours` |
| `k8s-review-job-tags` / `K8S_REVIEW_JOB_TAGS` | Tags to be used for selecting runners for the job | `[]` |
| `k8s-cleanup-review-job-tags` / `K8S_CLEANUP_REVIEW_JOB_TAGS` | Tags to be used for selecting runners for the job | `[]` |
### Integration environment configuration ### Integration environment configuration
...@@ -435,6 +437,7 @@ Here are variables supported to configure the integration environment: ...@@ -435,6 +437,7 @@ Here are variables supported to configure the integration environment:
| `integ-url` / `K8S_INTEG_URL` | Kubernetes API url for `integration` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_URL` | | `integ-url` / `K8S_INTEG_URL` | Kubernetes API url for `integration` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_URL` |
| :lock: `K8S_INTEG_CA_CERT` | the Kubernetes server certificate authority for `integration` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` | | :lock: `K8S_INTEG_CA_CERT` | the Kubernetes server certificate authority for `integration` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` |
| :lock: `K8S_INTEG_TOKEN` | service account token for `integration` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` | | :lock: `K8S_INTEG_TOKEN` | service account token for `integration` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` |
| `k8s-integ-job-tags` / `K8S_INTEG_JOB_TAGS` | Tags to be used for selecting runners for the job | `[]` |
### Staging environment configuration ### Staging environment configuration
...@@ -453,6 +456,7 @@ Here are variables supported to configure the staging environment: ...@@ -453,6 +456,7 @@ Here are variables supported to configure the staging environment:
| `staging-url` / `K8S_STAGING_URL` | Kubernetes API url for `staging` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_URL` | | `staging-url` / `K8S_STAGING_URL` | Kubernetes API url for `staging` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_URL` |
| :lock: `K8S_STAGING_CA_CERT` | the Kubernetes server certificate authority for `staging` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` | | :lock: `K8S_STAGING_CA_CERT` | the Kubernetes server certificate authority for `staging` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` |
| :lock: `K8S_STAGING_TOKEN`| service account token for `staging` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` | | :lock: `K8S_STAGING_TOKEN`| service account token for `staging` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` |
| `k8s-staging-job-tags` / `K8S_STAGING_JOB_TAGS` | Tags to be used for selecting runners for the job | `[]` |
### Production environment configuration ### Production environment configuration
...@@ -472,6 +476,7 @@ Here are variables supported to configure the production environment: ...@@ -472,6 +476,7 @@ Here are variables supported to configure the production environment:
| :lock: `K8S_PROD_CA_CERT` | the Kubernetes server certificate authority for `production` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` | | :lock: `K8S_PROD_CA_CERT` | the Kubernetes server certificate authority for `production` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_CA_CERT` |
| :lock: `K8S_PROD_TOKEN` | service account token for `production` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` | | :lock: `K8S_PROD_TOKEN` | service account token for `production` env _(only define if using exploded kubeconfig parameters and if different from default)_ | `$K8S_TOKEN` |
| `prod-deploy-strategy` / `K8S_PROD_DEPLOY_STRATEGY` | Defines the deployment to production strategy. One of `manual` (i.e. _one-click_) or `auto`. | `manual` | | `prod-deploy-strategy` / `K8S_PROD_DEPLOY_STRATEGY` | Defines the deployment to production strategy. One of `manual` (i.e. _one-click_) or `auto`. | `manual` |
| `k8s-prod-job-tags` / `K8S_PROD_JOB_TAGS` | Tags to be used for selecting runners for the job | `[]` |
### kube-score job ### kube-score job
...@@ -485,6 +490,7 @@ Here are its parameters: ...@@ -485,6 +490,7 @@ Here are its parameters:
| `kube-score-image` / `K8S_KUBE_SCORE_IMAGE` | Docker image to run [kube-score](https://github.com/zegl/kube-score) | `registry.hub.docker.com/zegl/kube-score:latest` **it is recommended to set a tool version compatible with your Kubernetes cluster** | | `kube-score-image` / `K8S_KUBE_SCORE_IMAGE` | Docker image to run [kube-score](https://github.com/zegl/kube-score) | `registry.hub.docker.com/zegl/kube-score:latest` **it is recommended to set a tool version compatible with your Kubernetes cluster** |
| `score-disabled` / `K8S_SCORE_DISABLED` | Set to `true` to disable the `kube-score` analysis | _none_ (enabled) | | `score-disabled` / `K8S_SCORE_DISABLED` | Set to `true` to disable the `kube-score` analysis | _none_ (enabled) |
| `score-extra-opts` / `K8S_SCORE_EXTRA_OPTS` | [Additional options](https://github.com/zegl/kube-score#configuration) to `kube-score` command line | _none_ | | `score-extra-opts` / `K8S_SCORE_EXTRA_OPTS` | [Additional options](https://github.com/zegl/kube-score#configuration) to `kube-score` command line | _none_ |
| `k8s-score-job-tags` / `K8S_SCORE_JOB_TAGS` | Tags to be used for selecting runners for the job | `[]` |
## Variants ## Variants
......
...@@ -58,6 +58,13 @@ ...@@ -58,6 +58,13 @@
"name": "K8S_KUSTOMIZE_ARGS", "name": "K8S_KUSTOMIZE_ARGS",
"description": "Additional [`kubectl kustomize` options](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#kustomize)\n\n_For example: `--enable-helm`_", "description": "Additional [`kubectl kustomize` options](https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#kustomize)\n\n_For example: `--enable-helm`_",
"advanced": true "advanced": true
},
{
"name": "K8S_K8S_SCORE_JOB_TAGS",
"description": "Tags to be used for selecting runners for the job",
"type": "array",
"default": [],
"advanced": true
} }
], ],
"features": [ "features": [
...@@ -125,6 +132,20 @@ ...@@ -125,6 +132,20 @@
"name": "K8S_REVIEW_CA_CERT", "name": "K8S_REVIEW_CA_CERT",
"description": "Kubernetes cluster server certificate authority for review env (only define if using exploded kubeconfig parameters and if different from global)", "description": "Kubernetes cluster server certificate authority for review env (only define if using exploded kubeconfig parameters and if different from global)",
"secret": true "secret": true
},
{
"name": "K8S_K8S_REVIEW_JOB_TAGS",
"description": "Tags to be used for selecting runners for the job",
"type": "array",
"default": [],
"advanced": true
},
{
"name": "K8S_K8S_CLEANUP_REVIEW_JOB_TAGS",
"description": "Tags to be used for selecting runners for the job",
"type": "array",
"default": [],
"advanced": true
} }
] ]
}, },
...@@ -169,6 +190,13 @@ ...@@ -169,6 +190,13 @@
"name": "K8S_INTEG_CA_CERT", "name": "K8S_INTEG_CA_CERT",
"description": "Kubernetes cluster server certificate authority for integration env (only define if using exploded kubeconfig parameters and if different from global)", "description": "Kubernetes cluster server certificate authority for integration env (only define if using exploded kubeconfig parameters and if different from global)",
"secret": true "secret": true
},
{
"name": "K8S_K8S_INTEG_JOB_TAGS",
"description": "Tags to be used for selecting runners for the job",
"type": "array",
"default": [],
"advanced": true
} }
] ]
}, },
...@@ -213,6 +241,13 @@ ...@@ -213,6 +241,13 @@
"name": "K8S_STAGING_CA_CERT", "name": "K8S_STAGING_CA_CERT",
"description": "Kubernetes cluster server certificate authority for staging env (only define if using exploded kubeconfig parameters and if different from global)", "description": "Kubernetes cluster server certificate authority for staging env (only define if using exploded kubeconfig parameters and if different from global)",
"secret": true "secret": true
},
{
"name": "K8S_K8S_STAGING_JOB_TAGS",
"description": "Tags to be used for selecting runners for the job",
"type": "array",
"default": [],
"advanced": true
} }
] ]
}, },
...@@ -264,6 +299,13 @@ ...@@ -264,6 +299,13 @@
"name": "K8S_PROD_CA_CERT", "name": "K8S_PROD_CA_CERT",
"description": "Kubernetes cluster server certificate authority for production env (only define if using exploded kubeconfig parameters and if different from global)", "description": "Kubernetes cluster server certificate authority for production env (only define if using exploded kubeconfig parameters and if different from global)",
"secret": true "secret": true
},
{
"name": "K8S_K8S_PROD_JOB_TAGS",
"description": "Tags to be used for selecting runners for the job",
"type": "array",
"default": [],
"advanced": true
} }
] ]
} }
......
...@@ -110,6 +110,31 @@ spec: ...@@ -110,6 +110,31 @@ spec:
prod-url: prod-url:
description: Kubernetes API url for production env (only define if using exploded kubeconfig parameters and if different from global) description: Kubernetes API url for production env (only define if using exploded kubeconfig parameters and if different from global)
default: '' default: ''
k8s-score-job-tags:
description: tags to filter applicable runners for k8s-score job
type: array
default: []
k8s-review-job-tags:
description: tags to filter applicable runners for k8s-review job
type: array
default: []
k8s-cleanup-review-job-tags:
description: tags to filter applicable runners for k8s-cleanup-review job
type: array
default: []
k8s-integ-job-tags:
description: tags to filter applicable runners for k8s-integration job
type: array
default: []
k8s-staging-job-tags:
description: tags to filter applicable runners for k8s-staging job
type: array
default: []
k8s-prod-job-tags:
description: tags to filter applicable runners for k8s-production job
type: array
default: []
--- ---
# default workflow rules: Merge Request pipelines # default workflow rules: Merge Request pipelines
workflow: workflow:
...@@ -895,6 +920,7 @@ k8s-review: ...@@ -895,6 +920,7 @@ k8s-review:
when: never when: never
# only on non-production, non-integration branches, with $K8S_REVIEW_SPACE set # only on non-production, non-integration branches, with $K8S_REVIEW_SPACE set
- if: '$K8S_REVIEW_SPACE != "" && $CI_COMMIT_REF_NAME !~ $PROD_REF && $CI_COMMIT_REF_NAME !~ $INTEG_REF' - if: '$K8S_REVIEW_SPACE != "" && $CI_COMMIT_REF_NAME !~ $PROD_REF && $CI_COMMIT_REF_NAME !~ $INTEG_REF'
tags: $[[ inputs.k8s-review-job-tags ]]
# stop review env (automatically triggered once branches are deleted) # stop review env (automatically triggered once branches are deleted)
k8s-cleanup-review: k8s-cleanup-review:
...@@ -919,6 +945,7 @@ k8s-cleanup-review: ...@@ -919,6 +945,7 @@ k8s-cleanup-review:
- if: '$K8S_REVIEW_SPACE != "" && $CI_COMMIT_REF_NAME !~ $PROD_REF && $CI_COMMIT_REF_NAME !~ $INTEG_REF' - if: '$K8S_REVIEW_SPACE != "" && $CI_COMMIT_REF_NAME !~ $PROD_REF && $CI_COMMIT_REF_NAME !~ $INTEG_REF'
when: manual when: manual
allow_failure: true allow_failure: true
tags: $[[ inputs.k8s-cleanup-review-job-tags ]]
k8s-integration: k8s-integration:
extends: .k8s-deploy extends: .k8s-deploy
...@@ -937,6 +964,7 @@ k8s-integration: ...@@ -937,6 +964,7 @@ k8s-integration:
rules: rules:
# only on integration branch(es), with $K8S_INTEG_SPACE set # only on integration branch(es), with $K8S_INTEG_SPACE set
- if: '$K8S_INTEG_SPACE != "" && $CI_COMMIT_REF_NAME =~ $INTEG_REF' - if: '$K8S_INTEG_SPACE != "" && $CI_COMMIT_REF_NAME =~ $INTEG_REF'
tags: $[[ inputs.k8s-integ-job-tags ]]
############################### ###############################
# Staging deploys are disabled by default since # Staging deploys are disabled by default since
...@@ -962,6 +990,7 @@ k8s-staging: ...@@ -962,6 +990,7 @@ k8s-staging:
rules: rules:
# only on production branch(es), with $K8S_STAGING_SPACE set # only on production branch(es), with $K8S_STAGING_SPACE set
- if: '$K8S_STAGING_SPACE != "" && $CI_COMMIT_REF_NAME =~ $PROD_REF' - if: '$K8S_STAGING_SPACE != "" && $CI_COMMIT_REF_NAME =~ $PROD_REF'
tags: $[[ inputs.k8s-staging-job-tags ]]
k8s-production: k8s-production:
extends: .k8s-deploy extends: .k8s-deploy
...@@ -989,3 +1018,4 @@ k8s-production: ...@@ -989,3 +1018,4 @@ k8s-production:
- if: '$K8S_PROD_DEPLOY_STRATEGY == "manual"' - if: '$K8S_PROD_DEPLOY_STRATEGY == "manual"'
when: manual when: manual
- if: '$K8S_PROD_DEPLOY_STRATEGY == "auto"' - if: '$K8S_PROD_DEPLOY_STRATEGY == "auto"'
tags: $[[ inputs.k8s-prod-job-tags ]]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment