Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove rules_docker in favor of rules_oci (backport #10869) (backport #10906) (backport #11142) #11143

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ build:rbe-26 --platforms=//bazel/platforms:erlang_linux_26_platform
# no-op config so that --config=local does not error
build:local --color=auto

# having bzlmod enabled seems to interfere with docker toolchain resolution,
# so we set this flag
build --@io_bazel_rules_docker//transitions:enable=false

# Try importing a user specific .bazelrc
# You can create your own by copying and editing the template-user.bazelrc template:
# cp template-user.bazelrc user.bazelrc
Expand Down
90 changes: 36 additions & 54 deletions .github/workflows/oci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,31 @@ on:
- '.github/workflows/secondary-umbrella.yaml'
workflow_dispatch:
env:
GENERIC_UNIX_ARCHIVE: ${{ github.workspace }}/bazel-bin/package-generic-unix.tar.xz
RABBITMQ_VERSION: ${{ github.event.pull_request.head.sha || github.sha }}
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:

# This job will build one docker image per supported Erlang major version.
# Each image will have two tags (one containing the Git commit SHA, one containing the branch name).
#
# For example, for Git commit SHA '111aaa' and branch name 'main' and maximum supported Erlang major version '26',
# the following tags will be pushed to Dockerhub:
#
# * 111aaa-otp-min (image OTP 25)
# * main-otp-min (image OTP 25)
# * 111aaa-otp-max (image OTP 26)
# * main-otp-max (image OTP 26)

build-publish-dev-bazel:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- image_tag_suffix: otp-min-bazel
otp_version_id: 25_0
- image_tag_suffix: otp-max-bazel
otp_version_id: 25_3
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Mount Bazel Cache
uses: actions/cache@v4.0.2
- 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:
path: "/home/runner/repo-cache/"
key: ${{ runner.os }}-repo-cache-${{ hashFiles('MODULE.bazel','WORKSPACE','bazel/bzlmod/secondary_umbrella.bzl') }}
restore-keys: |
${{ runner.os }}-repo-cache-
otp-version: 26.2
elixir-version: 1.15

- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3

- name: Configure Bazel
run: |
Expand All @@ -57,35 +42,27 @@ jobs:
cat << EOF >> user.bazelrc
build:buildbuddy --build_metadata=ROLE=CI
build:buildbuddy --build_metadata=VISIBILITY=PRIVATE
build:buildbuddy --repository_cache=/home/runner/repo-cache/
build:buildbuddy --color=yes
build:buildbuddy --disk_cache=

build:buildbuddy --remote_download_toplevel
build --experimental_ui_max_stdouterr_bytes=4194304
build --action_env EXTRA_BUILDX_OPTS="--cache-from=type=gha --cache-to=type=gha"
EOF

- name: Configure otp for the OCI image
- name: Build amd64
run: |
sudo npm install --global --silent @bazel/buildozer

buildozer 'set tars ["@otp_src_${{ matrix.otp_version_id }}//file"]' \
//packaging/docker-image:otp_source
bazelisk build //packaging/docker-image:rabbitmq-amd64 \
--config=buildbuddy

- name: Build
- name: Build arm64
run: |
bazelisk build //packaging/docker-image:rabbitmq \
--config=rbe-${{ matrix.otp_version_id }}
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=rbe-${{ matrix.otp_version_id }}

- name: Load
run: |
bazelisk run //packaging/docker-image:rabbitmq \
--config=rbe-${{ matrix.otp_version_id }}
--config=buildbuddy

- name: Check for Push Credentials
id: authorized
Expand All @@ -96,6 +73,11 @@ jobs:
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
Expand All @@ -106,16 +88,16 @@ jobs:
- name: Tag and Push
if: steps.authorized.outputs.PUSH == 'true'
run: |
TAG_1="${{ github.event.pull_request.head.sha || github.sha }}-${{ matrix.image_tag_suffix }}"
TAG_2="${GITHUB_REF##*/}-${{ matrix.image_tag_suffix }}"
TAG_1="${{ env.VERSION }}"

docker tag bazel/packaging/docker-image:rabbitmq \
pivotalrabbitmq/rabbitmq:${TAG_1}
docker tag bazel/packaging/docker-image:rabbitmq \
pivotalrabbitmq/rabbitmq:${TAG_2}
REF_NAME="${{ github.ref_name }}"
TAG_2="${REF_NAME//\//-}"

docker push pivotalrabbitmq/rabbitmq:${TAG_1}
docker push pivotalrabbitmq/rabbitmq:${TAG_2}
set -x
bazelisk run //packaging/docker-image:push \
--config=buildbuddy -- \
--tag ${TAG_1} \
--tag ${TAG_2}

summary-oci:
needs:
Expand Down
18 changes: 4 additions & 14 deletions .github/workflows/rabbitmq_peer_discovery_aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- image_tag_suffix: otp-max-bazel
otp_version_id: 25_3
otp_version_id:
- 25_3
timeout-minutes: 45
steps:
- name: CHECKOUT REPOSITORY
Expand All @@ -18,26 +17,17 @@ jobs:
uses: lewagon/wait-on-check-action@v1.3.4
with:
ref: ${{ github.ref }}
check-name: build-publish-dev-bazel (${{ matrix.image_tag_suffix }}, ${{ matrix.otp_version_id }})
check-name: build-publish-dev-bazel
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 30 # seconds
- name: MOUNT BAZEL CACHE
uses: actions/cache@v4.0.2
with:
path: "/home/runner/repo-cache/"
key: ${{ runner.os }}-repo-cache-${{ hashFiles('MODULE.bazel','WORKSPACE','bazel/bzlmod/secondary_umbrella.bzl') }}
restore-keys: |
${{ runner.os }}-repo-cache-
- name: CONFIGURE BAZEL
run: |
cat << EOF >> user.bazelrc
build:buildbuddy --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }}

