Skip to content

Commit dc276d5

Browse files
authored
Merge pull request #14036 from rabbitmq/ci/nightly-oci
CI: workflow to build container image nightly
2 parents 1a4f0ff + 4f35561 commit dc276d5

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Nightly OCI (make)
2+
on:
3+
schedule:
4+
# at 2:20am Mon-Fri
5+
# GitHub advises to schedule jobs NOT at the start of the hour
6+
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule
7+
- cron: 20 2 * * 1-5
8+
env:
9+
REGISTRY_IMAGE: pivotalrabbitmq/rabbitmq
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build-package-generic-unix:
17+
strategy:
18+
matrix:
19+
otp_version:
20+
- '27'
21+
branch:
22+
- main
23+
- v4.1.x
24+
- v4.0.x
25+
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
with:
31+
ref: ${{ matrix.branch }}
32+
33+
- name: Configure Erlang
34+
uses: erlef/setup-beam@v1
35+
with:
36+
otp-version: ${{ matrix.otp_version }}
37+
elixir-version: latest
38+
39+
- name: make package-generic-unix
40+
id: make
41+
run: |
42+
make package-generic-unix PROJECT_VERSION=${{ matrix.branch }}+${{ github.sha }}
43+
44+
- name: Upload package-generic-unix
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: package-generic-unix-otp${{ matrix.otp_version }}-${{ matrix.branch }}
48+
path: PACKAGES/rabbitmq-server-*.tar.xz
49+
50+
build-and-push:
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
otp_version:
55+
- '27'
56+
branch:
57+
- main
58+
- v4.1.x
59+
- v4.0.x
60+
61+
needs: build-package-generic-unix
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
66+
with:
67+
ref: ${{ matrix.branch }}
68+
69+
- name: Download package-generic-unix
70+
uses: actions/download-artifact@v4
71+
with:
72+
name: package-generic-unix-otp${{ matrix.otp_version }}-${{ matrix.branch }}
73+
path: PACKAGES
74+
75+
- name: Rename package-generic-unix
76+
run: |
77+
cp \
78+
PACKAGES/rabbitmq-server-generic-unix-*.tar.xz \
79+
packaging/docker-image/package-generic-unix.tar.xz
80+
81+
- name: Docker meta
82+
id: meta
83+
uses: docker/metadata-action@v5
84+
with:
85+
images: ${{ env.REGISTRY_IMAGE }}
86+
flavor: |
87+
suffix=-otp${{ matrix.otp_version }}
88+
tags: |
89+
type=sha,format=long
90+
type=schedule,pattern=nightly.{{date 'YYYYMMDD'}},prefix=${{ matrix.branch }}+
91+
92+
- name: Set up QEMU
93+
uses: docker/setup-qemu-action@v3
94+
95+
- name: Set up Docker Buildx
96+
uses: docker/setup-buildx-action@v3
97+
98+
- name: Login to Docker Hub
99+
uses: docker/login-action@v3
100+
with:
101+
username: ${{ secrets.DOCKERHUB_USERNAME }}
102+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
103+
104+
- name: Build and push by digest
105+
id: build
106+
uses: docker/build-push-action@v6
107+
with:
108+
push: true
109+
context: packaging/docker-image
110+
labels: ${{ steps.meta.outputs.labels }}
111+
platforms: linux/amd64
112+
tags: ${{ steps.meta.outputs.tags }}
113+
cache-to: type=gha,mode=max,scope=${{ matrix.otp_version }}
114+
cache-from: type=gha,scope=${{ matrix.otp_version }}
115+
build-args: |
116+
OTP_VERSION=${{ matrix.otp_version }}
117+
RABBITMQ_VERSION=${{ matrix.branch }}+${{ github.sha }}

0 commit comments

Comments
 (0)