Reputation: 16822
I'm trying to write a script that creates a Docker image from a Jenkins image, that is, the first line of my Dockerfile is...
FROM jenkins/jenkins:2.249.3
However I wanna be smart and write a script that gets the latest Jenkins stable version and sed that into my Dockerfile, like this
Dockerfile:
FROM jenkins/jenkins:JENKINS_LATEST_STABLE_VER
$ export JENKINS_LATEST_STABLE_VER=`some_api_call`
$ sed -i "s/JENKINS_LATEST_STABLE_VER/$JENKINS_LATEST_STABLE_VER/g" Dockerfile
$ docker build ...
What is "some_api_call"?
Upvotes: 0
Views: 1042
Reputation: 2263
latest stable:
curl -L --max-redirs 2 https://updates.jenkins.io/stable/latestCore.txt
latest current:
curl -L --max-redirs 2 https://updates.jenkins.io/current/latestCore.txt
Upvotes: 2
Reputation: 7427
Building off of Ian's comment
https://updates.jenkins.io/current/latestCore.txt
https://updates.jenkins.io/stable/latestCore.txt
is one way to get the latest version, but read through the document in that comment.
I also found this answer which agrees
Jenkins - get latest artifact with curl
Upvotes: 0