diff options
author | David Ansari <david.ansari@gmx.de> | 2021-06-24 10:04:32 +0200 |
---|---|---|
committer | David Ansari <david.ansari@gmx.de> | 2021-06-24 14:19:31 +0200 |
commit | dfbce39172dc6e402333c1857fc48e536b67a284 (patch) | |
tree | 36b64f9c7d1b439b4e730764ea855d023c509f4a | |
parent | afae6a1b39677fc42be3972a214ef62dbe7c2307 (diff) | |
download | rabbitmq-server-git-dfbce39172dc6e402333c1857fc48e536b67a284.tar.gz |
Build two OCI images
1. with minimum required Erlang
2. with maximum supported Erlang
-rw-r--r-- | .github/workflows/oci.yaml | 56 | ||||
-rw-r--r-- | packaging/docker-image/Makefile | 13 |
2 files changed, 48 insertions, 21 deletions
diff --git a/.github/workflows/oci.yaml b/.github/workflows/oci.yaml index a05db733c5..8397b48648 100644 --- a/.github/workflows/oci.yaml +++ b/.github/workflows/oci.yaml @@ -15,21 +15,45 @@ env: RABBITMQ_VERSION: ${{ github.sha }} VERSION: ${{ github.sha }} jobs: + # This job will build two docker images (one with minimum required OTP, one with maximum supported OTP). + # Each image will have two tags (one containing the Git commit SHA, one containing the branch name). + # + # For example, for Git commit SHA '1111aaa' and branch name 'main', the following four tags will be pushed to Dockerhub: + # * 1111aaa-otp-min (image 1) + # * main-otp-min (image 1) + # * 1111aaa-otp-max (image 2) + # * main-otp-max (image 2) build-publish-dev: runs-on: ubuntu-latest + strategy: + matrix: + # Build two images: + # 1. with minimum required Erlang + # 2. with maximum supported Erlang + # Source of truth for released versions: https://www.rabbitmq.com/which-erlang.html + # For Elixir: https://github.com/rabbitmq/rabbitmq-server/blob/master/deps/rabbitmq_cli/mix.exs#L14 + # As of June 2021: + otp: ['23.2.1', '24.0.2'] + include: + - otp: '23.2.1' + otp_sha256: e7034e2cfe50d7570ac8f70ea7ba69ea013f10863043e25132f0a5d3d0d8d3a7 + elixir: '1.11.4' + image_tag_suffix: '-otp-min' + - otp: '24.0.2' + otp_sha256: 4abca2cda7fc962ad65575e5ed834dd69c745e7e637f92cfd49f384a281d0f18 + elixir: '1.12.1' + image_tag_suffix: '-otp-max' + env: + IMAGE_TAG_1: ${{ github.sha }}${{ matrix.image_tag_suffix }} steps: - name: Checkout uses: actions/checkout@v2.3.4 - # RabbitMQ master supports Erlang 24 (correct at June 2021) - # Source of truth for released versions: https://www.rabbitmq.com/which-erlang.html - # - # For Elixir: https://github.com/rabbitmq/rabbitmq-server/blob/master/deps/rabbitmq_cli/mix.exs#L14 - - name: Set up max supported Erlang & Elixir + - name: Set up Erlang & Elixir uses: erlef/setup-beam@v1.7 with: - otp-version: '24.0.2' - elixir-version: '1.12.1' + otp-version: ${{ matrix.otp }} + elixir-version: ${{ matrix.elixir }} - name: Build generic unix package run: | @@ -37,12 +61,11 @@ jobs: - name: Build container image working-directory: packaging/docker-image - run: >- - make dist - IMAGE_TAG=${GITHUB_REF##*/} - SKIP_PGP_VERIFY=true - OTP_VERSION=24.0.2 - OTP_SHA256=4abca2cda7fc962ad65575e5ed834dd69c745e7e637f92cfd49f384a281d0f18 + env: + OTP_VERSION: ${{ matrix.otp }} + OTP_SHA256: ${{ matrix.otp_sha256 }} + run: | + make dist SKIP_PGP_VERIFY=true - name: Login to DockerHub working-directory: packaging/docker-image @@ -51,7 +74,12 @@ jobs: --username '${{ secrets.DOCKERHUB_USERNAME }}' \ --password '${{ secrets.DOCKERHUB_PASSWORD }}' + # Push the same image with two different tags: + # 1. <git_commit_sha>-otp-[min|max] + # 2. <branch_name>-otp-[min|max] - name: Push container image to DockerHub working-directory: packaging/docker-image + env: + IMAGE_TAG_SUFFIX: ${{ matrix.image_tag_suffix }} run: | - make push IMAGE_TAG=${GITHUB_REF##*/} + make push IMAGE_TAG_2=${GITHUB_REF##*/}${IMAGE_TAG_SUFFIX} diff --git a/packaging/docker-image/Makefile b/packaging/docker-image/Makefile index e74ca45da6..991ab74d6c 100644 --- a/packaging/docker-image/Makefile +++ b/packaging/docker-image/Makefile @@ -39,6 +39,7 @@ SKIP_PGP_VERIFY ?= false PGP_KEYSERVER ?= pgpkeys.eu ALT1_PGP_KEYSERVER ?= keyserver.ubuntu.com ALT2_PGP_KEYSERVER ?= pgpkeys.uk +IMAGE_TAG_1 ?= $(subst +,-,$(VERSION)) all: dist @@ -50,16 +51,14 @@ dist: --build-arg OTP_VERSION=$(OTP_VERSION) \ --build-arg OTP_SHA256=$(OTP_SHA256) \ --build-arg RABBITMQ_BUILD=rabbitmq_server-$(VERSION) \ - --tag $(REPO):$(subst +,-,$(VERSION)) \ + --tag $(REPO):$(IMAGE_TAG_1) \ . -ifdef IMAGE_TAG - docker tag $(REPO):$(subst +,-,$(VERSION)) $(REPO):$(IMAGE_TAG) -endif push: - docker push $(REPO):$(subst +,-,$(VERSION)) -ifdef IMAGE_TAG - docker push $(REPO):$(IMAGE_TAG) + docker push $(REPO):$(IMAGE_TAG_1) +ifdef IMAGE_TAG_2 + docker tag $(REPO):$(IMAGE_TAG_1) $(REPO):$(IMAGE_TAG_2) + docker push $(REPO):$(IMAGE_TAG_2) endif clean: |