I have an deployment task that is executed on my test machine. The purpose is to test the freshly build rpm from jenkins on the very same machine.
Therefore I set up a deploy job in jenkins that executes the following shell lines:
artifact=$(ls build/*.rpm | head -1)
sudo /usr/local/sbin/jenkins-rpm-install $artifact
rm -rf build/
# allows jenkins to install rpm as privileged user
# add the following line to /etc/sudoers:
# jenkins ALL = NOPASSWD: /usr/local/sbin/jenkins-rpm-install
rpm -vv --install --force $artifact
What about simply checking for rpm error's code in your script and report it to Jenkins yourself?
rpm -vv --install --force $artifact error_code=$? if [[ err_code > 0 ]]; then exit $?; fi
Or with overload:
rpm -vv --install --force $artifact || exit $?