diff --git a/.cirrus.yml b/.cirrus.yml index e9f9a10ac..32832f937 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -224,30 +224,18 @@ meta_task: clone_script: &noop mkdir -p $CIRRUS_WORKING_DIR # source not needed script: /usr/local/bin/entrypoint.sh -ubuntu20_build_task: - alias: ubuntu20_build +msrv_build_task: + alias: msrv_build depends_on: - "build" gce_instance: *standard_gce_x86_64 container: cpu: 2 # Do not increase, will result in scheduling delays memory: "8Gb" - image: quay.io/libpod/ubuntu20rust + # When bumping the image always remember to update the README MSRV as well. + image: quay.io/libpod/nv-rust:1.76 script: - - cargo build - - -centos9_build_task: - alias: centos9_build - depends_on: - - "build" - gce_instance: *standard_gce_x86_64 - container: - cpu: 2 # Do not increase, will result in scheduling delays - memory: "8Gb" - image: quay.io/libpod/centos9rust - script: - - cargo build + - make build success_task: @@ -263,8 +251,7 @@ success_task: - "integration" - "integration_aarch64" - "meta" - - "ubuntu20_build" - - "centos9_build" + - "msrv_build" gce_instance: *standard_gce_x86_64 env: API_URL_BASE: "https://api.cirrus-ci.com/v1/artifact/build/${CIRRUS_BUILD_ID}" diff --git a/README.md b/README.md index e78b3f81f..4fac1f110 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,15 @@ Netavark is a tool for configuring networking for Linux containers. Its features - [Podman](https://podman.io/docs) 4.0+ - [protoc](https://grpc.io/docs/protoc-installation/) +## MSRV (Minimum Supported Rust Version) + +v1.76 + +We test that Netavark can be build on this Rust version and on some newer versions. +All newer versions should also build, and if they do not, the issue should be +reported and will be fixed. Older versions are not guaranteed to build and issues +will not be fixed. + ## Build ```console diff --git a/contrib/container_images/Dockerfile.CentOS9 b/contrib/container_images/Dockerfile.CentOS9 deleted file mode 100644 index f8d37cf8a..000000000 --- a/contrib/container_images/Dockerfile.CentOS9 +++ /dev/null @@ -1,2 +0,0 @@ -FROM quay.io/centos/centos:stream9 -RUN dnf -y --enablerepo=crb install cargo protobuf-compiler && dnf -y clean all diff --git a/contrib/container_images/Dockerfile.Fedora b/contrib/container_images/Dockerfile.Fedora deleted file mode 100644 index b1d3b4ce7..000000000 --- a/contrib/container_images/Dockerfile.Fedora +++ /dev/null @@ -1,2 +0,0 @@ -FROM registry.fedoraproject.org/fedora:39 -RUN dnf -y install cargo protobuf-compiler && dnf -y clean all diff --git a/contrib/container_images/Dockerfile.Rust b/contrib/container_images/Dockerfile.Rust new file mode 100644 index 000000000..d4efc541e --- /dev/null +++ b/contrib/container_images/Dockerfile.Rust @@ -0,0 +1,4 @@ +# Source for quay.io/libpod/nv-rust +# This version should always match the MSRV, when you update this also update the version in the root README.md. +FROM docker.io/library/rust:1.76 +RUN apt-get update && apt-get -y install protobuf-compiler libprotobuf-dev diff --git a/contrib/container_images/Dockerfile.UbuntuLatest b/contrib/container_images/Dockerfile.UbuntuLatest deleted file mode 100644 index 3629aa0f3..000000000 --- a/contrib/container_images/Dockerfile.UbuntuLatest +++ /dev/null @@ -1,2 +0,0 @@ -FROM docker.io/library/ubuntu:rolling -RUN apt-get update && apt-get -y install cargo protobuf-compiler libprotobuf-dev diff --git a/contrib/container_images/README.md b/contrib/container_images/README.md new file mode 100644 index 000000000..7acafd436 --- /dev/null +++ b/contrib/container_images/README.md @@ -0,0 +1,9 @@ +# Rust image + +The point of this image is to verify the MSRV in CI so we can catch if a code or dependency change bumped the MSRV. +If this is acceptable then update the version in the Dockerfile.Rust FROM line then build the new image see below. + +# Build and publish rust image + +Make sure you have valid `quay.io/libpod` credentials in order to push the image there. +Then run the script `build_and_publish_rust_image.sh` to build and push it. diff --git a/contrib/container_images/build_and_publish_rust_image.sh b/contrib/container_images/build_and_publish_rust_image.sh new file mode 100755 index 000000000..1de303088 --- /dev/null +++ b/contrib/container_images/build_and_publish_rust_image.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +PODMAN=${PODMAN:-podman} +SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}") +DOCKERFILE="$(dirname "${BASH_SOURCE[0]}")/Dockerfile.Rust" + +# get the tag from the Dockerfile so we do not duplicate it +TAG=$(awk -F':' '/FROM/{print $NF}' $DOCKERFILE) +if [[ -z "$TAG" ]]; then + echo "Empty tag in $DOCKERFILE; the tag must specify the rust version to use" >&2 + exit 1 +fi + +FULL_IMAGE_NAME="quay.io/libpod/nv-rust:$TAG" + +$PODMAN build -t $FULL_IMAGE_NAME -f $DOCKERFILE +$PODMAN push $FULL_IMAGE_NAME