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
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
sandbox: true
concurrent: true
@ -10,6 +18,14 @@
- build-discarder:
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:
scm:
- git:
@ -21,8 +37,9 @@
lightweight-checkout: true
triggers:
- github-pull-request:
status-context: ci/centos/mini-e2e/k8s-1.18
trigger-phrase: '/(re)?test ((all)|(ci/centos/mini-e2e(/k8s-1.18)?))'
status-context: 'ci/centos/mini-e2e/k8s-{k8s_version}'
# yamllint disable-line rule:line-length
trigger-phrase: '/(re)?test ((all)|(ci/centos/mini-e2e(/k8s-{k8s_version})?))'
permit-all: true
# TODO: set github-hooks to true when it is configured in GitHub
github-hooks: false

View File

@ -46,9 +46,9 @@ node('cico-workspace') {
// build e2e.test executable
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') {
ssh './single-node-k8s.sh --k8s-version=v1.18.3'
ssh './single-node-k8s.sh --k8s-version=v${k8s_version}'
}
}
stage('run e2e') {