From dedcac4950a06e9ca7a1c45ec8415bc5de9e6bbf Mon Sep 17 00:00:00 2001 From: Michael Klishin Date: Sun, 5 May 2024 04:32:06 -0400 Subject: [PATCH] Revert "Temporarily remove OCI workflow files entirely" This reverts commit 0ab9fbb3221d127689f8b869a9b3d56fb526b856. --- .github/workflows/oci-base.yaml | 69 ++++++++++++++++++++ .github/workflows/oci.yaml | 111 ++++++++++++++++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 .github/workflows/oci-base.yaml create mode 100644 .github/workflows/oci.yaml diff --git a/.github/workflows/oci-base.yaml b/.github/workflows/oci-base.yaml new file mode 100644 index 000000000000..e9b3200160d7 --- /dev/null +++ b/.github/workflows/oci-base.yaml @@ -0,0 +1,69 @@ +# https://github.com/marketplace/actions/build-and-push-docker-images +name: OCI Base Image +on: + schedule: + - cron: '0 3 * * *' + workflow_dispatch: +jobs: + build-publish: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v2 + with: + image: tonistiigi/binfmt:latest + platforms: linux/amd64,linux/arm64 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Available platforms + run: echo ${{ steps.buildx.outputs.platforms }} + + - name: Cache Docker layers + uses: actions/cache@v3.2.5 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-${{ matrix.image_tag_suffix }}-buildx-${{ github.event.pull_request.head.sha || github.sha }} + restore-keys: | + ${{ runner.os }}-${{ matrix.image_tag_suffix }}-buildx- + + - 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: Login to DockerHub + if: steps.authorized.outputs.PUSH == 'true' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + # - name: Build and push + # uses: docker/build-push-action@v4 + # with: + # context: packaging/base-image + # platforms: linux/amd64,linux/arm64 + # pull: true + # push: ${{ steps.authorized.outputs.PUSH }} + # tags: | + # pivotalrabbitmq/ubuntu:20.04 + # cache-from: type=local,src=/tmp/.buildx-cache + # cache-to: type=local,dest=/tmp/.buildx-cache-new + + # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache diff --git a/.github/workflows/oci.yaml b/.github/workflows/oci.yaml new file mode 100644 index 000000000000..4b4da87acc43 --- /dev/null +++ b/.github/workflows/oci.yaml @@ -0,0 +1,111 @@ +# # https://github.com/marketplace/actions/build-and-push-docker-images +# name: OCI +# on: +# push: +# paths-ignore: +# - '.github/workflows/secondary-umbrella.yaml' +# - '.github/workflows/update-elixir-patches.yaml' +# - '.github/workflows/update-otp-patches.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@v3 + +# - 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@v1 +# 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"