blob: 07e3b1f235e248e21a5536152b4efb6baa09ba4a [file] [log] [blame]
Carlos Sanchezc47ac482016-12-01 18:58:46 +01001#!/bin/bash -eu
2
3# Generate the Docker official-images file
4
5sha() {
6 local branch=$1
7 git rev-parse $branch
8}
9
10version_from_dockerfile() {
11 local branch=$1
12 git show $branch:Dockerfile | grep JENKINS_VERSION: | sed -e 's/.*:-\(.*\)}/\1/'
13}
14
15master_sha=$(sha master)
16alpine_sha=$(sha alpine)
17
18master_version=$(version_from_dockerfile master)
19alpine_version=$(version_from_dockerfile alpine)
20
21if ! [ "$master_version" == "$alpine_version" ]; then
22 echo "Master version '$master_version' does not match alpine version '$alpine_version'"
23 exit 1
24fi
25
26cat << EOF > ../official-images/library/jenkins
27# maintainer: Nicolas De Loof <nicolas.deloof@gmail.com> (@ndeloof)
28# maintainer: Michael Neale <mneale@cloudbees.com> (@michaelneale)
29# maintainer: Carlos Sanchez <csanchez@cloudbees.com> (@carlossg)
30
31latest: git://github.com/jenkinsci/jenkins-ci.org-docker@$master_sha
32$master_version: git://github.com/jenkinsci/jenkins-ci.org-docker@$master_sha
33
34alpine: git://github.com/jenkinsci/jenkins-ci.org-docker@$alpine_sha
35$alpine_version-alpine: git://github.com/jenkinsci/jenkins-ci.org-docker@$alpine_sha
36EOF