Skip to content

Commit c9ab302

Browse files
authored
Remove rules_docker in favor of rules_oci (#10869)
Local builds of images are extremely slow, but buildbuddy runners don't have the emulator available
1 parent a81f409 commit c9ab302

22 files changed

+381
-812
lines changed

.bazelrc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ build:rbe-26_2 --platforms=//bazel/platforms:erlang_linux_26_2_platform
7979
# no-op config so that --config=local does not error
8080
build:local --color=auto
8181

82-
# having bzlmod enabled seems to interfere with docker toolchain resolution,
83-
# so we set this flag
84-
build --@io_bazel_rules_docker//transitions:enable=false
85-
8682
# Try importing a user specific .bazelrc
8783
# You can create your own by copying and editing the template-user.bazelrc template:
8884
# cp template-user.bazelrc user.bazelrc

.github/workflows/oci.yaml

Lines changed: 36 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,31 @@ on:
88
- '.github/workflows/update-otp-patches.yaml'
99
workflow_dispatch:
1010
env:
11-
GENERIC_UNIX_ARCHIVE: ${{ github.workspace }}/bazel-bin/package-generic-unix.tar.xz
12-
RABBITMQ_VERSION: ${{ github.event.pull_request.head.sha || github.sha }}
1311
VERSION: ${{ github.event.pull_request.head.sha || github.sha }}
1412
concurrency:
1513
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1614
cancel-in-progress: true
1715
jobs:
18-
19-
# This job will build one docker image per supported Erlang major version.
20-
# Each image will have two tags (one containing the Git commit SHA, one containing the branch name).
21-
#
22-
# For example, for Git commit SHA '111aaa' and branch name 'main' and maximum supported Erlang major version '26',
23-
# the following tags will be pushed to Dockerhub:
24-
#
25-
# * 111aaa-otp-min (image OTP 25)
26-
# * main-otp-min (image OTP 25)
27-
# * 111aaa-otp-max (image OTP 26)
28-
# * main-otp-max (image OTP 26)
29-
3016
build-publish-dev-bazel:
31-
runs-on: ubuntu-20.04
32-
strategy:
33-
fail-fast: false
34-
matrix:
35-
include:
36-
- image_tag_suffix: otp-min-bazel
37-
otp_version_id: 26_1
38-
- image_tag_suffix: otp-max-bazel
39-
otp_version_id: 26_2
17+
runs-on: ubuntu-latest
4018
steps:
4119
- name: Checkout
4220
uses: actions/checkout@v4
4321

44-
- name: Mount Bazel Cache
45-
uses: actions/[email protected]
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v3
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Configure Erlang
29+
uses: erlef/setup-beam@v1
4630
with:
47-
path: "/home/runner/repo-cache/"
48-
key: ${{ runner.os }}-repo-cache-${{ hashFiles('MODULE.bazel','WORKSPACE','bazel/bzlmod/secondary_umbrella.bzl') }}
49-
restore-keys: |
50-
${{ runner.os }}-repo-cache-
51-
save-always: true
31+
otp-version: 26.2
32+
elixir-version: 1.15
33+
34+
- name: Expose GitHub Runtime
35+
uses: crazy-max/ghaction-github-runtime@v3
5236

5337
- name: Configure Bazel
5438
run: |
@@ -60,35 +44,27 @@ jobs:
6044
cat << EOF >> user.bazelrc
6145
build:buildbuddy --build_metadata=ROLE=CI
6246
build:buildbuddy --build_metadata=VISIBILITY=PRIVATE
63-
build:buildbuddy --repository_cache=/home/runner/repo-cache/
6447
build:buildbuddy --color=yes
65-
build:buildbuddy --disk_cache=
6648
67-
build:buildbuddy --remote_download_toplevel
49+
build --experimental_ui_max_stdouterr_bytes=4194304
50+
build --action_env EXTRA_BUILDX_OPTS="--cache-from=type=gha --cache-to=type=gha"
6851
EOF
6952
70-
- name: Configure otp for the OCI image
53+
- name: Build amd64
7154
run: |
72-
sudo npm install --global --silent @bazel/buildozer
73-
74-
buildozer 'set tars ["@otp_src_${{ matrix.otp_version_id }}//file"]' \
75-
//packaging/docker-image:otp_source
55+
bazelisk build //packaging/docker-image:rabbitmq-amd64 \
56+
--config=buildbuddy
7657
77-
- name: Build
58+
- name: Build arm64
7859
run: |
79-
bazelisk build //packaging/docker-image:rabbitmq \
80-
--config=rbe-${{ matrix.otp_version_id }}
60+
bazelisk build //packaging/docker-image:rabbitmq-arm64 \
61+
--config=buildbuddy
8162
8263
- name: Test
8364
run: |
8465
OCI_TESTS=$(bazel cquery 'tests(//packaging/docker-image/...)' | awk '{ print $1 }')
8566
bazelisk test ${OCI_TESTS} \
86-
--config=rbe-${{ matrix.otp_version_id }}
87-
88-
- name: Load
89-
run: |
90-
bazelisk run //packaging/docker-image:rabbitmq \
91-
--config=rbe-${{ matrix.otp_version_id }}
67+
--config=buildbuddy
9268
9369
- name: Check for Push Credentials
9470
id: authorized
@@ -99,6 +75,11 @@ jobs:
9975
echo "PUSH=false" >> $GITHUB_OUTPUT
10076
fi
10177
78+
- name: Assemble Multi-Arch
79+
run: |
80+
bazelisk build //packaging/docker-image:rabbitmq \
81+
--config=buildbuddy
82+
10283
- name: Login to DockerHub
10384
if: steps.authorized.outputs.PUSH == 'true'
10485
uses: docker/login-action@v3
@@ -109,16 +90,16 @@ jobs:
10990
- name: Tag and Push
11091
if: steps.authorized.outputs.PUSH == 'true'
11192
run: |
112-
TAG_1="${{ github.event.pull_request.head.sha || github.sha }}-${{ matrix.image_tag_suffix }}"
113-
TAG_2="${GITHUB_REF##*/}-${{ matrix.image_tag_suffix }}"
93+
TAG_1="${{ env.VERSION }}"
11494
115-
docker tag bazel/packaging/docker-image:rabbitmq \
116-
pivotalrabbitmq/rabbitmq:${TAG_1}
117-
docker tag bazel/packaging/docker-image:rabbitmq \
118-
pivotalrabbitmq/rabbitmq:${TAG_2}
95+
REF_NAME="${{ github.ref_name }}"
96+
TAG_2="${REF_NAME//\//-}"
11997
120-
docker push pivotalrabbitmq/rabbitmq:${TAG_1}
121-
docker push pivotalrabbitmq/rabbitmq:${TAG_2}
98+
set -x
99+
bazelisk run //packaging/docker-image:push \
100+
--config=buildbuddy -- \
101+
--tag ${TAG_1} \
102+
--tag ${TAG_2}
122103
123104
summary-oci:
124105
needs:

.github/workflows/rabbitmq_peer_discovery_aws.yaml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ jobs:
1515
runs-on: ubuntu-20.04
1616
strategy:
1717
matrix:
18-
include:
19-
- image_tag_suffix: otp-max-bazel
20-
otp_version_id: 26_2
18+
otp_version_id:
19+
- 26_2
2120
timeout-minutes: 45
2221
steps:
2322
- name: CHECKOUT REPOSITORY
@@ -26,27 +25,17 @@ jobs:
2625
uses: lewagon/[email protected]
2726
with:
2827
ref: ${{ github.ref }}
29-
check-name: build-publish-dev-bazel (${{ matrix.image_tag_suffix }}, ${{ matrix.otp_version_id }})
28+
check-name: build-publish-dev-bazel
3029
repo-token: ${{ secrets.GITHUB_TOKEN }}
3130
wait-interval: 30 # seconds
32-
- name: MOUNT BAZEL CACHE
33-
uses: actions/[email protected]
34-
with:
35-
path: "/home/runner/repo-cache/"
36-
key: ${{ runner.os }}-repo-cache-${{ hashFiles('MODULE.bazel','WORKSPACE','bazel/bzlmod/secondary_umbrella.bzl') }}
37-
restore-keys: |
38-
${{ runner.os }}-repo-cache-
39-
save-always: true
4031
- name: CONFIGURE BAZEL
4132
run: |
4233
cat << EOF >> user.bazelrc
4334
build:buildbuddy --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }}
4435
4536
build:buildbuddy --build_metadata=ROLE=CI
4637
build:buildbuddy --build_metadata=VISIBILITY=PRIVATE
47-
build:buildbuddy --repository_cache=/home/runner/repo-cache/
4838
build:buildbuddy --color=yes
49-
build:buildbuddy --disk_cache=
5039
EOF
5140
#! - name: Setup tmate session
5241
#! uses: mxschmitt/action-tmate@v3
@@ -62,6 +51,6 @@ jobs:
6251
--build_tests_only \
6352
--test_env AWS_ACCESS_KEY_ID=${{ secrets.CONCOURSE_AWS_ACCESS_KEY_ID }} \
6453
--test_env AWS_SECRET_ACCESS_KEY=${{ secrets.CONCOURSE_AWS_SECRET_ACCESS_KEY }} \
65-
--test_env RABBITMQ_IMAGE="pivotalrabbitmq/rabbitmq:${{ github.sha }}-otp-max-bazel" \
54+
--test_env RABBITMQ_IMAGE="pivotalrabbitmq/rabbitmq:${{ github.sha }}" \
6655
--test_env AWS_ECS_CLUSTER_NAME="rabbitmq-peer-discovery-aws-actions-${branch_or_tag//[._]/-}" \
6756
--verbose_failures

