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 <rus.cahimb@gmail.com>
This commit is contained in:
Ramanathan.M 2020-02-27 21:12:08 +05:30
parent 9a37ebec66
commit 3418d40158

View File

@ -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}"
'''
}
}
}
}