Skip to content

Commit 6fd38d6

Browse files
gerhardansd
authored andcommitted
Merge pull request #3143 from rabbitmq/oci-matrix
Build OCI image for each supported Erlang major version (cherry picked from commit f46a267)
1 parent 2f3987e commit 6fd38d6

File tree

2 files changed

+54
-16
lines changed

2 files changed

+54
-16
lines changed

.github/workflows/oci.yaml

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,67 @@ on:
1010
- Makefile
1111
- plugins.mk
1212
- rabbitmq-components.mk
13+
- .github/workflows/oci.yaml
1314
env:
1415
GENERIC_UNIX_ARCHIVE: ${{ github.workspace }}/PACKAGES/rabbitmq-server-generic-unix-${{ github.sha }}.tar.xz
1516
RABBITMQ_VERSION: ${{ github.sha }}
1617
VERSION: ${{ github.sha }}
1718
jobs:
19+
20+
# This job will build one docker image per supported Erlang major version.
21+
# Each image will have two tags (one containing the Git commit SHA, one containing the branch name).
22+
#
23+
# For example, for Git commit SHA '1111aaa' and branch name 'main' and maximum supported Erlang major version '25',
24+
# the following 3 images and 6 tags will be pushed to Dockerhub:
25+
#
26+
# * 1111aaa-otp-max (image OTP 25)
27+
# * main-otp-max (image OTP 25)
28+
# * 1111aaa-otp-max-1 (image OTP 24)
29+
# * main-otp-max-1 (image OTP 24)
30+
# * 1111aaa-otp-max-2 (image OTP 23)
31+
# * main-otp-max-2 (image OTP 23)
32+
1833
build-publish-dev:
1934
runs-on: ubuntu-latest
35+
strategy:
36+
matrix:
37+
# Build image for every supported Erlang major version.
38+
# Source of truth for released versions: https://www.rabbitmq.com/which-erlang.html
39+
# For Elixir: https://github.com/rabbitmq/rabbitmq-server/blob/master/deps/rabbitmq_cli/mix.exs#L14
40+
# As of June 2021:
41+
otp: ['24.0.2', '23.2.1']
42+
include:
43+
- otp: '24.0.2'
44+
otp_sha256: 4abca2cda7fc962ad65575e5ed834dd69c745e7e637f92cfd49f384a281d0f18
45+
elixir: '1.12.1'
46+
image_tag_suffix: '-otp-max'
47+
- otp: '23.2.1'
48+
otp_sha256: e7034e2cfe50d7570ac8f70ea7ba69ea013f10863043e25132f0a5d3d0d8d3a7
49+
elixir: '1.11.4'
50+
image_tag_suffix: '-otp-max-1'
51+
env:
52+
IMAGE_TAG_1: ${{ github.sha }}${{ matrix.image_tag_suffix }}
2053
steps:
2154
- name: Checkout
2255
uses: actions/checkout@v2
2356

24-
# RabbitMQ master supports Erlang 24 (correct at June 2021)
25-
# Source of truth for released versions: https://www.rabbitmq.com/which-erlang.html
26-
#
27-
# For Elixir: https://github.com/rabbitmq/rabbitmq-server/blob/master/deps/rabbitmq_cli/mix.exs#L14
28-
- name: Set up max supported Erlang & Elixir
57+
- name: Set up Erlang & Elixir
2958
uses: erlef/setup-beam@v1.7
3059
with:
31-
otp-version: '24.0.2'
32-
elixir-version: '1.12.1'
60+
otp-version: ${{ matrix.otp }}
61+
elixir-version: ${{ matrix.elixir }}
3362

3463
- name: Build generic unix package
3564
run: |
3665
make package-generic-unix PROJECT_VERSION=${GITHUB_SHA}
3766
3867
- name: Build container image
3968
working-directory: packaging/docker-image
40-
run: >-
41-
make dist
42-
IMAGE_TAG=${GITHUB_REF##*/}
43-
SKIP_PGP_VERIFY=true
44-
OTP_VERSION=24.0.2
45-
OTP_SHA256=4abca2cda7fc962ad65575e5ed834dd69c745e7e637f92cfd49f384a281d0f18
69+
env:
70+
OTP_VERSION: ${{ matrix.otp }}
71+
OTP_SHA256: ${{ matrix.otp_sha256 }}
72+
run: |
73+
make dist SKIP_PGP_VERIFY=true
4674
4775
- name: Login to DockerHub
4876
working-directory: packaging/docker-image
@@ -51,7 +79,12 @@ jobs:
5179
--username '${{ secrets.DOCKERHUB_USERNAME }}' \
5280
--password '${{ secrets.DOCKERHUB_PASSWORD }}'
5381
82+
# Push the same image with two different tags:
83+
# 1. <git_commit_sha>-otp-max[-1|-2]
84+
# 2. <branch_name>-otp-max[-1|-2]
5485
- name: Push container image to DockerHub
5586
working-directory: packaging/docker-image
87+
env:
88+
IMAGE_TAG_SUFFIX: ${{ matrix.image_tag_suffix }}
5689
run: |
57-
make push
90+
make push IMAGE_TAG_2=${GITHUB_REF##*/}${IMAGE_TAG_SUFFIX}

packaging/docker-image/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ SKIP_PGP_VERIFY ?= false
3939
PGP_KEYSERVER ?= pgpkeys.eu
4040
ALT1_PGP_KEYSERVER ?= keyserver.ubuntu.com
4141
ALT2_PGP_KEYSERVER ?= pgpkeys.uk
42+
IMAGE_TAG_1 ?= $(subst +,-,$(VERSION))
4243

4344
all: dist
4445

@@ -50,11 +51,15 @@ dist:
5051
--build-arg OTP_VERSION=$(OTP_VERSION) \
5152
--build-arg OTP_SHA256=$(OTP_SHA256) \
5253
--build-arg RABBITMQ_BUILD=rabbitmq_server-$(VERSION) \
53-
--tag pivotalrabbitmq/rabbitmq:$(subst +,-,$(VERSION)) \
54+
--tag $(REPO):$(IMAGE_TAG_1) \
5455
.
5556

5657
push:
57-
docker push pivotalrabbitmq/rabbitmq:$(subst +,-,$(VERSION))
58+
docker push $(REPO):$(IMAGE_TAG_1)
59+
ifdef IMAGE_TAG_2
60+
docker tag $(REPO):$(IMAGE_TAG_1) $(REPO):$(IMAGE_TAG_2)
61+
docker push $(REPO):$(IMAGE_TAG_2)
62+
endif
5863

5964
clean:
6065
rm -rf rabbitmq_server-*

0 commit comments

Comments
 (0)