jenkinsjenkins-api

How can I use the Jenkins REST API with a JENKINS_SERVER_COOKIE?


My goal is to ask questions of the Jenkins server within a Jenkins-run script (specifically when it's run on a remote agent). I'd like to use a Perl or Python script with the REST API. I'd like to ask data known by the Jenkins server.

In my specific case, I'd like a build-display-name of a most-recent successful build of a different project. I'd like to do this without username/password credentials. I'd expect to be able to use the environment variable JENKINS_SERVER_COOKIE as a credential as a cookie or header as I use the Jenkins REST API for GET-based requests.

Is that possible? If not, what is the environment variable JENKINS_SERVER_COOKIE used for?

Thanks!


Solution

  • JENKINS_SERVER_COOKIE is not used for anything related to the REST API; best to ignore it.

    What you request is not currently possible.