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.
@@ -25,18 +25,16 @@ 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')]) {
+ dir("${WORKSPACE}/packaging/Jenkinsfiles/release_pipeline/") {
sh '''
- cd packaging
- ./Jenkinsfiles/release_pieline/git_credential_cache.sh
- ./Jenkinsfiles/release_pieline/bump.sh "${NEW_VERSION}" "${BRANCH}"
+ ./git_credential_cache.sh
+ ./bump.sh "${NEW_VERSION}" "${BRANCH}"
'''
}
}
}
}
}
+}