build:buildbuddy --build_metadata=ROLE=CI
build:buildbuddy --build_metadata=VISIBILITY=PRIVATE
build:buildbuddy --repository_cache=/home/runner/repo-cache/
build:buildbuddy --color=yes
build:buildbuddy --disk_cache=
EOF
#! - name: Setup tmate session
#! uses: mxschmitt/action-tmate@v3
Expand All @@ -53,6 +43,6 @@ jobs:
--build_tests_only \
--test_env AWS_ACCESS_KEY_ID=${{ secrets.CONCOURSE_AWS_ACCESS_KEY_ID }} \
--test_env AWS_SECRET_ACCESS_KEY=${{ secrets.CONCOURSE_AWS_SECRET_ACCESS_KEY }} \
--test_env RABBITMQ_IMAGE="pivotalrabbitmq/rabbitmq:${{ github.sha }}-otp-max-bazel" \
--test_env RABBITMQ_IMAGE="pivotalrabbitmq/rabbitmq:${{ github.sha }}" \
--test_env AWS_ECS_CLUSTER_NAME="rabbitmq-peer-discovery-aws-actions-${branch_or_tag//[._]/-}" \
--verbose_failures
22 changes: 2 additions & 20 deletions .github/workflows/test-authnz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,8 @@ jobs:
otp-version: ${{ matrix.erlang_version }}
elixir-version: ${{ matrix.elixir_version }}

- name: Mount Bazel Cache
uses: actions/cache@v4.0.2
with:
path: "/home/runner/repo-cache/"
key: ${{ runner.os }}-repo-cache-${{ hashFiles('MODULE.bazel','WORKSPACE','bazel/bzlmod/secondary_umbrella.bzl') }}
restore-keys: |
${{ runner.os }}-repo-cache-

