-
Notifications
You must be signed in to change notification settings - Fork 3.9k
109 lines (93 loc) · 3.12 KB
/
oci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# https://github.com/marketplace/actions/build-and-push-docker-images
name: OCI
on:
push:
paths-ignore:
- '.github/workflows/secondary-umbrella.yaml'
workflow_dispatch:
env:
VERSION: ${{ github.event.pull_request.head.sha || github.sha }}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-publish-dev-bazel:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Configure Erlang
uses: erlef/setup-beam@v1
with:
otp-version: 26.2
elixir-version: 1.15
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Configure Bazel
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 --color=yes
build --experimental_ui_max_stdouterr_bytes=4194304
build --action_env EXTRA_BUILDX_OPTS="--cache-from=type=gha --cache-to=type=gha"
EOF
- name: Build amd64
run: |
bazelisk build //packaging/docker-image:rabbitmq-amd64 \
--config=buildbuddy
- name: Build arm64
run: |
bazelisk build //packaging/docker-image:rabbitmq-arm64 \
--config=buildbuddy
- name: Test
run: |
OCI_TESTS=$(bazel cquery 'tests(//packaging/docker-image/...)' | awk '{ print $1 }')
bazelisk test ${OCI_TESTS} \
--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: Assemble Multi-Arch
run: |
bazelisk build //packaging/docker-image:rabbitmq \
--config=buildbuddy
- name: Login to DockerHub
if: steps.authorized.outputs.PUSH == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Tag and Push
if: steps.authorized.outputs.PUSH == 'true'
run: |
TAG_1="${{ env.VERSION }}"
REF_NAME="${{ github.ref_name }}"
TAG_2="${REF_NAME//\//-}"
set -x
bazelisk run //packaging/docker-image:push \
--config=buildbuddy -- \
--tag ${TAG_1} \
--tag ${TAG_2}
summary-oci:
needs:
- build-publish-dev-bazel
runs-on: ubuntu-latest
steps:
- name: SUMMARY
run: |
echo "SUCCESS"