From 3418d401589d44c1dc6f0de4bad3fd6a40ed29a7 Mon Sep 17 00:00:00 2001 From: "Ramanathan.M" Date: Thu, 27 Feb 2020 21:12:08 +0530 Subject: [PATCH] build: Enclose source dir for script execution 1. For the git clone operation, 'sh' step in a single line would suffice. 2. Provide directory context using 'dir', this avoids having to provide the path to the scripts twice, while executing each and every script in that folder. Signed-off-by: Ramanathan Muthaiah --- Jenkinsfiles/release_pieline/Jenkinsfile | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Jenkinsfiles/release_pieline/Jenkinsfile b/Jenkinsfiles/release_pieline/Jenkinsfile index 7032efb21..2efec5b49 100644 --- a/Jenkinsfiles/release_pieline/Jenkinsfile +++ b/Jenkinsfiles/release_pieline/Jenkinsfile @@ -25,16 +25,14 @@ pipeline { stage('Bump repos') { agent { label 'ubuntu-lts-latest-azure' } steps { - sh ''' - git clone https://github.com/kata-containers/packaging.git - cd packaging - ''' + sh 'git clone https://github.com/kata-containers/packaging.git' withCredentials([string(credentialsId: 'katabuilder-git-bump', variable: 'GITHUB_TOKEN')]) { - sh ''' - cd packaging - ./Jenkinsfiles/release_pieline/git_credential_cache.sh - ./Jenkinsfiles/release_pieline/bump.sh "${NEW_VERSION}" "${BRANCH}" - ''' + dir("${WORKSPACE}/packaging/Jenkinsfiles/release_pipeline/") { + sh ''' + ./git_credential_cache.sh + ./bump.sh "${NEW_VERSION}" "${BRANCH}" + ''' + } } } }