update-official-library.sh 1.1 KB

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