Update to Debian bullseye

bullseye is the latest stable, and this is what we will be using for
Cloud Native GitLab going forward so we should test with this.

Since an upgrade of the operating system may break pre-compiled C
extensions, we now introduce a DEBIAN environment flag that defaults
to the legacy buster install but allows us to roll out a bullseye
image with `debian-bullseye` as the image name prefix.
This commit is contained in:
Stan Hu 2022-02-09 08:29:08 -08:00
parent cc18fe8b5b
commit 9d6dd5061a
No known key found for this signature in database
GPG key ID: 8D3931AD39CC7A20
10 changed files with 50 additions and 15 deletions

View file

@ -2,7 +2,8 @@
.gitaly-matrix:
parallel:
matrix:
- RUBY: ['2.7', '3.0']
- DEBIAN: ['bullseye']
RUBY: ['2.7', '3.0']
GOLANG: ['1.16', '1.17']
GIT: ['2.31', '2.33']
PGBOUNCER: ['1.14', '']

View file

@ -8,7 +8,8 @@
GRAPHICSMAGICK: '1.3.36'
parallel:
matrix:
- RUBY: ['2.7.patched', '3.0.patched']
- DEBIAN: ['bullseye']
RUBY: ['2.7.patched', '3.0.patched']
GIT: ['2.33']
POSTGRESQL: ['11', '12', '13']
GOLANG: ['1.16', '1.17']

View file

@ -54,8 +54,9 @@ RUN if [ -n "$LFS_VERSION" ]; then /scripts/install-lfs && git lfs --version; fi
# Postgres
ARG POSTGRES_VERSION
ARG DEBIAN_VERSION
RUN if [ -n "$POSTGRES_VERSION" ] ; then /scripts/install-postgresql $POSTGRES_VERSION; fi
RUN if [ -n "$POSTGRES_VERSION" ] ; then /scripts/install-postgresql $POSTGRES_VERSION $DEBIAN_VERSION; fi
# GraphicsMagick
ARG GRAPHISMAGICK_VERSION
@ -66,8 +67,9 @@ RUN if [ -n "$GRAPHISMAGICK_VERSION" ]; then /scripts/install-graphicsmagick &&
# Docker
ARG DOCKER_VERSION
ARG DEBIAN_VERSION
RUN if [ -n "$DOCKER_VERSION" ]; then /scripts/install-docker $DOCKER_VERSION; fi
RUN if [ -n "$DOCKER_VERSION" ]; then /scripts/install-docker $DOCKER_VERSION $DEBIAN_VERSION; fi
# PgBouncer
ARG PGBOUNCER_VERSION
@ -98,4 +100,5 @@ ENV RUBY_VERSION=${RUBY_VERSION} \
GRAPHISMAGICK_VERSION=${GRAPHISMAGICK_VERSION} \
DOCKER_VERSION=${DOCKER_VERSION} \
PGBOUNCER_VERSION=${PGBOUNCER_VERSION} \
BAZELISK_VERSION=${BAZELISK_VERSION}
BAZELISK_VERSION=${BAZELISK_VERSION} \
DEBIAN_VERSION=${DEBIAN_VERSION}

View file