- name: Configure Bazel
run: |
ERLANG_HOME="$(dirname $(dirname $(which erl)))"
ELIXIR_HOME="$(dirname $(dirname $(which iex)))"
if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then
cat << EOF >> user.bazelrc
build:buildbuddy --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }}
Expand All @@ -70,20 +60,12 @@ jobs:
cat << EOF >> user.bazelrc
build:buildbuddy --build_metadata=ROLE=CI
build:buildbuddy --build_metadata=VISIBILITY=PRIVATE
build:buildbuddy --repository_cache=/home/runner/repo-cache/
build:buildbuddy --color=yes
build:buildbuddy --disk_cache=

build:buildbuddy --remote_download_toplevel

build --@rules_erlang//:erlang_version=${{ matrix.erlang_version }}
build --@rules_erlang//:erlang_home=${ERLANG_HOME}
build --//:elixir_home=${ELIXIR_HOME}
EOF

- name: Build & Load RabbitMQ OCI
run: |
bazelisk run packaging/docker-image:rabbitmq \
bazelisk run packaging/docker-image:rabbitmq-amd64 \
--config=buildbuddy

- name: Configure Docker Network
Expand All @@ -97,7 +79,7 @@ jobs:

- name: Run Suites
run: |
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq ${SELENIUM_DIR}/run-suites.sh full-suite-authnz
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 ${SELENIUM_DIR}/run-suites.sh full-suite-authnz-messaging

- name: Upload Test Artifacts
if: always()
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/test-erlang-git.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ jobs:
steps:
- name: CHECKOUT REPOSITORY
uses: actions/checkout@v4
- name: MOUNT BAZEL CACHE
uses: actions/cache@v4.0.2
with:
path: "/home/runner/repo-cache/"
key: ${{ runner.os }}-repo-cache-${{ hashFiles('MODULE.bazel','WORKSPACE','bazel/bzlmod/secondary_umbrella.bzl') }}
restore-keys: |
${{ runner.os }}-repo-cache-
- name: CONFIGURE BAZEL
run: |
if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then
Expand All @@ -28,9 +21,7 @@ jobs:
cat << EOF >> user.bazelrc
build:buildbuddy --build_metadata=ROLE=CI
build:buildbuddy --build_metadata=VISIBILITY=PUBLIC
build:buildbuddy --repository_cache=/home/runner/repo-cache/
build:buildbuddy --color=yes
build:buildbuddy --disk_cache=

build:rbe --platforms=//bazel/platforms:erlang_git_master_platform
build:rbe --extra_execution_platforms=//bazel/platforms:erlang_git_master_platform
Expand Down
19 changes: 0 additions & 19 deletions .github/workflows/test-mixed-versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@ jobs:
with:
ref: v${{ steps.check.outputs.version }}
path: secondary-umbrella
- name: MOUNT BAZEL CACHE
if: env.exists != 'true'
uses: actions/cache@v4.0.2
with:
path: "/home/runner/repo-cache/"
key: repo-cache-secondary-umbrella-${{ hashFiles('primary-umbrella/MODULE.bazel','primary-umbrella/WORKSPACE','primary-umbrella/bazel/bzlmod/secondary_umbrella.bzl') }}
restore-keys: |
repo-cache-secondary-umbrella-
- name: BUILD SECONDARY UMBRELLA ARCHIVE
if: env.exists != 'true'
working-directory: secondary-umbrella
Expand All @@ -90,9 +82,7 @@ jobs:
build:buildbuddy --build_metadata=ROLE=CI
build:buildbuddy --build_metadata=VISIBILITY=PRIVATE
build:buildbuddy --remote_instance_name=buildbuddy-io/buildbuddy/ci-secondary-umbrella
build:buildbuddy --repository_cache=/home/runner/repo-cache/
build:buildbuddy --color=yes
build:buildbuddy --disk_cache=

