diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f1ba7b2..896f9af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,8 +26,14 @@ jobs: matrix: include: - image: linux-utils + platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le - image: alpine-sh + platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le - image: alpine-bash + platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le + # ubi-micro publishes no linux/arm/v7, and does publish s390x. + - image: ubi-bash + platforms: linux/amd64, linux/arm64, linux/ppc64le, linux/s390x steps: - name: Checkout uses: actions/checkout@v7 @@ -107,10 +113,11 @@ jobs: push: true sbom: true provenance: mode=max - platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le + platforms: ${{ matrix.platforms }} tags: | ${{ steps.docker_meta.outputs.tags }} build-args: | DBUILD_DATE=${{ steps.date.outputs.DATE }} DBUILD_REPO_URL=https://github.com/openebs/linux-utils DBUILD_SITE_URL=https://openebs.io + RELEASE_TAG=${{ env.TAG }} diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index f872f09..6749c19 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -31,6 +31,7 @@ jobs: - image: linux-utils - image: alpine-sh - image: alpine-bash + - image: ubi-bash steps: - name: Checkout uses: actions/checkout@v7 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1db8dcc..14dd7b4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,8 +26,14 @@ jobs: matrix: include: - image: linux-utils + platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le - image: alpine-sh + platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le - image: alpine-bash + platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le + # ubi-micro publishes no linux/arm/v7, and does publish s390x. + - image: ubi-bash + platforms: linux/amd64, linux/arm64, linux/ppc64le, linux/s390x steps: - name: Checkout uses: actions/checkout@v7 @@ -103,7 +109,7 @@ jobs: push: true sbom: true provenance: mode=max - platforms: linux/amd64, linux/arm64, linux/arm/v7, linux/ppc64le + platforms: ${{ matrix.platforms }} tags: | ${{ steps.docker_meta.outputs.tags }} build-args: | diff --git a/.github/workflows/trivy-ci.yml b/.github/workflows/trivy-ci.yml index e0f844d..a898655 100644 --- a/.github/workflows/trivy-ci.yml +++ b/.github/workflows/trivy-ci.yml @@ -19,6 +19,7 @@ jobs: - image: linux-utils - image: alpine-sh - image: alpine-bash + - image: ubi-bash steps: - name: Checkout uses: actions/checkout@v7 diff --git a/Makefile b/Makefile index e00a64e..2b979d7 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ ifeq (${IMAGE_ORG}, ) endif ifeq (${DIMAGES}, ) - DIMAGES:=linux-utils alpine-sh alpine-bash + DIMAGES:=linux-utils alpine-sh alpine-bash ubi-bash export DIMAGES endif @@ -84,6 +84,17 @@ test: @sudo docker run --rm "$$IMAGE_ORG/alpine-bash:ci" which /bin/bash @sudo docker run --rm "$$IMAGE_ORG/alpine-bash:ci" which nc @sudo docker run --rm "$$IMAGE_ORG/alpine-bash:ci" which chown + @# ubi-micro ships no `which`, so check with a bash builtin instead. + @sudo docker run --rm --entrypoint /bin/bash "$$IMAGE_ORG/ubi-bash:ci" -c \ + 'for t in sh bash timeout sleep date chown; do command -v $$t >/dev/null || { echo "missing: $$t"; exit 1; }; done' + @# netcat is deliberately absent: the probes use bash's /dev/tcp instead. + @# A bash built without net redirections fails this exec too, reporting + @# "No such file or directory" for the literal path, so the test greps for + @# the refusal: only a bash that understands /dev/tcp gets as far as a + @# connect(2) on a closed port. + @sudo docker run --rm --entrypoint /bin/bash "$$IMAGE_ORG/ubi-bash:ci" -c \ + 'exec 3<>/dev/tcp/127.0.0.1/9' 2>&1 | grep -q 'Connection refused' + @echo "/dev/tcp works" .PHONY: clobber clobber: diff --git a/dockerfiles/ubi-bash/Dockerfile b/dockerfiles/ubi-bash/Dockerfile new file mode 100644 index 0000000..36b8eec --- /dev/null +++ b/dockerfiles/ubi-bash/Dockerfile @@ -0,0 +1,65 @@ +# Minimal shell image for OpenEBS helper and init containers, on Red Hat UBI. +# +# ubi-micro already ships bash, coreutils-single (timeout, sleep, date, chown) +# and ncurses, which is everything the helper and probe commands use, so no +# package is installed here and the image needs no package manager. +# +# bash is the reason this is the micro image rather than a scratch one: its +# /dev/tcp redirection replaces netcat for the readiness probes, so nothing +# extra has to be installed to check that a dependency is listening. +# There is deliberately no FIPS configuration here. ubi-micro ships no crypto +# at all - no libcrypto, no libssl, no gnutls, no nss, no openssl binary - and +# the probes speak plain TCP, never TLS. Installing openssl-fips-provider would +# add a crypto stack, and its CVE surface, for code that nothing in this image +# calls. On a FIPS-enabled host the kernel is in FIPS mode regardless. +# +# Pinned by digest, unlike the alpine images in this repo. Alpine does not +# rebuild a patch tag, so alpine:3.23.5 is already immutable; Red Hat rebuilds +# ubi9/ubi-micro:9.9 in place, so the bare tag names different content over +# time. Nothing here rebuilds a published image tag, so the floating tag was +# never delivering base fixes to a release -- it only changed what the next +# build picked up, without a diff to show for it. +# +# The digest is the manifest list, covering all four platforms this image is +# built for. A per-architecture digest builds on amd64 and fails the other +# three at release time, which is the first place they are built. +# +# Bump both parts together when the scheduled trivy scan flags the base. +FROM registry.access.redhat.com/ubi9/ubi-micro:9.9-1794478307@sha256:dbd325b96bcd432dd42816d31412bdf1dc0fb973b79ed310344bc23c76c068db + +ARG DBUILD_DATE +ARG DBUILD_REPO_URL="https://github.com/openebs/linux-utils" +ARG DBUILD_SITE_URL="https://www.openebs.io/" +ARG RELEASE_TAG + +COPY LICENSE /licenses/LICENSE + +# Red Hat's own labels describe ubi-micro, and an image that restates only some +# of them ends up making claims about itself that belong to the base: without +# the two below, `version` reads 9.9 and `release` is Red Hat's build id for +# every release of this image. RELEASE_TAG is the image tag the workflows build +# with, so the label and the tag always agree; the defaults are for a bare +# `docker build` that passes neither argument. +LABEL name="openebs/ubi-bash" \ + vendor="OpenEBS" \ + maintainer="OpenEBS Maintainers" \ + version="${RELEASE_TAG:-develop}" \ + release="${DBUILD_DATE:-develop}" \ + summary="Minimal shell container for OpenEBS helper jobs" \ + description="Provides bash, timeout, sleep, date and chown for OpenEBS helper and init containers." \ + url="${DBUILD_SITE_URL}" \ + build-date="${DBUILD_DATE}" \ + io.k8s.display-name="OpenEBS UBI Bash" \ + io.k8s.description="Provides bash, timeout, sleep, date and chown for OpenEBS helper and init containers." + +# com.redhat.component, com.redhat.license_terms and cpe are left as inherited +# on purpose. They describe the base layer accurately, and cpe in particular is +# what vulnerability scanners read to select the Red Hat CVE feed, so clearing +# it would cost correct scan results. + +LABEL org.label-schema.schema-version="1.0" +LABEL org.label-schema.name="linux-utils" +LABEL org.label-schema.description="Linux Container for OpenEBS Helper jobs" +LABEL org.label-schema.build-date=$DBUILD_DATE +LABEL org.label-schema.vcs-url=$DBUILD_REPO_URL +LABEL org.label-schema.url=$DBUILD_SITE_URL