ci: pass Kubernetes version as parameter to mini-e2e job

Move the mini-e2e job into a template-job and generate two jobs out of
it: mini-e2e/k8s-1.17.8 and mini-e2e/k8s-1.18.5

By passing the k8s_version as variable to the job-template, and placing
it in the parameters for the mini-e2e.groovy script, all hard-coded
occurences of the Kubernetes version can be replaced by the
{k8s_version} placeholder.

See-also: https://jenkins-job-builder.readthedocs.io/en/latest/definition.html#job-template
Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2020-08-03 15:38:59 +02:00 committed by mergify[bot]
parent 8fbeefa989
commit 1de6b0bba2
2 changed files with 22 additions and 5 deletions

View File

@ -1,6 +1,14 @@
--- ---
- job: - project:
name: mini-e2e name: mini-e2e
k8s_version:
- '1.17.8'
- '1.18.5'
jobs:
- 'mini-e2e/k8s-{k8s_version}'
- job-template:
name: 'mini-e2e/k8s-{k8s_version}'
project-type: pipeline project-type: pipeline
sandbox: true sandbox: true
concurrent: true concurrent: true
@ -10,6 +18,14 @@
- build-discarder: - build-discarder:
days-to-keep: 7 days-to-keep: 7
artifact-days-to-keep: 7 artifact-days-to-keep: 7
# default variables
k8s_version: '<unset>'
# generated parameters for the job (used in the groovy script)
parameters:
- string:
name: k8s_version
default: '{k8s_version}'
description: Kubernetes version to deploy in the test cluster.
pipeline-scm: pipeline-scm:
scm: scm:
- git: - git:
@ -21,8 +37,9 @@
lightweight-checkout: true lightweight-checkout: true
triggers: triggers:
- github-pull-request: - github-pull-request:
status-context: ci/centos/mini-e2e/k8s-1.18 status-context: 'ci/centos/mini-e2e/k8s-{k8s_version}'
trigger-phrase: '/(re)?test ((all)|(ci/centos/mini-e2e(/k8s-1.18)?))' # yamllint disable-line rule:line-length
trigger-phrase: '/(re)?test ((all)|(ci/centos/mini-e2e(/k8s-{k8s_version})?))'
permit-all: true permit-all: true
# TODO: set github-hooks to true when it is configured in GitHub # TODO: set github-hooks to true when it is configured in GitHub
github-hooks: false github-hooks: false

View File

@ -46,9 +46,9 @@ node('cico-workspace') {
// build e2e.test executable // build e2e.test executable
ssh 'cd /opt/build/go/src/github.com/ceph/ceph-csi && make containerized-build CONTAINER_CMD=podman TARGET=e2e.test' ssh 'cd /opt/build/go/src/github.com/ceph/ceph-csi && make containerized-build CONTAINER_CMD=podman TARGET=e2e.test'
} }
stage('deploy k8s v1.18.3 and rook') { stage('deploy k8s v{k8s_version} and rook') {
timeout(time: 30, unit: 'MINUTES') { timeout(time: 30, unit: 'MINUTES') {
ssh './single-node-k8s.sh --k8s-version=v1.18.3' ssh './single-node-k8s.sh --k8s-version=v${k8s_version}'
} }
} }
stage('run e2e') { stage('run e2e') {