Carlos Sanchez | c47ac48 | 2016-12-01 18:58:46 +0100 | [diff] [blame] | 1 | #!/bin/bash -eu |
| 2 | |
| 3 | # Generate the Docker official-images file |
| 4 | |
| 5 | sha() { |
| 6 | local branch=$1 |
| 7 | git rev-parse $branch |
| 8 | } |
| 9 | |
| 10 | version_from_dockerfile() { |
| 11 | local branch=$1 |
| 12 | git show $branch:Dockerfile | grep JENKINS_VERSION: | sed -e 's/.*:-\(.*\)}/\1/' |
| 13 | } |
| 14 | |
| 15 | master_sha=$(sha master) |
| 16 | alpine_sha=$(sha alpine) |
| 17 | |
| 18 | master_version=$(version_from_dockerfile master) |
| 19 | alpine_version=$(version_from_dockerfile alpine) |
| 20 | |
| 21 | if ! [ "$master_version" == "$alpine_version" ]; then |
| 22 | echo "Master version '$master_version' does not match alpine version '$alpine_version'" |
| 23 | exit 1 |
| 24 | fi |
| 25 | |
| 26 | cat << 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 | |
| 31 | latest: git://github.com/jenkinsci/jenkins-ci.org-docker@$master_sha |
| 32 | $master_version: git://github.com/jenkinsci/jenkins-ci.org-docker@$master_sha |
| 33 | |
| 34 | alpine: git://github.com/jenkinsci/jenkins-ci.org-docker@$alpine_sha |
| 35 | $alpine_version-alpine: git://github.com/jenkinsci/jenkins-ci.org-docker@$alpine_sha |
| 36 | EOF |