gitlab-build-images/scripts/custom-docker-build
Pavlo Strokov 472516a180 Upgrade to Git 2.24
Git 2.24.1 has been released and it contains a bug fixes that unblock
https://gitlab.com/gitlab-org/gitlab/issues/27828, and means
that we can more easily ship a custom version of Git with
https://gitlab.com/chriscool's patch
https://gitlab.com/gitlab-org/git/issues/7

Part of: https://gitlab.com/gitlab-org/gitaly/issues/2170
2019-12-11 11:26:22 +00:00

210 lines
6.7 KiB
Bash
Executable file

#!/bin/sh
set -e
IFS=$'\n\t'
function print_golang_args() {
case "$1" in
1.9)
INSTALL_GOLANG_VERSION=1.9.4
GOLANG_DOWNLOAD_SHA256=15b0937615809f87321a457bb1265f946f9f6e736c563d6c5e0bd2c22e44f779
;;
1.10|1.10.0)
INSTALL_GOLANG_VERSION=1.10
GOLANG_DOWNLOAD_SHA256=b5a64335f1490277b585832d1f6c7f8c6c11206cba5cd3f771dcb87b98ad1a33
;;
1.11)
INSTALL_GOLANG_VERSION=1.11.10
GOLANG_DOWNLOAD_SHA256=aefaa228b68641e266d1f23f1d95dba33f17552ba132878b65bb798ffa37e6d0
;;
1.12)
INSTALL_GOLANG_VERSION=1.12.13
GOLANG_DOWNLOAD_SHA256=da036454cb3353f9f507f0ceed4048feac611065e4e1818b434365eb32ac9bdc
;;
1.13)
INSTALL_GOLANG_VERSION=1.13.4
GOLANG_DOWNLOAD_SHA256=692d17071736f74be04a72a06dab9cac1cd759377bd85316e52b2227604c004c
;;
*) echo "Unknown golang version $1"; exit 1;
esac
printf -- "--build-arg INSTALL_GOLANG_VERSION=%s " "$INSTALL_GOLANG_VERSION"
printf -- "--build-arg GOLANG_DOWNLOAD_SHA256=%s " "$GOLANG_DOWNLOAD_SHA256"
}
# If you add a new minor version here, be sure to check that the
# ChromeDriver supports this: https://sites.google.com/a/chromium.org/chromedriver/downloads
# You may need to bump the version in scripts/install-chrome.
function print_chrome_args() {
case "$1" in
69|69.0)
CHROME_VERSION=69.0.3497.81-1
CHROME_DRIVER_VERSION=2.41
;;
71|71.0)
CHROME_VERSION=71.0.3578.98-1
CHROME_DRIVER_VERSION=2.45
;;
73|73.0)
CHROME_VERSION=73.0.3683.103-1
CHROME_DRIVER_VERSION=73.0.3683.68
;;
74|74.0)
CHROME_VERSION=74.0.3729.169-1
CHROME_DRIVER_VERSION=74.0.3729.6
;;
*) echo "Unknown chrome version $1"; exit 1;
esac
printf -- "--build-arg CHROME_VERSION=%s " "$CHROME_VERSION"
printf -- "--build-arg CHROME_DRIVER_VERSION=%s " "$CHROME_DRIVER_VERSION"
}
# see https://www.kernel.org/pub/software/scm/git
function print_git_args() {
case "$1" in
2.18)
GIT_VERSION=2.18.0
GIT_DOWNLOAD_SHA256=94faf2c0b02a7920b0b46f4961d8e9cad08e81418614102898a55f980fa3e7e4
;;
2.21)
GIT_VERSION=2.21.0
GIT_DOWNLOAD_SHA256=85eca51c7404da75e353eba587f87fea9481ba41e162206a6f70ad8118147bee
;;
2.22)
GIT_VERSION=2.22.0
GIT_DOWNLOAD_SHA256=a4b7e4365bee43caa12a38d646d2c93743d755d1cea5eab448ffb40906c9da0b
;;
2.24)
GIT_VERSION=2.24.1
GIT_DOWNLOAD_SHA256=ad5334956301c86841eb1e5b1bb20884a6bad89a10a6762c958220c7cf64da02
;;
*) echo "Unknown git version $1"; exit 1;
esac
printf -- "--build-arg GIT_VERSION=%s " "$GIT_VERSION"
printf -- "--build-arg GIT_DOWNLOAD_SHA256=%s " "$GIT_DOWNLOAD_SHA256"
}
# see https://github.com/git-lfs/git-lfs/releases
function print_lfs_args() {
case "$1" in
2.9)
LFS_VERSION=2.9.1
LFS_DOWNLOAD_SHA256=2a8e60cf51ec45aa0f4332aa0521d60ec75c76e485d13ebaeea915b9d70ea466
;;
*) echo "Unknown Git LFS version $1"; exit 1;
esac
printf -- "--build-arg LFS_VERSION=%s " "$LFS_VERSION"
printf -- "--build-arg LFS_DOWNLOAD_SHA256=%s " "$LFS_DOWNLOAD_SHA256"
}
function print_node_args() {
case "$1" in
8.x) NODE_INSTALL_VERSION=8.16.0 ;;
10.x) NODE_INSTALL_VERSION=10.16.0 ;;
12.x) NODE_INSTALL_VERSION=12.4.0 ;;
*) echo "Unknown node version $1"; exit 1;
esac
printf -- "--build-arg NODE_INSTALL_VERSION=%s " "$NODE_INSTALL_VERSION"
}
function print_yarn_args() {
case "$1" in
1.12) YARN_INSTALL_VERSION=1.12.3-1 ;;
1.16) YARN_INSTALL_VERSION=1.16.0-1 ;;
*) echo "Unknown yarn version $1"; exit 1;
esac
printf -- "--build-arg YARN_INSTALL_VERSION=%s " "$YARN_INSTALL_VERSION"
}
function print_postgres_args() {
printf -- "--build-arg POSTGRES_VERSION=%s " "$1"
}
function print_ansible_args() {
printf -- "--build-arg ANSIBLE_VERSION=%s " "$1"
}
function print_docker_args() {
printf -- "--build-arg DOCKER_VERSION=%s " "$1"
}
function print_terraform_args() {
case "$1" in
0.11)
TERRAFORM_VERSION=0.11.7
TERRAFORM_DOWNLOAD_SHA256=6b8ce67647a59b2a3f70199c304abca0ddec0e49fd060944c26f666298e23418
;;
*) echo "Unknown terraform version $1"; exit 1;
esac
printf -- "--build-arg TERRAFORM_VERSION=%s " "$TERRAFORM_VERSION"
printf -- "--build-arg TERRAFORM_DOWNLOAD_SHA256=%s " "$TERRAFORM_DOWNLOAD_SHA256"
}
function print_graphicsmagick_args() {
case "$1" in
1.3.29)
GRAPHISMAGICK_VERSION=1.3.29
GRAPHISMAGICK_DOWNLOAD_SHA256=de820cd10597205941a7e9d02c2e679231e92e8e769c204ef09034d2279ad453
;;
1.3.33)
GRAPHISMAGICK_VERSION=1.3.33
GRAPHISMAGICK_DOWNLOAD_SHA256=00ea0df7c78c903cce325f402429bcd3924168cf39277f743a0641d47c411ee8
;;
*) echo "Unknown graphicsmagick version $1"; exit 1;
esac
printf -- "--build-arg GRAPHISMAGICK_VERSION=%s " "$GRAPHISMAGICK_VERSION"
printf -- "--build-arg GRAPHISMAGICK_DOWNLOAD_SHA256=%s " "$GRAPHISMAGICK_DOWNLOAD_SHA256"
}
function parse_arguments() {
read base
read base_version
# Lock Ruby to Debian stretch
case "$base" in
ruby) base_version="$base_version-stretch" ;;
esac
printf -- "-f Dockerfile.custom " "$base"
printf -- "--build-arg CUSTOM_IMAGE_NAME=%s " "$base"
printf -- "--build-arg CUSTOM_IMAGE_VERSION=%s " "$base_version"
while read image; do
read version
case "$image" in
golang) print_golang_args $version ;;
chrome) print_chrome_args $version ;;
docker) print_docker_args $version ;;
git) print_git_args $version ;;
lfs) print_lfs_args $version ;;
node) print_node_args $version ;;
yarn) print_yarn_args $version ;;
postgresql) print_postgres_args $version ;;
ansible) print_ansible_args $version ;;
terraform) print_terraform_args $version ;;
graphicsmagick) print_graphicsmagick_args $version ;;
*) exit 1;;
esac
done
}
function generate_command() {
buildimage_name=$1; shift;
printf -- "docker build "
echo $buildimage_name | tr '-' '\n' | parse_arguments
for i in "$@"
do
printf -- "%s " "$i"
done
printf -- ".\\n"
}
docker_command=$(generate_command $@)
echo "$1: executing $docker_command"
eval $docker_command