blob: da3efffbaf63b96f50843307918aad451f88f6ba [file] [log] [blame]
Nicolas De Loof108666f2015-09-29 10:19:56 +02001#!/bin/bash
2
Nicolas De loof1a727f92016-04-21 17:25:19 +02003set -e
4set -x
5
Eli Young52fa1d72016-10-06 12:00:47 -07006JENKINS_VERSION=$(curl -sq https://api.github.com/repos/jenkinsci/jenkins/tags | grep '"name":' | egrep -o '[0-9]+(\.[0-9]+)+' | sort --version-sort | uniq | tail -1)
Charles Duffy3eec42c2016-09-20 12:11:33 -05007echo "$JENKINS_VERSION"
Nicolas De Loof108666f2015-09-29 10:19:56 +02008
Charles Duffy3eec42c2016-09-20 12:11:33 -05009JENKINS_SHA=$(curl "http://repo.jenkins-ci.org/simple/releases/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war.sha1")
10echo "$JENKINS_SHA"
Nicolas De Loof108666f2015-09-29 10:19:56 +020011
Charles Duffy3eec42c2016-09-20 12:11:33 -050012docker build --build-arg "JENKINS_VERSION=$JENKINS_VERSION" \
13 --build-arg "JENKINS_SHA=$JENKINS_SHA" \
Carlos Sanchez0540f312016-06-14 15:42:47 +020014 --no-cache --pull \
Charles Duffy3eec42c2016-09-20 12:11:33 -050015 --tag "jenkinsci/jenkins:$JENKINS_VERSION" .
Nicolas De Loof108666f2015-09-29 10:19:56 +020016
Charles Duffy3eec42c2016-09-20 12:11:33 -050017docker tag -f "jenkinsci/jenkins:$JENKINS_VERSION" jenkinsci/jenkins:latest
Nicolas De Loofc22225f2016-05-28 17:34:29 +020018
Charles Duffy3eec42c2016-09-20 12:11:33 -050019docker push "jenkinsci/jenkins:$JENKINS_VERSION"
Nicolas De Loof108666f2015-09-29 10:19:56 +020020docker push jenkinsci/jenkins:latest
21
22