Okay, solved at last.
In addition to the below stage, for your reference, I had to also add the
id_rsa and id_rsa.pub files to ~/.ssh. Then I had to do a git push manually
from the command line which then instructed me to trust the ssh key.
Following this, the script from the stage then worked.
The problem I am facing now is that it seems the "ci skip" plug-in is not
working. Despite the presence of "[ci skip]" in the commit message, the job
is being triggered in a loop (because the job makes a push to the master
branch, meaning a push webhook again triggers it...
stage ("Publish to npm") {
steps {
script {
STAGE_NAME = "Publish to npm"
if (BRANCH_NAME == "master") {
// Publish to npm and bump the version number for the
next release
sh "npm publish"
deleteDir()
sshagent (credentials: [
'e276113e-0ec9-4eaa-88f9-a7db5c9635b6']) {
sh '''
git clone git@****.git
cd ****
npm --no-git-tag-version version minor
git config --global user.name "****"
git config --global user.email ****
git commit -am 'Bumped version number [ci skip]'
git push origin master
'''
}
slackSend (
color: '#199515',
message: "$JOB_NAME: Build #$BUILD_NUMBER passed
successfully."
)
}
else {
echo "Not in 'master' branch. Don't attempt publishing."
}
}
}
}
}
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/5e4cd359-b0c1-4507-ab45-0a6df1ac5b66%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.