diff --git a/.ci/jenkins/Jenkinsfile.e2e.cluster b/.ci/jenkins/Jenkinsfile.e2e.cluster index 9a73791b0..33edf7531 100644 --- a/.ci/jenkins/Jenkinsfile.e2e.cluster +++ b/.ci/jenkins/Jenkinsfile.e2e.cluster @@ -5,6 +5,8 @@ helper = null kindClusterPlatform = 'kind' openshiftClusterPlatform = 'openshift' +kindLogsFolder = "/tmp/kind-logs" + pipeline { agent { docker { @@ -108,6 +110,7 @@ pipeline { make test-e2e """ } catch (err) { + kind.exportLogs("/tmp/kind-logs") sh 'make undeploy' throw err } @@ -118,6 +121,11 @@ pipeline { } } post { + always { + script { + archiveArtifacts(artifacts: "**/tmp/kind-logs/") + } + } cleanup { script { clean() diff --git a/.ci/jenkins/scripts/kind.groovy b/.ci/jenkins/scripts/kind.groovy index c12ae658a..a255b2b1f 100644 --- a/.ci/jenkins/scripts/kind.groovy +++ b/.ci/jenkins/scripts/kind.groovy @@ -40,13 +40,13 @@ void start(boolean debug = false) { void waitUntilKubeSystemPodsAreStarted() { println 'Wait for kube system pods to be in Running state' - def kindStatus = sh(returnStatus: true, script: ''' + def kindStatus = sh(returnStatus: true, script: """ if ! kubectl wait -n kube-system --for=condition=ready pods --all --timeout=120s ; then echo "some pods in the system are not running" kubectl get pods -A -o wide || true exit 1 fi - ''') + """) if (kindStatus != 0) { error 'Error starting Kind ...' @@ -55,12 +55,12 @@ void waitUntilKubeSystemPodsAreStarted() { void createRegistryContainer() { println 'Create container registry container' - def containerRegistryStatus = sh(returnStatus: true, script: ''' + def containerRegistryStatus = sh(returnStatus: true, script: """ docker run \ -d --restart=always -p "127.0.0.1:${kindRegistryPort}:5000" --network bridge --name "${kindRegistryName}" \ -v /tmp/certs:/certs \ registry:2 - ''') + """) if (containerRegistryStatus != 0) { error 'Error while creating registry container ...' @@ -69,11 +69,11 @@ void createRegistryContainer() { void connectRegistryContainerToClusterNetwork() { println 'Connect registry container to cluster network' - def containerRegistryConnectionStatus = sh(returnStatus: true, script: ''' + def containerRegistryConnectionStatus = sh(returnStatus: true, script: """ if [ "$(docker inspect -f='{{json .NetworkSettings.Networks.kind}}' "${kindRegistryName}")" = 'null' ]; then docker network connect "kind" "${kindRegistryName}" fi - ''') + """) if (containerRegistryConnectionStatus != 0) { error 'Error while connecting registry container to the cluster ...' @@ -82,7 +82,7 @@ void connectRegistryContainerToClusterNetwork() { void addRegistryConfigToTheClusterNodes() { println 'Add registry config to cluster nodes' - def addRegistryConfigStatus = sh(returnStatus: true, script: ''' + def addRegistryConfigStatus = sh(returnStatus: true, script: """ export REGISTRY_DIR="/etc/containerd/certs.d/172.18.0.3:5000" export IP_ADDRESS=$(docker inspect --format='{{(index (index .NetworkSettings.Networks "kind") ).IPAddress}}' ${kindRegistryName}) @@ -94,7 +94,7 @@ void addRegistryConfigToTheClusterNodes() { skip_verify = true EOF done - ''') + """) if (addRegistryConfigStatus != 0) { error 'Error while adding registry config to the cluster nodes ...' @@ -103,7 +103,7 @@ void addRegistryConfigToTheClusterNodes() { void documentLocalRegistry() { println 'Document created local registry' - def documentLocalRegistryStatus = sh(returnStatus: true, script: ''' + def documentLocalRegistryStatus = sh(returnStatus: true, script: """ cat <