From dd10e66a989c233d716d4ce5b6e5018bc57792e7 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Wed, 18 Nov 2020 08:52:18 +0100 Subject: [PATCH] ci: move podman2minikube() into its own script This way, it can easier be re-used for other container images. Signed-off-by: Niels de Vos --- k8s-e2e-external-storage.groovy | 2 +- mini-e2e-helm.groovy | 2 +- mini-e2e.groovy | 2 +- podman2minikube.sh | 15 +++++++++++++++ single-node-k8s.sh | 13 +------------ upgrade-tests.groovy | 2 +- 6 files changed, 20 insertions(+), 16 deletions(-) create mode 100755 podman2minikube.sh diff --git a/k8s-e2e-external-storage.groovy b/k8s-e2e-external-storage.groovy index 18e81d647..46e68b83c 100644 --- a/k8s-e2e-external-storage.groovy +++ b/k8s-e2e-external-storage.groovy @@ -92,7 +92,7 @@ node('cico-workspace') { if (params.ghprbPullId != null) { ref = "pull/${ghprbPullId}/head" } - sh 'scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ./prepare.sh ./single-node-k8s.sh ./run-k8s-external-storage-e2e.sh root@${CICO_NODE}:' + sh 'scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ./prepare.sh ./single-node-k8s.sh podman2minikube.sh ./run-k8s-external-storage-e2e.sh root@${CICO_NODE}:' ssh "./prepare.sh --workdir=/opt/build/go/src/github.com/ceph/ceph-csi --gitrepo=${git_repo} --ref=${ref}" } stage('build artifacts') { diff --git a/mini-e2e-helm.groovy b/mini-e2e-helm.groovy index 360af1a3f..f807eb8b0 100644 --- a/mini-e2e-helm.groovy +++ b/mini-e2e-helm.groovy @@ -103,7 +103,7 @@ node('cico-workspace') { if (params.ghprbPullId != null) { ref = "pull/${ghprbPullId}/merge" } - sh 'scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ./prepare.sh ./single-node-k8s.sh root@${CICO_NODE}:' + sh 'scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ./prepare.sh ./single-node-k8s.sh ./podman2minikube.sh root@${CICO_NODE}:' ssh "./prepare.sh --workdir=/opt/build/go/src/github.com/ceph/ceph-csi --gitrepo=${git_repo} --ref=${ref}" } stage('pull base container images') { diff --git a/mini-e2e.groovy b/mini-e2e.groovy index 2b93046fd..dc4c06e7e 100644 --- a/mini-e2e.groovy +++ b/mini-e2e.groovy @@ -100,7 +100,7 @@ node('cico-workspace') { if (params.ghprbPullId != null) { ref = "pull/${ghprbPullId}/merge" } - sh 'scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ./prepare.sh ./single-node-k8s.sh root@${CICO_NODE}:' + sh 'scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ./prepare.sh ./single-node-k8s.sh ./podman2minikube.sh root@${CICO_NODE}:' ssh "./prepare.sh --workdir=/opt/build/go/src/github.com/ceph/ceph-csi --gitrepo=${git_repo} --ref=${ref}" } stage('pull base container images') { diff --git a/podman2minikube.sh b/podman2minikube.sh new file mode 100755 index 000000000..6261438d8 --- /dev/null +++ b/podman2minikube.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# +# When an image was built with podman, it needs importing into minikube. +# + +# fail when a command returns an error +set -e -o pipefail + +# "minikube ssh" fails to read the image, so use standard ssh instead +podman image save "${1}" | \ + ssh \ + -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \ + -l docker -i "$(minikube ssh-key)" \ + "$(minikube ip)" docker image load + diff --git a/single-node-k8s.sh b/single-node-k8s.sh index 4a3db6550..184ce9549 100755 --- a/single-node-k8s.sh +++ b/single-node-k8s.sh @@ -121,24 +121,13 @@ function deploy_rook() ${GOPATH}/src/github.com/ceph/ceph-csi/scripts/install-snapshot.sh install } -# When an image was built with podman, it needs importing into minikube. -function podman2minikube() -{ - # "minikube ssh" fails to read the image, so use standard ssh instead - podman image save "${1}" | \ - ssh \ - -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \ - -l docker -i "$(minikube ssh-key)" \ - "$(minikube ip)" docker image load -} - # Set environment variables set_env # prepare minikube environment install_minikube -podman2minikube "quay.io/cephcsi/cephcsi:${CSI_IMAGE_VERSION}" +./podman2minikube.sh "quay.io/cephcsi/cephcsi:${CSI_IMAGE_VERSION}" deploy_rook diff --git a/upgrade-tests.groovy b/upgrade-tests.groovy index 0a7fc0e7b..400397dbb 100644 --- a/upgrade-tests.groovy +++ b/upgrade-tests.groovy @@ -100,7 +100,7 @@ node('cico-workspace') { if (params.ghprbPullId != null) { ref = "pull/${ghprbPullId}/merge" } - sh 'scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ./prepare.sh ./single-node-k8s.sh root@${CICO_NODE}:' + sh 'scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ./prepare.sh ./single-node-k8s.sh ./podman2minikube.sh root@${CICO_NODE}:' ssh "./prepare.sh --workdir=/opt/build/go/src/github.com/ceph/ceph-csi --gitrepo=${git_repo} --ref=${ref}" } stage('pull base container images') {