Jenkins absolute groovy noob pipeline here, I have a stage
stage('Building and Deploying'){ def build = new Build() build.deploy() }
which uses a shared lib, the source of Build.groovy
is here:
def deploy(branch='master', repo='xxx'){ if (env.BRANCH_NAME.trim() == branch) { def script = libraryResource 'build/package_indexes/python/build_push.sh' // TODO: Test out http://stackoverflow.com/questions/40965725/jenkins-pipeline-cps-global-lib-resource-file-for-shell-script-purpose/40994132#40994132 env.PYPI_REPO = repo sh script }else { echo "Not pushing to repo because branch is: "+env.BRANCH_NAME.trim()+" and not "+branch } }
The problem is that if it is impossible to push the assembly to the remote repo (see below), the stage still ends successfully.
running upload Submitting dist/xxx-0.0.7.tar.gz to https://xxx.jfrog.io/xxx/api/pypi/grabone-pypi-local Upload failed (403): Forbidden ... Finished: SUCCESS
How can I release the shell exit code and crash?
source share