.github/workflows/test-authnz.yaml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ jobs:
3434
fail-fast: false
3535
matrix:
3636
erlang_version:
37-
- "26.1"
37+
- "26.2"
3838
browser:
3939
- chrome
4040
include:
41-
- erlang_version: "26.1"
42-
elixir_version: 1.15.2
41+
- erlang_version: "26.2"
42+
elixir_version: 1.15.7
4343
env:
4444
SELENIUM_DIR: deps/rabbitmq_management/selenium
4545
DOCKER_NETWORK: rabbitmq_net
@@ -53,19 +53,8 @@ jobs:
5353
otp-version: ${{ matrix.erlang_version }}
5454
elixir-version: ${{ matrix.elixir_version }}
5555

56-
- name: Mount Bazel Cache
57-
uses: actions/[email protected]
58-
with:
59-
path: "/home/runner/repo-cache/"
60-
key: ${{ runner.os }}-repo-cache-${{ hashFiles('MODULE.bazel','WORKSPACE','bazel/bzlmod/secondary_umbrella.bzl') }}
61-
restore-keys: |
62-
${{ runner.os }}-repo-cache-
63-
save-always: true
64-
6556
- name: Configure Bazel
6657
run: |
67-
ERLANG_HOME="$(dirname $(dirname $(which erl)))"
68-
ELIXIR_HOME="$(dirname $(dirname $(which iex)))"
6958
if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then
7059
cat << EOF >> user.bazelrc
7160
build:buildbuddy --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }}
@@ -74,20 +63,12 @@ jobs:
7463
cat << EOF >> user.bazelrc
7564
build:buildbuddy --build_metadata=ROLE=CI
7665
build:buildbuddy --build_metadata=VISIBILITY=PRIVATE
77-
build:buildbuddy --repository_cache=/home/runner/repo-cache/
7866
build:buildbuddy --color=yes
79-
build:buildbuddy --disk_cache=
80-
81-
build:buildbuddy --remote_download_toplevel
82-
83-
build --@rules_erlang//:erlang_version=${{ matrix.erlang_version }}
84-
build --@rules_erlang//:erlang_home=${ERLANG_HOME}
85-
build --//:elixir_home=${ELIXIR_HOME}
8667
EOF
8768
8869
- name: Build & Load RabbitMQ OCI
8970
run: |
90-
bazelisk run packaging/docker-image:rabbitmq \
71+
bazelisk run packaging/docker-image:rabbitmq-amd64 \
9172
--config=buildbuddy
9273
9374
- name: Configure Docker Network
@@ -101,7 +82,7 @@ jobs:
10182
10283
- name: Run Suites
10384
run: |
104-
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq ${SELENIUM_DIR}/run-suites.sh full-suite-authnz-messaging
85+
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 ${SELENIUM_DIR}/run-suites.sh full-suite-authnz-messaging
10586
10687
- name: Upload Test Artifacts
10788
if: always()

