Skip to content

Instantly share code, notes, and snippets.

@thorntonrose
Created August 11, 2022 18:18
Show Gist options
  • Save thorntonrose/20f3fe496474bfa8f72069998d646faf to your computer and use it in GitHub Desktop.
Save thorntonrose/20f3fe496474bfa8f72069998d646faf to your computer and use it in GitHub Desktop.
Run Jenkins script remotely
COOKIE_JAR=/tmp/cookies
CRUMB=$(curl -s --cookie-jar $COOKIE_JAR -u $JENKINS_USER:$JENKINS_TOKEN $JENKINS_URL/crumbIssuer/api/json | \
jq -r .crumb)
curl -i --cookie $COOKIE_JAR -u $JENKINS_USER:$JENKINS_TOKEN \
-H "Jenkins-Crumb:${CRUMB}" -d "script=println 'foo'" \
$JENKINS_URL/scriptText \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment