Skip to content

OTP 27 test and compatibility #546

OTP 27 test and compatibility

OTP 27 test and compatibility #546

Workflow file for this run

# https://github.com/marketplace/actions/build-and-push-docker-images
name: RabbitMQ OCI
on:
pull_request:
workflow_dispatch:
inputs:
rabbitmq_ref:
description: The branch, tag or commit of rabbitmq-server to use
default: main
env:
REGISTRY_IMAGE: pivotalrabbitmq/rabbitmq
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-package-generic-unix:
runs-on: ubuntu-latest
outputs:
TAG_1: ${{ steps.tags.outputs.TAG_1 }}
TAG_2: ${{ steps.tags.outputs.TAG_2 }}
TAG_3: ${{ steps.tags.outputs.TAG_3 }}
TAG_4: ${{ steps.tags.outputs.TAG_4 }}
steps:
- name: Checkout RabbitMQ
uses: actions/checkout@v4
with:
repository: rabbitmq/rabbitmq-server
ref: ${{ github.event.inputs.rabbitmq_ref }}
- name: Checkout Ra
uses: actions/checkout@v4
with:
path: deps/ra
- name: Patch Ra version
working-directory: deps/ra
run: |
sed -r -i"_orig" '/vsn,/ s/".*"/"${{ github.event.pull_request.head.sha || github.sha }}"/' src/ra.app.src
if git diff --exit-code; then
exit 1
fi
- name: Configure Erlang
uses: erlef/setup-beam@v1
with:
otp-version: 26.2
elixir-version: 1.15
- name: make package-generic-unix
run: |
make package-generic-unix
- name: Upload package-generic-unix
uses: actions/[email protected]
with:
name: package-generic-unix
path: PACKAGES/rabbitmq-server-*.tar.xz
- name: Compute Tags
id: tags
run: |
OTP="$(erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell)"
RABBIT_SHA=$(git rev-parse HEAD)
RABBIT_REF=$(git rev-parse --abbrev-ref HEAD)
RA_SHA=${{ github.event.pull_request.head.sha || github.sha }}
RA_ABBREV=ra-${RA_SHA:0:7}
TAG_1=rabbitmq-${RABBIT_REF}-${RA_ABBREV}-${OTP}
TAG_2=rabbitmq-${RABBIT_REF}-${RA_ABBREV}-otp-max-bazel
TAG_3=rabbitmq-${RABBIT_SHA:0:7}-${RA_ABBREV}-${OTP}
TAG_4=rabbitmq-${RABBIT_SHA:0:7}-${RA_ABBREV}-otp-max-bazel
echo "TAG_1=$TAG_1" | tee -a $GITHUB_OUTPUT
echo "TAG_2=$TAG_2" | tee -a $GITHUB_OUTPUT
echo "TAG_3=$TAG_3" | tee -a $GITHUB_OUTPUT
echo "TAG_4=$TAG_4" | tee -a $GITHUB_OUTPUT
build:
needs: build-package-generic-unix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
# ARM64 are currently slow
# - linux/arm64
steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
repository: rabbitmq/rabbitmq-server
ref: ${{ github.event.inputs.rabbitmq_ref }}
- name: Download package-generic-unix
uses: actions/download-artifact@v4
with:
name: package-generic-unix
path: PACKAGES
- name: Rename package-generic-unix
run: |
cp \
PACKAGES/rabbitmq-server-generic-unix-*.tar.xz \
packaging/docker-image/package-generic-unix.tar.xz
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=raw,value=${{ needs.build-package-generic-unix.outputs.TAG_1 }}
type=raw,value=${{ needs.build-package-generic-unix.outputs.TAG_2 }}
type=raw,value=${{ needs.build-package-generic-unix.outputs.TAG_3 }}
type=raw,value=${{ needs.build-package-generic-unix.outputs.TAG_4 }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v5
with:
context: packaging/docker-image
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-latest
needs:
- build-package-generic-unix
- build
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}
tags: |
type=raw,value=${{ needs.build-package-generic-unix.outputs.TAG_1 }}
type=raw,value=${{ needs.build-package-generic-unix.outputs.TAG_2 }}
type=raw,value=${{ needs.build-package-generic-unix.outputs.TAG_3 }}
type=raw,value=${{ needs.build-package-generic-unix.outputs.TAG_4 }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}