mirror of
https://ops.gitlab.net/gitlab-org/gitlab-build-images.git
synced 2025-12-09 18:12:55 +01:00
Merge branch 'add-rust' into 'master'
Add Rust lang See merge request https://gitlab.com/gitlab-org/gitlab-build-images/-/merge_requests/610 Merged-by: Rémy Coutable <remy@rymai.me> Approved-by: Rémy Coutable <remy@rymai.me> Co-authored-by: Hannes Moser <box@hannesmoser.at>
This commit is contained in:
commit
11c39ae1c9
8 changed files with 72 additions and 1 deletions
|
|
@ -9,8 +9,10 @@ gitaly:
|
|||
- OS: ['debian:bullseye']
|
||||
RUBY: ['2.7', '3.0']
|
||||
GOLANG: ['1.18', '1.19']
|
||||
RUST: ['1.65.0']
|
||||
GIT: ['2.36']
|
||||
- OS: ['ubi:8.6']
|
||||
RUBY: ['2.7']
|
||||
GOLANG: ['1.18']
|
||||
RUST: ['1.65.0']
|
||||
GIT: ['2.36']
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ gitlab:
|
|||
GIT: ['2.36']
|
||||
POSTGRESQL: ['11', '12', '13']
|
||||
GOLANG: ['1.18', '1.19']
|
||||
RUST: ['1.65.0']
|
||||
NODE: ['16.14']
|
||||
CHROME: ['106', '107']
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ gitlab-kas:
|
|||
- .build_and_push
|
||||
variables:
|
||||
GOLANG: '1.19'
|
||||
RUST: '1.65.0'
|
||||
LFS: '2.9'
|
||||
CHROME: '107'
|
||||
NODE: '14.15'
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ RUN /scripts/install-essentials ${BUILD_OS}
|
|||
|
||||
ENV PATH $PATH:/usr/local/go/bin
|
||||
|
||||
ENV PATH /usr/local/cargo/bin:$PATH
|
||||
|
||||
# Ruby
|
||||
ARG RUBY_VERSION
|
||||
ARG RUBY_DOWNLOAD_SHA256
|
||||
|
|
@ -50,6 +52,11 @@ ARG GOLANG_DOWNLOAD_SHA256
|
|||
|
||||
RUN if [ -n "$INSTALL_GOLANG_VERSION" ] ; then /scripts/install-golang "${INSTALL_GOLANG_VERSION}" "${GOLANG_DOWNLOAD_SHA256}" && go version; fi
|
||||
|
||||
# Rust
|
||||
ARG INSTALL_RUST_VERSION
|
||||
|
||||
RUN if [ -n "$INSTALL_RUST_VERSION" ] ; then /scripts/install-rust "${INSTALL_RUST_VERSION}" && rustc version; fi
|
||||
|
||||
# Git LFS (https://git-lfs.github.com/)
|
||||
ARG LFS_VERSION
|
||||
ARG LFS_DOWNLOAD_SHA256
|
||||
|
|
@ -117,6 +124,7 @@ ENV RUBY_VERSION=${RUBY_VERSION} \
|
|||
NODE_VERSION=${NODE_INSTALL_VERSION} \
|
||||
YARN_VERSION=${YARN_INSTALL_VERSION} \
|
||||
GOLANG_VERSION=${INSTALL_GOLANG_VERSION} \
|
||||
RUST_VERSION=${INSTALL_RUST_VERSION} \
|
||||
LFS_VERSION=${LFS_VERSION} \
|
||||
POSTGRES_VERSION=${POSTGRES_VERSION} \
|
||||
GRAPHISMAGICK_VERSION=${GRAPHISMAGICK_VERSION} \
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ Major components define image path. Base image is defined by `OS` component. Sup
|
|||
1. `OS`
|
||||
1. `RUBY`
|
||||
1. `GOLANG`
|
||||
1. `RUST`
|
||||
1. `NODE`
|
||||
1. `POSTGRES`
|
||||
|
||||
|
|
@ -88,6 +89,7 @@ new_image:
|
|||
OS: 'debian:bullseye'
|
||||
RUBY: '3.0'
|
||||
GOLANG: '1.15'
|
||||
RUST: '1.65.0'
|
||||
GIT: '2.29'
|
||||
```
|
||||
|
||||
|
|
|
|||
42
scripts/install-rust
Executable file
42
scripts/install-rust
Executable file
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -xeou pipefail
|
||||
|
||||
INSTALL_RUST_VERSION=${1}
|
||||
|
||||
case "$TARGETARCH" in
|
||||
"arm64")
|
||||
RUST_TARGET="aarch64-unknown-linux-gnu"
|
||||
;;
|
||||
"amd64")
|
||||
RUST_TARGET="x86_64-unknown-linux-gnu"
|
||||
;;
|
||||
*)
|
||||
echo "target architecture not supported"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
RUST_DOWNLOAD_URL="https://static.rust-lang.org/rustup/dist/$RUST_TARGET/rustup-init"
|
||||
|
||||
RUSTUP_DEFAULT_TOOLCHAIN="$INSTALL_RUST_VERSION"
|
||||
RUSTUP_HOME="/usr/local/rustup"
|
||||
|
||||
CARGO_HOME="/usr/local/cargo"
|
||||
|
||||
function build() {
|
||||
curl --retry 3 --proto '=https' --tlsv1.2 -sSf "$RUST_DOWNLOAD_URL" > rustup-init
|
||||
curl --retry 3 --proto '=https' --tlsv1.2 -sSf "$RUST_DOWNLOAD_URL.sha256" > rustup-init.sha256
|
||||
# Remove "target/$RUST_TARGET/release/" string from rustup-init.sha256
|
||||
sed -i "s:\*target/$RUST_TARGET/release/::" rustup-init.sha256
|
||||
sha256sum -c rustup-init.sha256
|
||||
chmod +x rustup-init
|
||||
|
||||
# Need rustfmt for bindgen doc parsing
|
||||
./rustup-init --no-modify-path --default-toolchain "$RUSTUP_DEFAULT_TOOLCHAIN" --profile minimal --component rustfmt -y
|
||||
rm rustup-init && rm rustup-init.sha256
|
||||
|
||||
chmod -R a+w "$RUSTUP_HOME" "$CARGO_HOME"
|
||||
}
|
||||
|
||||
build "$@"
|
||||
|
|
@ -61,6 +61,18 @@ function print_golang_args() {
|
|||
printf -- "--build-arg GOLANG_DOWNLOAD_SHA256=%q " "${GOLANG_DOWNLOAD_SHA256[*]}"
|
||||
}
|
||||
|
||||
function print_rust_args() {
|
||||
case "$1" in
|
||||
1.65.0)
|
||||
RUST_VERSION="1.65.0"
|
||||
;;
|
||||
|
||||
*) fail "Unknown rust version $1" ;;
|
||||
esac
|
||||
|
||||
printf -- "--build-arg RUST_VERSION=%s " "$RUST_VERSION"
|
||||
}
|
||||
|
||||
# If you add a new minor version here, be sure to check that the
|
||||
# Chrome versions can be found at https://www.ubuntuupdates.org/pm/google-chrome-stable.
|
||||
# ChromeDriver supports this: https://sites.google.com/chromium.org/driver/downloads
|
||||
|
|
@ -339,6 +351,7 @@ function parse_arguments() {
|
|||
BUNDLER) print_bundler_args $version ;;
|
||||
RUBYGEMS) print_rubygems_args $version ;;
|
||||
GOLANG) print_golang_args $version ;;
|
||||
RUST) print_rust_args $version ;;
|
||||
CHROME) print_chrome_args $version ;;
|
||||
DOCKER) print_docker_args $version ;;
|
||||
BUILDX) print_buildx_args $version ;;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# Note: Check out https://wiki.bash-hackers.org/syntax/pe for documentation on
|
||||
# various variable operations used in this script.
|
||||
|
||||
PATH_TOOLS=(DEBIAN OS UBI RUBY GOLANG NODE POSTGRESQL)
|
||||
PATH_TOOLS=(DEBIAN OS UBI RUBY GOLANG RUST NODE POSTGRESQL)
|
||||
TAG_TOOLS=(BUNDLER RUBYGEMS GIT LFS CHROME YARN GRAPHICSMAGICK BAZELISK DOCKER BUILDX GCLOUD KUBECTL HELM)
|
||||
|
||||
# Generate the docker image path using the components that were specified via
|
||||
|
|
@ -10,6 +10,7 @@ TAG_TOOLS=(BUNDLER RUBYGEMS GIT LFS CHROME YARN GRAPHICSMAGICK BAZELISK DOCKER B
|
|||
# OS: debian:bullseye
|
||||
# RUBY: 2.7
|
||||
# GOLANG: 1.19
|
||||
# RUST: 1.65.0
|
||||
# GIT: 2.33
|
||||
# POSTGRESQL: 11
|
||||
# With the above variables, this function will return
|
||||
|
|
@ -44,6 +45,7 @@ function get_image_path() {
|
|||
# OS: debian:bullseye
|
||||
# RUBY: 2.7
|
||||
# GOLANG: 1.19
|
||||
# RUST: 1.65.0
|
||||
# GIT: 2.33
|
||||
# POSTGRESQL: 11
|
||||
# For that job, this function will return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue