diff --git a/.github/workflows/rabbitmq-build.yml b/.github/workflows/rabbitmq-build.yml new file mode 100644 index 0000000..b1769de --- /dev/null +++ b/.github/workflows/rabbitmq-build.yml @@ -0,0 +1,108 @@ +name: RabbitMQ Integration Build +run-name: "Event: Tag ${{ github.event.client_payload.tag }} from ${{ github.event.client_payload.repo }} MANAGMENT_IMAGE ${{ github.event.client_payload.management_image }} #${{ github.run_number }}" + +permissions: + contents: read + packages: write + actions: read + +on: + repository_dispatch: + types: [integration-rabbit-built] + +env: + EVENT_TAG_NAME: ${{ github.event.client_payload.tag }} + EVENT_BASE_IMAGE: ${{ github.event.client_payload.base_image }} + EVENT_MANAGMENT_IMAGE: ${{ github.event.client_payload.management_image }} + EVENT_OWNER: ${{ github.event.client_payload.owner }} + EVENT_REPO: ${{ github.event.client_payload.repo }} +# TAG_NAME: ${{ github.event.release.tag_name || github.ref }} + +concurrency: + # On main/release, we don't want any jobs cancelled so the sha is used to name the group + # On PR branches, we cancel the job if new commits are pushed + # More info: https://stackoverflow.com/a/68422069/253468 + group: ${{ github.ref == 'refs/heads/main' && format('ci-main-{0}', github.sha) || format('ci-main-{0}', github.ref) }} + cancel-in-progress: true + +jobs: + multiplatform_build: + strategy: + fail-fast: false + matrix: + component: + - name: qubership-rabbitmq-integration-tests + file: operator/operator-robot-image/Dockerfile + context: operator/operator-robot-image + - name: qubership-rabbitmq-operator + file: operator/Dockerfile + context: operator + - name: qubership-rabbitmq-transfer + file: docker-transfer/Dockerfile + context: "" + - name: qubership-rabbitmq-backup-daemon + file: rabbitmq-backup-daemon/Dockerfile + context: rabbitmq-backup-daemon + - name: qubership-rabbitmq-performance-tests-image + file: performance-tests-image/Dockerfile + context: performance-tests-image + - name: qubership-rabbitmq-monitoring + file: telegraf/Dockerfile + context: telegraf + - name: qubership-rabbitmq-image + file: rabbitmq-docker/4.0/Dockerfile + context: rabbitmq-docker + - name: qubership-rabbitmq-image-3 + file: rabbitmq-docker/3.13/Dockerfile + context: rabbitmq-docker + runs-on: ubuntu-latest + steps: + - name: Check payload + run: | + echo "TAG_NAME=${{ env.EVENT_TAG_NAME }}" + echo "BASE_IMAGE=${{ env.EVENT_BASE_IMAGE }}" + echo "MANAGMENT_IMAGE=${{ env.EVENT_MANAGMENT_IMAGE }}" + echo "OWNER=${{ env.EVENT_OWNER }}" + echo "REPO_NAME=${{ env.EVENT_REPO }}" + + - 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: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${GITHUB_ACTOR} + password: ${{secrets.GITHUB_TOKEN}} + + - name: Prepare Tag + run: echo "TAG_NAME=$(echo ${TAG_NAME} | sed 's@refs/tags/@@;s@refs/heads/@@;s@/@_@g')" >> $GITHUB_ENV + + - name: Prepare Group + run: echo "GITHUB_GROUP=${GITHUB_GROUP,,}" >> $GITHUB_ENV + + - name: Get package IDs for delete + id: get-ids-for-delete + uses: Netcracker/get-package-ids@v0.0.1 + with: + component-name: ${{ matrix.component.name }} + component-tag: ${{ env.EVENT_TAG_NAME }} + access-token: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + no-cache: true + context: ${{ matrix.component.context }} + file: ${{ matrix.component.file }} + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }} + tags: ghcr.io/${{ env.EVENT_OWNER }}/${{ matrix.component.name }}:${{ env.EVENT_TAG_NAME }} + build-args: | + BASE_IMAGE=${{ env.EVENT_MANAGMENT_IMAGE }} + provenance: false diff --git a/rabbitmq-docker/4.0/Dockerfile b/rabbitmq-docker/4.0/Dockerfile index 07314fc..966a0b8 100644 --- a/rabbitmq-docker/4.0/Dockerfile +++ b/rabbitmq-docker/4.0/Dockerfile @@ -1,4 +1,6 @@ -FROM library/rabbitmq:4.1.4-management-alpine +ARG BASE_IMAGE=library/rabbitmq:4.1.4-management-alpine + +FROM ${BASE_IMAGE} COPY docker-entrypoint.sh /usr/local/bin/ COPY scripts/get_user /bin/ @@ -10,14 +12,14 @@ ENV USER_UID=1000 RUN set -x && apk upgrade --no-cache --available RUN ln -sf usr/local/bin/docker-entrypoint.sh && \ -mkdir -p /var/log/rabbitmq && \ -chmod -R 777 /var/log/rabbitmq && \ -chmod -R 777 /etc/rabbitmq && \ -chmod +x /bin/change_password && \ -chmod +x /bin/get_user && \ -chmod +x /bin/get_password && \ -chmod +x /usr/local/bin/docker-entrypoint.sh && \ -chmod -R a+r /opt/rabbitmq/plugins + mkdir -p /var/log/rabbitmq && \ + chmod -R 777 /var/log/rabbitmq && \ + chmod -R 777 /etc/rabbitmq && \ + chmod +x /bin/change_password && \ + chmod +x /bin/get_user && \ + chmod +x /bin/get_password && \ + chmod +x /usr/local/bin/docker-entrypoint.sh && \ + chmod -R a+r /opt/rabbitmq/plugins RUN rm /usr/lib/python3.12/EXTERNALLY-MANAGED