Skip to content

Commit 4e720d7

Browse files
authored
Use make for OCI workflow (#11042)
* Use make instead of bazel for the OCI workflow
1 parent d32a2a8 commit 4e720d7

File tree

11 files changed

+397
-533
lines changed

11 files changed

+397
-533
lines changed

.github/workflows/oci-base.yaml

Lines changed: 0 additions & 69 deletions
This file was deleted.

.github/workflows/oci-make.yaml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# https://github.com/marketplace/actions/build-and-push-docker-images
2+
name: OCI (make)
3+
on:
4+
push:
5+
paths-ignore:
6+
- '.github/workflows/secondary-umbrella.yaml'
7+
- '.github/workflows/update-elixir-patches.yaml'
8+
- '.github/workflows/update-otp-patches.yaml'
9+
workflow_dispatch:
10+
env:
11+
REGISTRY_IMAGE: pivotalrabbitmq/rabbitmq
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
jobs:
16+
build-package-generic-unix:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
- name: Configure Erlang
22+
uses: erlef/setup-beam@v1
23+
with:
24+
otp-version: 26.2
25+
elixir-version: 1.15
26+
- name: make package-generic-unix
27+
run: |
28+
make package-generic-unix
29+
- name: Upload package-generic-unix
30+
uses: actions/[email protected]
31+
with:
32+
name: package-generic-unix
33+
path: PACKAGES/rabbitmq-server-*.tar.xz
34+
35+
build:
36+
needs: build-package-generic-unix
37+
runs-on: ubuntu-latest
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
platform:
42+
- linux/amd64
43+
- linux/arm64
44+
steps:
45+
- name: Prepare
46+
run: |
47+
platform=${{ matrix.platform }}
48+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
- name: Download package-generic-unix
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: package-generic-unix
55+
path: PACKAGES
56+
- name: Rename package-generic-unix
57+
run: |
58+
cp \
59+
PACKAGES/rabbitmq-server-generic-unix-*.tar.xz \
60+
packaging/docker-image/package-generic-unix.tar.xz
61+
- name: Docker meta
62+
id: meta
63+
uses: docker/metadata-action@v5
64+
with:
65+
images: ${{ env.REGISTRY_IMAGE }}
66+
tags: |
67+
type=ref,event=branch
68+
type=ref,event=pr
69+
type=sha,format=long
70+
- name: Set up QEMU
71+
uses: docker/setup-qemu-action@v3
72+
- name: Set up Docker Buildx
73+
uses: docker/setup-buildx-action@v3
74+
- name: Login to GitHub Container Registry
75+
uses: docker/login-action@v3
76+
with:
77+
registry: ghcr.io
78+
username: ${{ github.actor }}
79+
password: ${{ secrets.GITHUB_TOKEN }}
80+
- name: Login to Docker Hub
81+
uses: docker/login-action@v3
82+
with:
83+
username: ${{ secrets.DOCKERHUB_USERNAME }}
84+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
85+
- name: Build and push by digest
86+
id: build
87+
uses: docker/build-push-action@v5
88+
with:
89+
context: packaging/docker-image
90+
platforms: ${{ matrix.platform }}
91+
labels: ${{ steps.meta.outputs.labels }}
92+
cache-to: type=registry,ref=ghcr.io/rabbitmq/rabbitmq:buildcache-${{ env.PLATFORM_PAIR }},mode=max
93+
cache-from: type=registry,ref=ghcr.io/rabbitmq/rabbitmq:buildcache-${{ env.PLATFORM_PAIR }}
94+
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
95+
- name: Export digest
96+
run: |
97+
mkdir -p /tmp/digests
98+
digest="${{ steps.build.outputs.digest }}"
99+
touch "/tmp/digests/${digest#sha256:}"
100+
- name: Upload digest
101+
uses: actions/upload-artifact@v4
102+
with:
103+
name: digests-${{ env.PLATFORM_PAIR }}
104+
path: /tmp/digests/*
105+
if-no-files-found: error
106+
retention-days: 1
107+
108+
merge:
109+
runs-on: ubuntu-latest
110+
needs:
111+
- build
112+
steps:
113+
- name: Download digests
114+
uses: actions/download-artifact@v4
115+
with:
116+
path: /tmp/digests
117+
pattern: digests-*
118+
merge-multiple: true
119+
- name: Set up Docker Buildx
120+
uses: docker/setup-buildx-action@v3
121+
- name: Docker meta
122+
id: meta
123+
uses: docker/metadata-action@v5
124+
with:
125+
images: ${{ env.REGISTRY_IMAGE }}
126+
tags: |
127+
type=ref,event=branch
128+
type=ref,event=pr
129+
type=sha,format=long
130+
- name: Login to Docker Hub
131+
uses: docker/login-action@v3
132+
with:
133+
username: ${{ secrets.DOCKERHUB_USERNAME }}
134+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
135+
- name: Create manifest list and push
136+
working-directory: /tmp/digests
137+
run: |
138+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
139+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
140+
- name: Inspect image
141+
run: |
142+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
143+
144+
summary-oci:
145+
needs:
146+
- build-package-generic-unix
147+
- build
148+
- merge
149+
runs-on: ubuntu-latest
150+
steps:
151+
- name: SUMMARY
152+
run: |
153+
cat << 'EOF' | jq -e 'map(.result == "success") | all(.)'
154+
${{ toJson(needs) }}
155+
EOF

.github/workflows/oci.yaml

Lines changed: 0 additions & 139 deletions
This file was deleted.

.github/workflows/rabbitmq_peer_discovery_aws.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ jobs:
2121
steps:
2222
- name: CHECKOUT REPOSITORY
2323
uses: actions/checkout@v4
24-
- name: WAIT FOR OCI IMAGE WORKFLOW
25-
uses: lewagon/[email protected]
24+
- uses: docker/metadata-action@v4
25+
id: metadata
2626
with:
27-
ref: ${{ github.ref }}
28-
check-name: build-publish-dev-bazel
29-
repo-token: ${{ secrets.GITHUB_TOKEN }}
30-
wait-interval: 30 # seconds
27+
images: pivotalrabbitmq/rabbitmq
28+
tags: |
29+
type=sha,format=long
30+
- uses: int128/wait-for-docker-image-action@v1
31+
with:
32+
tags: ${{ steps.metadata.outputs.tags }}
33+
timeout-seconds: 3600
34+
polling-seconds: 60
3135
- name: CONFIGURE BAZEL
3236
run: |
3337
cat << EOF >> user.bazelrc
@@ -51,6 +55,6 @@ jobs:
5155
--build_tests_only \
5256
--test_env AWS_ACCESS_KEY_ID=${{ secrets.CONCOURSE_AWS_ACCESS_KEY_ID }} \
5357
--test_env AWS_SECRET_ACCESS_KEY=${{ secrets.CONCOURSE_AWS_SECRET_ACCESS_KEY }} \
54-
--test_env RABBITMQ_IMAGE="pivotalrabbitmq/rabbitmq:${{ github.sha }}" \
58+
--test_env RABBITMQ_IMAGE="pivotalrabbitmq/rabbitmq:sha-${{ github.sha }}" \
5559
--test_env AWS_ECS_CLUSTER_NAME="rabbitmq-peer-discovery-aws-actions-${branch_or_tag//[._]/-}" \
5660
--verbose_failures

packaging/base-image/.dockerignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)