build:buildbuddy --remote_download_toplevel
EOF
Expand Down Expand Up @@ -134,13 +124,6 @@ jobs:
steps:
- name: CHECKOUT REPOSITORY
uses: actions/checkout@v4
- name: MOUNT BAZEL CACHE
uses: actions/cache@v4.0.2
with:
path: "/home/runner/repo-cache/"
key: ${{ runner.os }}-repo-cache-${{ hashFiles('MODULE.bazel','WORKSPACE','bazel/bzlmod/secondary_umbrella.bzl') }}
restore-keys: |
${{ runner.os }}-repo-cache-
- name: CONFIGURE BAZEL
run: |
if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then
Expand All @@ -151,9 +134,7 @@ jobs:
cat << EOF >> user.bazelrc
build:buildbuddy --build_metadata=ROLE=CI
build:buildbuddy --build_metadata=VISIBILITY=PUBLIC
build:buildbuddy --repository_cache=/home/runner/repo-cache/
build:buildbuddy --color=yes
build:buildbuddy --disk_cache=
EOF
#! - name: Setup tmate session
#! uses: mxschmitt/action-tmate@v3
Expand Down
22 changes: 2 additions & 20 deletions .github/workflows/test-selenium.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,8 @@ jobs:
otp-version: ${{ matrix.erlang_version }}
elixir-version: ${{ matrix.elixir_version }}

- name: Mount Bazel Cache
uses: actions/cache@v4.0.2
with:
path: "/home/runner/repo-cache/"
key: ${{ runner.os }}-repo-cache-${{ hashFiles('MODULE.bazel','WORKSPACE','bazel/bzlmod/secondary_umbrella.bzl') }}
restore-keys: |
${{ runner.os }}-repo-cache-

- name: Configure Bazel
run: |
ERLANG_HOME="$(dirname $(dirname $(which erl)))"
ELIXIR_HOME="$(dirname $(dirname $(which iex)))"
if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then
cat << EOF >> user.bazelrc
build:buildbuddy --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_API_KEY }}
Expand All @@ -69,20 +59,12 @@ jobs:
cat << EOF >> user.bazelrc
build:buildbuddy --build_metadata=ROLE=CI
build:buildbuddy --build_metadata=VISIBILITY=PRIVATE
build:buildbuddy --repository_cache=/home/runner/repo-cache/
build:buildbuddy --color=yes
build:buildbuddy --disk_cache=

build:buildbuddy --remote_download_toplevel

build --@rules_erlang//:erlang_version=${{ matrix.erlang_version }}
build --@rules_erlang//:erlang_home=${ERLANG_HOME}
build --//:elixir_home=${ELIXIR_HOME}
EOF

- name: Build & Load RabbitMQ OCI
run: |
bazelisk run packaging/docker-image:rabbitmq \
bazelisk run packaging/docker-image:rabbitmq-amd64 \
--config=buildbuddy

- name: Configure Docker Network
Expand All @@ -96,7 +78,7 @@ jobs:

- name: Run Suites
run: |
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq ${SELENIUM_DIR}/run-suites.sh
RABBITMQ_DOCKER_IMAGE=bazel/packaging/docker-image:rabbitmq-amd64 ${SELENIUM_DIR}/run-suites.sh

- name: Upload Test Artifacts
if: always()
Expand Down
9 changes: 0 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ jobs:
steps:
- name: CHECKOUT REPOSITORY
uses: actions/checkout@v4
- name: MOUNT BAZEL CACHE
uses: actions/cache@v4.0.2
with:
path: "/home/runner/repo-cache/"
key: ${{ runner.os }}-repo-cache-${{ hashFiles('MODULE.bazel','WORKSPACE','bazel/bzlmod/secondary_umbrella.bzl') }}
restore-keys: |
${{ runner.os }}-repo-cache-
- name: CONFIGURE BAZEL
run: |
if [ -n "${{ secrets.BUILDBUDDY_API_KEY }}" ]; then
Expand All @@ -57,9 +50,7 @@ jobs:
cat << EOF >> user.bazelrc
build:buildbuddy --build_metadata=ROLE=CI
build:buildbuddy --build_metadata=VISIBILITY=PUBLIC
build:buildbuddy --repository_cache=/home/runner/repo-cache/
build:buildbuddy --color=yes
build:buildbuddy --disk_cache=
EOF

bazelisk info release
Expand Down
Loading
Loading