Skip to content

Fix RHEL, env vars

Fix RHEL, env vars #54

Workflow file for this run

name: RHEL
on:
push:
paths:
- .github/workflows/rhel.yml
- docker/rhel/Dockerfile
env:
CONTAINER_REGISTRY: ghcr.io
REDHAT_REGISTRY: registry.redhat.io
BUILDKIT_PROGRESS: plain
BUILDKIT_DOCKERFILE_CHECK: skip=InvalidDefaultArgInFrom
BUILDKIT_INLINE_CACHE: 1
CONAN_VERSION: 2.18.0
GCOVR_VERSION: 8.3
NONROOT_USER: ci
jobs:
# Build the Docker image for Red Hat Enterprise Linux using different versions
# of GCC
# Note, the `os` part of matrix must be kept in sync with the `merge` job below
build:
strategy:
matrix:
architecture:
- platform: linux/amd64
runner: ubuntu-24.04
- platform: linux/arm64
runner: ubuntu-24.04-arm
os:
- release: 9.6
compiler_name: gcc
compiler_version: 13
- release: 9.6
compiler_name: gcc
compiler_version: 14
- release: 9.6
compiler_name: clang
compiler_version: 'any'
runs-on: ${{ matrix.architecture.runner }}
permissions:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Registry
uses: docker/login-action@v3
with:
registry: ${{ env.CONTAINER_REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Red Hat Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REDHAT_REGISTRY }}
username: ${{ secrets.REDHAT_USER }}
password: ${{ secrets.REDHAT_TOKEN }}
- name: Prepare environment
run: |
# Convert the repository name to lowercase as the organization name is
# uppercase, which is not permitted by the Docker registry. It's 2025 and GitHub
# still does not provide convenient action expression syntax for lowercase.
GITHUB_REPO=${{ github.repository }}
CONTAINER_REPO=${GITHUB_REPO@L}
echo "CONTAINER_REPOSITORY=${CONTAINER_REPO}/rhel-${{ matrix.os.release }}" >> $GITHUB_ENV
echo "CONTAINER_IMAGE=${CONTAINER_REGISTRY}/${CONTAINER_REPO}/rhel-${{ matrix.os.release }}" >> $GITHUB_ENV
PLATFORM=${{ matrix.architecture.platform }}
echo "PLATFORM_PAIR=${PLATFORM//\//-}" >> $GITHUB_ENV
- name: Prepare container metadata
id: meta
uses: docker/metadata-action@v5
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,manifest-descriptor
with:
images: ${{ env.CONTAINER_IMAGE }}
tags: |
type=raw,value=${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }}
type=sha,prefix=${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }}-sha-
labels: |
org.opencontainers.image.authors=For inquiries, please use https://${{ github.repository }}/issues
org.opencontainers.image.documentation=https://${{ github.repository }}
org.opencontainers.image.vendor=XRPLF
org.opencontainers.image.title=${{ env.CONTAINER_REPOSITORY }}
- name: Build and push the Docker image
id: build
uses: docker/build-push-action@v6
with:
build-args: |
CONAN_VERSION=${{ env.CONAN_VERSION }}
GCC_VERSION=${{ matrix.os.compiler_version }}
GCOVR_VERSION=${{ env.GCOVR_VERSION }}
NONROOT_USER=${{ env.NONROOT_USER }}
RHEL_VERSION=${{ matrix.os.release }}
context: docker/rhel
outputs: type=image,name=${{ env.CONTAINER_IMAGE }},push-by-digest=true,name-canonical=true,push=true
platforms: ${{ matrix.architecture.platform }}
provenance: mode=max
push: ${{ github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch }}
sbom: true
labels: ${{ steps.meta.outputs.labels }}
target: ${{ matrix.os.compiler_name }}
- name: Export digest
if: ${{ github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch }}
shell: bash
run: |
mkdir -p /tmp/digests
DIGEST="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${DIGEST#sha256:}"
- name: Upload digest
if: ${{ github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch }}
uses: actions/upload-artifact@v4
with:
name: digests-${{ matrix.os.release }}-${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }}-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
if: ${{ github.ref_type == 'branch' && github.ref_name == github.event.repository.default_branch }}
strategy:
matrix:
os:
- release: 9.6
compiler_name: gcc
compiler_version: 13
- release: 9.6
compiler_name: gcc
compiler_version: 14
- release: 9.6
compiler_name: clang
compiler_version: 'any'
runs-on: ubuntu-24.04
needs:
- build
permissions:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-${{ matrix.os.release }}-${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }}-*
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Registry
uses: docker/login-action@v3
with:
registry: ${{ env.CONTAINER_REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare environment
run: |
GITHUB_REPO=${{ github.repository }}
CONTAINER_REPO=${GITHUB_REPO@L}
echo "CONTAINER_IMAGE=${CONTAINER_REGISTRY}/${CONTAINER_REPO}/rhel-${{ matrix.os.release }}" >> $GITHUB_ENV
- name: Prepare container metadata
id: meta
uses: docker/metadata-action@v5
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: index
with:
images: ${{ env.CONTAINER_IMAGE }}
tags: |
type=raw,value=${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }}
type=sha,prefix=${{ matrix.os.compiler_name }}-${{ matrix.os.compiler_version }}-sha-
- name: Create manifest list and push
working-directory: /tmp/digests
shell: bash
run: |
eval "docker buildx imagetools create \
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(jq -cr '.annotations | map("--annotation \"" + . + "\"") | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.CONTAINER_IMAGE }}@sha256:%s ' *)"
- name: Inspect image
shell: bash
run: |
docker buildx imagetools inspect ${{ env.CONTAINER_IMAGE }}:${{ steps.meta.outputs.version }}