Non-voters and automatic promotion #331
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
jobs: | |
build-publish-dev: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- image_tag_suffix: otp-max-bazel | |
otp_version_id: 26 | |
steps: | |
- name: Checkout Ra | |
uses: actions/checkout@v3 | |
with: | |
path: ra | |
- name: Inject the git sha as the ra version | |
working-directory: ra | |
run: | | |
sed -i"_orig" "/vsn,/ s/2\\.[0-9]\\.[0-9]/${{ github.event.pull_request.head.sha || github.sha }}/" src/ra.app.src | |
- name: Checkout RabbitMQ | |
uses: actions/checkout@v3 | |
with: | |
repository: rabbitmq/rabbitmq-server | |
ref: ${{ github.event.inputs.rabbitmq_ref }} | |
path: rabbitmq-server | |
- name: Load RabbitMQ Version Info | |
id: load-rabbitmq-info | |
working-directory: rabbitmq-server | |
run: | | |
echo "RABBITMQ_SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
echo "RABBITMQ_REF=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT | |
- name: Mount Bazel Cache | |
uses: actions/cache@v1 | |
with: | |
path: "/home/runner/repo-cache/" | |
key: repo-cache | |
- name: Configure Bazel | |
working-directory: rabbitmq-server | |
run: | | |
if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then | |
cat << EOF >> user.bazelrc | |
build:buildbuddy --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }} | |
EOF | |
fi | |
cat << EOF >> user.bazelrc | |
build:buildbuddy --build_metadata=ROLE=CI | |
build:buildbuddy --build_metadata=VISIBILITY=PRIVATE | |
build:buildbuddy --repository_cache=/home/runner/repo-cache/ | |
build:buildbuddy --color=yes | |
build:buildbuddy --disk_cache= | |
build:buildbuddy --remote_download_toplevel | |
build --@io_bazel_rules_docker//transitions:enable=false | |
EOF | |
- name: Check OTP/Elixir versions used in RBE | |
id: load-info | |
working-directory: rabbitmq-server | |
run: | | |
bazelisk build :otp_version :elixir_version \ | |
--config=rbe \ | |
--platforms=//bazel/platforms:erlang_linux_${{ matrix.otp_version_id }}_platform | |
echo "otp=$(cat bazel-bin/otp_version.txt)" >> $GITHUB_OUTPUT | |
echo "elixir=$(cat bazel-bin/elixir_version.txt)" >> $GITHUB_OUTPUT | |
- name: Configure OTP & Elixir | |
uses: erlef/[email protected] | |
with: | |
otp-version: ${{ steps.load-info.outputs.otp }} | |
elixir-version: ${{ steps.load-info.outputs.elixir }} | |
- name: Configure the ra override for this ra | |
working-directory: rabbitmq-server | |
run: | | |
cat << EOF >> user.bazelrc | |
build --override_module rabbitmq_ra=${{ github.workspace }}/ra | |
EOF | |
- name: Configure otp for the OCI image | |
working-directory: rabbitmq-server | |
run: | | |
sudo npm install --global --silent @bazel/buildozer | |
buildozer 'set tars ["@otp_src_${{ matrix.otp_version_id }}//file"]' \ | |
//packaging/docker-image:otp_source | |
- name: Build | |
working-directory: rabbitmq-server | |
run: | | |
bazelisk build //packaging/docker-image:rabbitmq \ | |
--config=buildbuddy | |
- name: Load | |
working-directory: rabbitmq-server | |
run: | | |
bazelisk run //packaging/docker-image:rabbitmq \ | |
--config=buildbuddy | |
- name: Check for Push Credentials | |
id: authorized | |
run: | | |
if [ -n "${{ secrets.DOCKERHUB_USERNAME }}" ]; then | |
echo "PUSH=true" >> $GITHUB_OUTPUT | |
else | |
echo "PUSH=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Login to DockerHub | |
if: steps.authorized.outputs.PUSH == 'true' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Tag and Push | |
if: steps.authorized.outputs.PUSH == 'true' | |
working-directory: rabbitmq-server | |
run: | | |
RABBIT_REF=${{ steps.load-rabbitmq-info.outputs.RABBITMQ_REF }} | |
RABBIT_SHA=${{ steps.load-rabbitmq-info.outputs.RABBITMQ_SHA }} | |
RA_SHA=${{ github.event.pull_request.head.sha || github.sha }} | |
RA_ABBREV=ra-${RA_SHA:0:7} | |
TAG_1=rabbitmq-${RABBIT_REF}-${RA_ABBREV}-${{ steps.load-info.outputs.otp }} | |
TAG_2=rabbitmq-${RABBIT_REF}-${RA_ABBREV}-${{ matrix.image_tag_suffix }} | |
TAG_3=rabbitmq-${RABBIT_SHA:0:7}-${RA_ABBREV}-${{ steps.load-info.outputs.otp }} | |
TAG_4=rabbitmq-${RABBIT_SHA:0:7}-${RA_ABBREV}-${{ matrix.image_tag_suffix }} | |
echo "Will tag with ${TAG_1}" | |
echo "Will tag with ${TAG_2}" | |
echo "Will tag with ${TAG_3}" | |
echo "Will tag with ${TAG_4}" | |
docker tag bazel/packaging/docker-image:rabbitmq \ | |
pivotalrabbitmq/rabbitmq:${TAG_1} | |
docker tag bazel/packaging/docker-image:rabbitmq \ | |
pivotalrabbitmq/rabbitmq:${TAG_2} | |
docker tag bazel/packaging/docker-image:rabbitmq \ | |
pivotalrabbitmq/rabbitmq:${TAG_3} | |
docker tag bazel/packaging/docker-image:rabbitmq \ | |
pivotalrabbitmq/rabbitmq:${TAG_4} | |
docker push pivotalrabbitmq/rabbitmq:${TAG_1} | |
docker push pivotalrabbitmq/rabbitmq:${TAG_2} | |
docker push pivotalrabbitmq/rabbitmq:${TAG_3} | |
docker push pivotalrabbitmq/rabbitmq:${TAG_4} |