Merge branch 'add-bazelisk-to-gitlab-images' into 'master'

Add Bazelisk support to Dockerfile.custom

See merge request gitlab-org/gitlab-build-images!413
This commit is contained in:
Rémy Coutable 2021-06-29 13:25:08 +00:00
commit e49fb0651d
5 changed files with 45 additions and 1 deletions

View file

@ -92,6 +92,10 @@ ruby-2.7.2.patched-golang-1.16-git-2.31-lfs-2.9-chrome-89-node-14.15-yarn-1.22-p
ruby-3.0.0.patched-golang-1.16-git-2.31-lfs-2.9-chrome-89-node-14.15-yarn-1.22-postgresql-11-graphicsmagick-1.3.36 test: *test_custom
ruby-3.0.0.patched-golang-1.16-git-2.31-lfs-2.9-chrome-89-node-14.15-yarn-1.22-postgresql-12-graphicsmagick-1.3.36 test: *test_custom
# Used by GitLab/KAS integration tests
ruby-2.7.2.patched-golang-1.16-git-2.31-lfs-2.9-chrome-89-node-14.15-yarn-1.22-postgresql-12-graphicsmagick-1.3.36-bazelisk-1.9.0 test: *test_custom
ruby-3.0.0.patched-golang-1.16-git-2.31-lfs-2.9-chrome-89-node-14.15-yarn-1.22-postgresql-12-graphicsmagick-1.3.36-bazelisk-1.9.0 test: *test_custom
# Used by GitLab's compile-production-assets and compile-test-assets jobs
ruby-2.7.2-git-2.31-lfs-2.9-node-14.15-yarn-1.22-graphicsmagick-1.3.36 test: *test_custom
ruby-3.0.0-git-2.31-lfs-2.9-node-14.15-yarn-1.22-graphicsmagick-1.3.36 test: *test_custom
@ -159,6 +163,10 @@ ruby-2.7.2.patched-golang-1.16-git-2.31-lfs-2.9-chrome-89-node-14.15-yarn-1.22-p
ruby-3.0.0.patched-golang-1.16-git-2.31-lfs-2.9-chrome-89-node-14.15-yarn-1.22-postgresql-11-graphicsmagick-1.3.36 push: *build_and_deploy_custom
ruby-3.0.0.patched-golang-1.16-git-2.31-lfs-2.9-chrome-89-node-14.15-yarn-1.22-postgresql-12-graphicsmagick-1.3.36 push: *build_and_deploy_custom
# Used by GitLab/KAS integration tests
ruby-2.7.2.patched-golang-1.16-git-2.31-lfs-2.9-chrome-89-node-14.15-yarn-1.22-postgresql-12-graphicsmagick-1.3.36-bazelisk-1.9.0 push: *build_and_deploy_custom
ruby-3.0.0.patched-golang-1.16-git-2.31-lfs-2.9-chrome-89-node-14.15-yarn-1.22-postgresql-12-graphicsmagick-1.3.36-bazelisk-1.9.0 push: *build_and_deploy_custom
# Used by GitLab's compile-production-assets and compile-test-assets jobs
ruby-2.7.2-git-2.31-lfs-2.9-node-14.15-yarn-1.22-graphicsmagick-1.3.36 push: *build_and_deploy_custom
ruby-3.0.0-git-2.31-lfs-2.9-node-14.15-yarn-1.22-graphicsmagick-1.3.36 push: *build_and_deploy_custom

View file

@ -75,6 +75,12 @@ ARG PGBOUNCER_DOWNLOAD_SHA256
RUN if [ -n "$PGBOUNCER_VERSION" ] ; then /scripts/install-pgbouncer $PGBOUNCER_VERSION $PGBOUNCER_DOWNLOAD_SHA256; fi
# Bazelisk
ARG BAZELISK_VERSION
ARG BAZELISK_DOWNLOAD_SHA256
RUN if [ -n "$BAZELISK_VERSION" ] ; then /scripts/install-bazelisk $BAZELISK_VERSION $BAZELISK_DOWNLOAD_SHA256; fi
RUN locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
@ -91,4 +97,5 @@ ENV RUBY_VERSION=${RUBY_VERSION} \
POSTGRES_VERSION=${POSTGRES_VERSION} \
GRAPHISMAGICK_VERSION=${GRAPHISMAGICK_VERSION} \
DOCKER_VERSION=${DOCKER_VERSION} \
PGBOUNCER_VERSION=${PGBOUNCER_VERSION}
PGBOUNCER_VERSION=${PGBOUNCER_VERSION} \
BAZELISK_VERSION=${BAZELISK_VERSION}

View file

@ -47,6 +47,7 @@ The first pair represents the base image and version. So `ruby-3.0-...` will use
Each of the following parts represents another feature and version. Available
options are:
1. `bazelisk`
1. `chrome`
1. `docker`
1. `git`

View file

@ -185,6 +185,19 @@ function print_pgbouncer_args() {
printf -- "--build-arg PGBOUNCER_DOWNLOAD_SHA256=%s " "$PGBOUNCER_DOWNLOAD_SHA256"
}
function print_bazelisk_args() {
case "$1" in
1.9.0)
BAZELISK_VERSION=1.9.0
BAZELISK_DOWNLOAD_SHA256=b8c7f2a1b07ad64a2f27f8f19a202f90d044de7b5b6ccc387a6fe5d4a8ec4937
;;
*) echo "Unknown bazelisk version $1"; exit 1;
esac
printf -- "--build-arg BAZELISK_VERSION=%s " "$BAZELISK_VERSION"
printf -- "--build-arg BAZELISK_DOWNLOAD_SHA256=%s " "$BAZELISK_DOWNLOAD_SHA256"
}
function print_ruby_args() {
case "$1" in
2.6|2.6.*)
@ -230,6 +243,7 @@ function parse_arguments() {
postgresql) print_postgres_args $version ;;
graphicsmagick) print_graphicsmagick_args $version ;;
pgbouncer) print_pgbouncer_args $version ;;
bazelisk) print_bazelisk_args $version ;;
*) exit 1;;
esac
done

14
scripts/install-bazelisk Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
set -xeou pipefail
BAZELISK_VERSION=${1}
BAZELISK_DOWNLOAD_SHA256=${2}
BAZELISK_DOWNLOAD_URL="https://github.com/bazelbuild/bazelisk/releases/download/v${BAZELISK_VERSION}/bazelisk-linux-amd64"
curl -fsSL "$BAZELISK_DOWNLOAD_URL" -o bazelisk
echo "${BAZELISK_DOWNLOAD_SHA256} bazelisk" | sha256sum -c -
chmod +x bazelisk
mv bazelisk /usr/local/bin/bazel