From 77875939a3572358c2a496bed96f8186769e59b0 Mon Sep 17 00:00:00 2001 From: Artem Nikitin Date: Thu, 25 Jul 2019 16:22:25 +0200 Subject: [PATCH] Don't run E2E tests if change was in docs only (#1368) * Update Jenkinsfile * Update Jenkinsfile * Update Jenkinsfile --- build/ci/e2e/Jenkinsfile | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/build/ci/e2e/Jenkinsfile b/build/ci/e2e/Jenkinsfile index c92fc5aeea..ea4850b9cc 100644 --- a/build/ci/e2e/Jenkinsfile +++ b/build/ci/e2e/Jenkinsfile @@ -24,9 +24,25 @@ pipeline { checkout scm } } - stage("Run E2E tests") { - steps { - sh 'make -C build/ci ci-e2e' + stage("E2E tests") { + when { + expression { + notOnlyDocs() + } + } + stages { + stage('Run E2E tests') { + steps { + sh 'make -C build/ci ci-e2e' + } + } + stage('Cleanup GKE') { + steps { + build job: 'cloud-on-k8s-e2e-cleanup', + parameters: [string(name: 'GKE_CLUSTER', value: "${GKE_CLUSTER_NAME}")], + wait: false + } + } } } } @@ -43,12 +59,16 @@ pipeline { } } cleanup { - build job: 'cloud-on-k8s-e2e-cleanup', - parameters: [string(name: 'GKE_CLUSTER', value: "${GKE_CLUSTER_NAME}")], - wait: false - cleanWs() } } } + +def notOnlyDocs() { + // grep succeeds if there is at least one line without docs/ + return sh ( + script: "git diff --name-status HEAD~1 HEAD | grep -v docs/", + returnStatus: true + ) == 0 +}