mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-09 10:02:56 +01:00
Versions 1.11 and older are effectively dead, given the Go project maintains the last two minor point releases which are currently 1.13, and 1.14. Gitaly for now still supports 1.12, but will move on to at least 1.13 soon. Which is why 1.12 is still supported by this script.
224 lines
7.1 KiB
Bash
Executable file
224 lines
7.1 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
IFS=$'\n\t'
|
|
|
|
source scripts/build-helpers.sh
|
|
|
|
function print_golang_args() {
|
|
|
|
case "$1" in
|
|
1.12)
|
|
INSTALL_GOLANG_VERSION=1.12.13
|
|
GOLANG_DOWNLOAD_SHA256=da036454cb3353f9f507f0ceed4048feac611065e4e1818b434365eb32ac9bdc
|
|
;;
|
|
1.13)
|
|
INSTALL_GOLANG_VERSION=1.13.4
|
|
GOLANG_DOWNLOAD_SHA256=692d17071736f74be04a72a06dab9cac1cd759377bd85316e52b2227604c004c
|
|
;;
|
|
1.14)
|
|
INSTALL_GOLANG_VERSION=1.14.1
|
|
GOLANG_DOWNLOAD_SHA256=2f49eb17ce8b48c680cdb166ffd7389702c0dec6effa090c324804a5cac8a7f8
|
|
;;
|
|
*) 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 ;;
|
|
1.21) YARN_INSTALL_VERSION=1.21.1-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
|
|
;;
|
|
1.3.34)
|
|
GRAPHISMAGICK_VERSION=1.3.34
|
|
GRAPHISMAGICK_DOWNLOAD_SHA256=4717f7a32d964c515d83706fd52d34e089c2ffa35f8fbf43c923ce19343cf2f4
|
|
;;
|
|
*) 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() {
|
|
build_image_name=$1; shift;
|
|
|
|
printf -- "docker build "
|
|
echo $build_image_name | tr '-' '\n' | parse_arguments
|
|
|
|
for i in "$@"
|
|
do
|
|
printf -- "%s " "$i"
|
|
done
|
|
printf -- ".\\n"
|
|
}
|
|
|
|
function build_custom_if_needed() {
|
|
build_image_name=$1
|
|
full_image_name="$CI_REGISTRY_IMAGE:$build_image_name"
|
|
|
|
if [[ "$FORCE_BUILD" == "true" ]] || ! image_already_exists $full_image_name; then
|
|
docker_command=$(generate_command $@)
|
|
if [[ "$FORCE_BUILD" == "true" ]]; then
|
|
echo "Force building $build_image_name due to \$FORCE_BUILD=true with $docker_command"
|
|
else
|
|
echo "Building $build_image_name with $docker_command"
|
|
fi
|
|
eval $docker_command
|
|
else
|
|
echo "$build_image_name already exists, skipping build."
|
|
fi
|
|
}
|
|
|
|
build_custom_if_needed $@
|