@ -249,6 +249,7 @@ function parse_arguments() {
if [ -n "${!tool}" ]; then
version="${!tool}"
case "$tool" in
DEBIAN) CUSTOM_IMAGE_VERSION=$version ;;
RUBY) print_ruby_args $version ;;
GOLANG) print_golang_args $version ;;
CHROME) print_chrome_args $version ;;
@ -268,6 +269,7 @@ function parse_arguments() {
printf -- "--build-arg CUSTOM_IMAGE_NAME=%s " "$CUSTOM_IMAGE_NAME"
printf -- "--build-arg CUSTOM_IMAGE_VERSION=%s " "$CUSTOM_IMAGE_VERSION"
printf -- "--build-arg DEBIAN_VERSION=%s " "$CUSTOM_IMAGE_VERSION"
}
function generate_command() {

View file

@ -5,6 +5,7 @@ set -xeuo pipefail
export DEBIAN_FRONTEND=noninteractive
DOCKER_VERSION=${1}
DEBIAN_VERSION=${2:-buster}
apt-get update
apt-get -y install \
@ -16,7 +17,7 @@ apt-get -y install \
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
echo "deb [arch=amd64] https://download.docker.com/linux/debian stretch stable" >> /etc/apt/sources.list.d/docker.list
echo "deb [arch=amd64] https://download.docker.com/linux/debian ${DEBIAN_VERSION} stable" >> /etc/apt/sources.list.d/docker.list
apt-get update
PACKAGE_VERSION=$(apt-cache policy docker-ce | awk -v dv=${DOCKER_VERSION}~ '$1 ~ dv {print $1}')

View file

@ -10,9 +10,7 @@ apt-get update
# We install `git-core` as some tooling expect `/usr/bin/git`
# other tools that rely on PATH ordering will pick a one in `/usr/local`
# if present
if grep "Debian GNU/Linux 9" /etc/issue
then
function install_debian_stretch_deps() {
apt-get install -y \
curl wget build-essential apt-utils locales openssh-client \
libssl-dev libyaml-dev libreadline6-dev zlib1g-dev \
@ -23,7 +21,9 @@ then
libkrb5-dev postgresql-client mysql-client unzip \
libsqlite3-dev libpq-dev libpng-dev libjpeg-dev libzstd-dev \
libre2-dev libevent-dev gettext rsync git-core
else
}
function install_debian_buster_deps() {
apt-get install -y \
curl wget build-essential apt-utils locales openssh-client \
libssl-dev libyaml-dev libreadline-dev zlib1g-dev \
@ -33,7 +33,33 @@ else
libkrb5-dev postgresql-client unzip \
libsqlite3-dev libpq-dev libpng-dev libjpeg-dev libzstd-dev \
libre2-dev libevent-dev gettext rsync git-core
fi
}
function install_debian_bullseye_deps() {
apt-get install -y \
curl wget build-essential apt-utils locales openssh-client \
libssl-dev libyaml-dev libreadline-dev zlib1g-dev \
libncurses5-dev libffi-dev ca-certificates libxml2-dev \
libxslt1-dev libcurl4-openssl-dev libicu-dev \
logrotate python3-docutils pkg-config cmake \
libkrb5-dev postgresql-client unzip \
libsqlite3-dev libpq-dev libpng-dev libjpeg-dev libzstd-dev \
libre2-dev libevent-dev gettext rsync git-core
}
VERSION=`cat /etc/issue | cut -d ' ' -f 3`
case "$VERSION" in
9)
install_debian_stretch_deps
;;
10)
install_debian_buster_deps
;;
11)
install_debian_bullseye_deps
;;
esac
# Set UTF-8
# http://stackoverflow.com/a/3182519/2137281

View file

@ -13,7 +13,7 @@ curl -sS -L https://deb.nodesource.com/setup_${NODE_MAJOR} | bash -
apt-get update
NODE_FILE_NAME="nodejs_$NODE_INSTALL_VERSION-1nodesource1_amd64.deb"
NODE_FILE_NAME="nodejs_$NODE_INSTALL_VERSION-deb-1nodesource1_amd64.deb"
curl -s -O "https://deb.nodesource.com/node_$NODE_MAJOR/pool/main/n/nodejs/$NODE_FILE_NAME"
dpkg -i "$NODE_FILE_NAME"
rm -f "$NODE_FILE_NAME"

View file

@ -3,10 +3,11 @@ set -xeuo pipefail
IFS=$'\n\t'
POSTGRES_VERSION=${1:-12}
DEBIAN_VERSION=${2:-buster}
export DEBIAN_FRONTEND=noninteractive
curl -sS -L https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main" | tee /etc/apt/sources.list.d/postgresql.list
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${DEBIAN_VERSION}-pgdg main" | tee /etc/apt/sources.list.d/postgresql.list
apt-get update
apt-get install -y postgresql-client-${POSTGRES_VERSION}

View file

@ -2,7 +2,7 @@
set -xeou pipefail
# Based on https://github.com/docker-library/ruby/blob/master/2.7/buster/Dockerfile
# Based on https://github.com/docker-library/ruby/blob/master/2.7/bullseye/Dockerfile
RUBY_VERSION=${1}
RUBY_MAJOR=${1%.*} # strip last component

View file

@ -1,4 +1,4 @@
TOOLS=(RUBY GOLANG GIT LFS CHROME NODE YARN POSTGRESQL GRAPHICSMAGICK PGBOUNCER BAZELISK)
TOOLS=(DEBIAN RUBY GOLANG GIT LFS CHROME NODE YARN POSTGRESQL GRAPHICSMAGICK PGBOUNCER BAZELISK)
function get_image_name(){
local IMAGE_NAME