.github/workflows/test-erlang-git.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@ jobs:
1111
steps:
1212
- name: CHECKOUT REPOSITORY
1313
uses: actions/checkout@v4
14-
- name: MOUNT BAZEL CACHE
15-
uses: actions/[email protected]
16-
with:
17-
path: "/home/runner/repo-cache/"
18-
key: ${{ runner.os }}-repo-cache-${{ hashFiles('MODULE.bazel','WORKSPACE','bazel/bzlmod/secondary_umbrella.bzl') }}
19-
restore-keys: |
20-
${{ runner.os }}-repo-cache-
21-
save-always: true
2214
- name: CONFIGURE BAZEL
2315
run: |
2416
if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then
@@ -29,9 +21,7 @@ jobs:
2921
cat << EOF >> user.bazelrc
3022
build:buildbuddy --build_metadata=ROLE=CI
3123
build:buildbuddy --build_metadata=VISIBILITY=PUBLIC
32-
build:buildbuddy --repository_cache=/home/runner/repo-cache/
3324
build:buildbuddy --color=yes
34-
build:buildbuddy --disk_cache=
3525
3626
build:rbe --platforms=//bazel/platforms:erlang_linux_git_master_platform
3727
EOF

.github/workflows/test-mixed-versions.yaml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,6 @@ jobs:
7070
with:
7171
ref: v${{ steps.check.outputs.version }}
7272
path: secondary-umbrella
73-
- name: MOUNT BAZEL CACHE
74-
if: env.exists != 'true'
75-
uses: actions/[email protected]
76-
with:
77-
path: "/home/runner/repo-cache/"
78-
key: repo-cache-secondary-umbrella-${{ hashFiles('primary-umbrella/MODULE.bazel','primary-umbrella/WORKSPACE','primary-umbrella/bazel/bzlmod/secondary_umbrella.bzl') }}
79-
restore-keys: |
80-
repo-cache-secondary-umbrella-
81-
save-always: true
8273
- name: BUILD SECONDARY UMBRELLA ARCHIVE
8374
if: env.exists != 'true'
8475
working-directory: secondary-umbrella
@@ -92,9 +83,7 @@ jobs:
9283
build:buildbuddy --build_metadata=ROLE=CI
9384
build:buildbuddy --build_metadata=VISIBILITY=PRIVATE
9485
build:buildbuddy --remote_instance_name=buildbuddy-io/buildbuddy/ci-secondary-umbrella
95-
build:buildbuddy --repository_cache=/home/runner/repo-cache/
9686
build:buildbuddy --color=yes
97-
build:buildbuddy --disk_cache=
9887
9988
build:buildbuddy --remote_download_toplevel
10089
EOF
@@ -139,14 +128,6 @@ jobs:
139128
steps:
140129
- name: CHECKOUT REPOSITORY
141130
uses: actions/checkout@v4
142-
- name: MOUNT BAZEL CACHE
143-
uses: actions/[email protected]
144-
with:
145-
path: "/home/runner/repo-cache/"
146-
key: ${{ runner.os }}-repo-cache-${{ hashFiles('MODULE.bazel','WORKSPACE','bazel/bzlmod/secondary_umbrella.bzl') }}
147-
restore-keys: |
148-
${{ runner.os }}-repo-cache-
149-
save-always: true
150131
- name: CONFIGURE BAZEL
151132
run: |
152133
if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then
@@ -157,9 +138,7 @@ jobs:
157138
cat << EOF >> user.bazelrc
158139
build:buildbuddy --build_metadata=ROLE=CI
159140
build:buildbuddy --build_metadata=VISIBILITY=PUBLIC
160-
build:buildbuddy --repository_cache=/home/runner/repo-cache/
161141
build:buildbuddy --color=yes
162-
build:buildbuddy --disk_cache=
163142
EOF
164143
#! - name: Setup tmate session
165144
#! uses: mxschmitt/action-tmate@v3

0 commit comments

Comments
 (0)