Jenkins API to get system variable?

Viewed 19

I set a system message in our Jenkins application that is shown on all the pages that tells folks what the staging and production branches are.

<h3>
  Jenkins v2.263.1
</h3>
<h4>
<ul>
  <li>Production branch: release/3.2.1/li>
  <li>Staging branch: release/3.4.0</li>
</ul>
</h4>

However, I manually have to set these in the system configuration page every time we update the branches. I do store these values in global variables in the system configuration page, so

production_branch = release/3.2.1
staging_branch = release/3.4.0

Can I use a Jenkins API to get these values so they are set automatically when the variables are updated, which I do via pipeline job? Something like (pseudo html)

<h3>
  Jenkins v2.263.1
</h3>
<h4>
<ul>
  <li>Production branch: curl https://myjenkins.company.com/.../request_uri$production_branch</li>
  <li>Staging branch: curl https://myjenkins.company.com/.../request_uri$staging_branch</li>
</ul>
</h4>

Note that I'm also exploring the ideas in Way to remotely update Jenkins "System Message" string?

0 Answers
Related