mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-09 18:12:55 +01:00
Gitaly project plans to use PgBouncer for Praefect service https://gitlab.com/gitlab-org/gitaly/-/issues/2816 We want to have an image for CI so we can test interaction of Praefect with PostgreSQL database if PgBouncer sits in between. Installation script added with 1.14.0 version of PgBouncer (latest). Related to: https://gitlab.com/gitlab-org/gitaly/-/issues/2816
258 lines
8.3 KiB
Bash
Executable file
258 lines
8.3 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
|
|
;;
|
|
81|81.0)
|
|
CHROME_VERSION=81.0.4044.129-1
|
|
CHROME_DRIVER_VERSION=81.0.4044.69
|
|
;;
|
|
83|83.0)
|
|
CHROME_VERSION=83.0.4103.61-1
|
|
CHROME_DRIVER_VERSION=83.0.4103.39
|
|
;;
|
|
*) 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.3
|
|
GIT_DOWNLOAD_SHA256=ef6d1d1de1d7921a54d23d07479bd2766f050d6435cea5d3b5322aa4897cb3d7
|
|
;;
|
|
2.25)
|
|
GIT_VERSION=2.25.4
|
|
GIT_DOWNLOAD_SHA256=1b11d0ee481c6735e9f7d81a3576ef0989bde7843cb4adcdef578c0593d279ab
|
|
;;
|
|
2.26)
|
|
GIT_VERSION=2.26.2
|
|
GIT_DOWNLOAD_SHA256=e1c17777528f55696815ef33587b1d20f5eec246669f3b839d15dbfffad9c121
|
|
;;
|
|
2.27)
|
|
GIT_VERSION=2.27.0
|
|
GIT_DOWNLOAD_SHA256=77ded85cbe42b1ffdc2578b460a1ef5d23bcbc6683eabcafbb0d394dffe2e787
|
|
;;
|
|
*) 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 print_pgbouncer_args() {
|
|
case "$1" in
|
|
1.14)
|
|
PGBOUNCER_VERSION=1.14.0
|
|
PGBOUNCER_DOWNLOAD_SHA256=a0c13d10148f557e36ff7ed31793abb7a49e1f8b09aa2d4695d1c28fa101fee7
|
|
;;
|
|
*) echo "Unknown pgbouncer version $1"; exit 1;
|
|
esac
|
|
|
|
printf -- "--build-arg PGBOUNCER_VERSION=%s " "$PGBOUNCER_VERSION"
|
|
printf -- "--build-arg PGBOUNCER_DOWNLOAD_SHA256=%s " "$PGBOUNCER_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 ;;
|
|
pgbouncer) print_pgbouncer_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 $@
|