From 093c7310a6eb8f5cd7d9f7634923955650443b86 Mon Sep 17 00:00:00 2001 From: Prowler Bot Date: Wed, 26 Nov 2025 10:18:06 +0100 Subject: [PATCH] chore(github): fix container actions (#9323) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: César Arroba <19954079+cesararroba@users.noreply.github.com> --- .../workflows/api-container-build-push.yml | 41 +++++++----- .../workflows/mcp-container-build-push.yml | 49 ++++++++------- .../workflows/sdk-container-build-push.yml | 41 +++++++----- .github/workflows/ui-container-build-push.yml | 63 +++++++++---------- 4 files changed, 104 insertions(+), 90 deletions(-) diff --git a/.github/workflows/api-container-build-push.yml b/.github/workflows/api-container-build-push.yml index 3b3b4a4222..4660dab71f 100644 --- a/.github/workflows/api-container-build-push.yml +++ b/.github/workflows/api-container-build-push.yml @@ -11,6 +11,12 @@ on: release: types: - 'published' + workflow_dispatch: + inputs: + release_tag: + description: 'Release tag (e.g., 5.14.0)' + required: true + type: string permissions: contents: read @@ -22,7 +28,7 @@ concurrency: env: # Tags LATEST_TAG: latest - RELEASE_TAG: ${{ github.event.release.tag_name }} + RELEASE_TAG: ${{ github.event.release.tag_name || inputs.release_tag }} STABLE_TAG: stable WORKING_DIRECTORY: ./api @@ -72,20 +78,8 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 - - name: Build and push API container for ${{ matrix.arch }} - if: github.event_name == 'push' || github.event_name == 'release' - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 - with: - context: ${{ env.WORKING_DIRECTORY }} - push: true - platforms: ${{ matrix.platform }} - tags: | - ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short-sha }}-${{ matrix.arch }} - cache-from: type=gha,scope=${{ matrix.arch }} - cache-to: type=gha,mode=max,scope=${{ matrix.arch }} - - name: Notify container push started - if: github.event_name == 'release' + if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' uses: ./.github/actions/slack-notification env: SLACK_CHANNEL_ID: ${{ secrets.SLACK_PLATFORM_DEPLOYMENTS }} @@ -98,8 +92,21 @@ jobs: slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} payload-file-path: "./.github/scripts/slack-messages/container-release-started.json" + - name: Build and push API container for ${{ matrix.arch }} + id: container-push + if: github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 + with: + context: ${{ env.WORKING_DIRECTORY }} + push: true + platforms: ${{ matrix.platform }} + tags: | + ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short-sha }}-${{ matrix.arch }} + cache-from: type=gha,scope=${{ matrix.arch }} + cache-to: type=gha,mode=max,scope=${{ matrix.arch }} + - name: Notify container push completed - if: github.event_name == 'release' && always() + if: (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && always() uses: ./.github/actions/slack-notification env: SLACK_CHANNEL_ID: ${{ secrets.SLACK_PLATFORM_DEPLOYMENTS }} @@ -116,7 +123,7 @@ jobs: # Create and push multi-architecture manifest create-manifest: needs: [setup, container-build-push] - if: github.event_name == 'push' || github.event_name == 'release' + if: github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest steps: @@ -139,7 +146,7 @@ jobs: ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short-sha }}-arm64 - name: Create and push manifests for release event - if: github.event_name == 'release' + if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' run: | docker buildx imagetools create \ -t ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.RELEASE_TAG }} \ diff --git a/.github/workflows/mcp-container-build-push.yml b/.github/workflows/mcp-container-build-push.yml index 27bc3e84e0..b635db1031 100644 --- a/.github/workflows/mcp-container-build-push.yml +++ b/.github/workflows/mcp-container-build-push.yml @@ -10,6 +10,12 @@ on: release: types: - 'published' + workflow_dispatch: + inputs: + release_tag: + description: 'Release tag (e.g., 5.14.0)' + required: true + type: string permissions: contents: read @@ -21,7 +27,7 @@ concurrency: env: # Tags LATEST_TAG: latest - RELEASE_TAG: ${{ github.event.release.tag_name }} + RELEASE_TAG: ${{ github.event.release.tag_name || inputs.release_tag }} STABLE_TAG: stable WORKING_DIRECTORY: ./mcp_server @@ -43,7 +49,7 @@ jobs: container-build-push: needs: setup - runs-on: ${{ matrix.runner }} + runs-on: ${{ matrix.runner }} strategy: matrix: include: @@ -70,8 +76,23 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 + - name: Notify container push started + if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' + uses: ./.github/actions/slack-notification + env: + SLACK_CHANNEL_ID: ${{ secrets.SLACK_PLATFORM_DEPLOYMENTS }} + COMPONENT: MCP + RELEASE_TAG: ${{ env.RELEASE_TAG }} + GITHUB_SERVER_URL: ${{ github.server_url }} + GITHUB_REPOSITORY: ${{ github.repository }} + GITHUB_RUN_ID: ${{ github.run_id }} + with: + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + payload-file-path: "./.github/scripts/slack-messages/container-release-started.json" + - name: Build and push MCP container for ${{ matrix.arch }} - if: github.event_name == 'push' || github.event_name == 'release' + id: container-push + if: github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 with: context: ${{ env.WORKING_DIRECTORY }} @@ -90,22 +111,8 @@ jobs: cache-from: type=gha,scope=${{ matrix.arch }} cache-to: type=gha,mode=max,scope=${{ matrix.arch }} - - name: Notify container push started - if: github.event_name == 'release' - uses: ./.github/actions/slack-notification - env: - SLACK_CHANNEL_ID: ${{ secrets.SLACK_PLATFORM_DEPLOYMENTS }} - COMPONENT: MCP - RELEASE_TAG: ${{ env.RELEASE_TAG }} - GITHUB_SERVER_URL: ${{ github.server_url }} - GITHUB_REPOSITORY: ${{ github.repository }} - GITHUB_RUN_ID: ${{ github.run_id }} - with: - slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} - payload-file-path: "./.github/scripts/slack-messages/container-release-started.json" - - name: Notify container push completed - if: github.event_name == 'release' && always() + if: (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && always() uses: ./.github/actions/slack-notification env: SLACK_CHANNEL_ID: ${{ secrets.SLACK_PLATFORM_DEPLOYMENTS }} @@ -122,7 +129,7 @@ jobs: # Create and push multi-architecture manifest create-manifest: needs: [setup, container-build-push] - if: github.event_name == 'push' || github.event_name == 'release' + if: github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest steps: @@ -145,14 +152,14 @@ jobs: ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short-sha }}-arm64 - name: Create and push manifests for release event - if: github.event_name == 'release' + if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' run: | docker buildx imagetools create \ -t ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.RELEASE_TAG }} \ -t ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.STABLE_TAG }} \ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short-sha }}-amd64 \ ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short-sha }}-arm64 - + - name: Install regctl if: always() uses: regclient/actions/regctl-installer@main diff --git a/.github/workflows/sdk-container-build-push.yml b/.github/workflows/sdk-container-build-push.yml index 3c9695c9b7..c6ad6ba0bd 100644 --- a/.github/workflows/sdk-container-build-push.yml +++ b/.github/workflows/sdk-container-build-push.yml @@ -16,6 +16,12 @@ on: release: types: - 'published' + workflow_dispatch: + inputs: + release_tag: + description: 'Release tag (e.g., 5.14.0)' + required: true + type: string permissions: contents: read @@ -141,21 +147,8 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 - - name: Build and push SDK container for ${{ matrix.arch }} - if: github.event_name == 'push' || github.event_name == 'release' - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 - with: - context: . - file: ${{ env.DOCKERFILE_PATH }} - push: true - platforms: ${{ matrix.platform }} - tags: | - ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.LATEST_TAG }}-${{ matrix.arch }} - cache-from: type=gha,scope=${{ matrix.arch }} - cache-to: type=gha,mode=max,scope=${{ matrix.arch }} - - name: Notify container push started - if: github.event_name == 'release' + if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' uses: ./.github/actions/slack-notification env: SLACK_CHANNEL_ID: ${{ secrets.SLACK_PLATFORM_DEPLOYMENTS }} @@ -168,8 +161,22 @@ jobs: slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} payload-file-path: "./.github/scripts/slack-messages/container-release-started.json" + - name: Build and push SDK container for ${{ matrix.arch }} + id: container-push + if: github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 + with: + context: . + file: ${{ env.DOCKERFILE_PATH }} + push: true + platforms: ${{ matrix.platform }} + tags: | + ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.LATEST_TAG }}-${{ matrix.arch }} + cache-from: type=gha,scope=${{ matrix.arch }} + cache-to: type=gha,mode=max,scope=${{ matrix.arch }} + - name: Notify container push completed - if: github.event_name == 'release' && always() + if: (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && always() uses: ./.github/actions/slack-notification env: SLACK_CHANNEL_ID: ${{ secrets.SLACK_PLATFORM_DEPLOYMENTS }} @@ -186,7 +193,7 @@ jobs: # Create and push multi-architecture manifest create-manifest: needs: [container-build-push] - if: github.event_name == 'push' || github.event_name == 'release' + if: github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest steps: @@ -219,7 +226,7 @@ jobs: ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.container-build-push.outputs.latest_tag }}-arm64 - name: Create and push manifests for release event - if: github.event_name == 'release' + if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' run: | docker buildx imagetools create \ -t ${{ secrets.DOCKER_HUB_REPOSITORY }}/${{ env.IMAGE_NAME }}:${{ needs.container-build-push.outputs.prowler_version }} \ diff --git a/.github/workflows/ui-container-build-push.yml b/.github/workflows/ui-container-build-push.yml index 34cddc900d..8211ba24e3 100644 --- a/.github/workflows/ui-container-build-push.yml +++ b/.github/workflows/ui-container-build-push.yml @@ -10,6 +10,12 @@ on: release: types: - 'published' + workflow_dispatch: + inputs: + release_tag: + description: 'Release tag (e.g., 5.14.0)' + required: true + type: string permissions: contents: read @@ -21,7 +27,7 @@ concurrency: env: # Tags LATEST_TAG: latest - RELEASE_TAG: ${{ github.event.release.tag_name }} + RELEASE_TAG: ${{ github.event.release.tag_name || inputs.release_tag }} STABLE_TAG: stable WORKING_DIRECTORY: ./ui @@ -46,7 +52,7 @@ jobs: container-build-push: needs: setup - runs-on: ${{ matrix.runner }} + runs-on: ${{ matrix.runner }} strategy: matrix: include: @@ -74,37 +80,8 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 - - name: Build and push UI container for ${{ matrix.arch }} - if: github.event_name == 'push' - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 - with: - context: ${{ env.WORKING_DIRECTORY }} - build-args: | - NEXT_PUBLIC_PROWLER_RELEASE_VERSION=${{ needs.setup.outputs.short-sha }} - NEXT_PUBLIC_API_BASE_URL=${{ env.NEXT_PUBLIC_API_BASE_URL }} - push: true - platforms: ${{ matrix.platform }} - tags: | - ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short-sha }}-${{ matrix.arch }} - cache-from: type=gha,scope=${{ matrix.arch }} - cache-to: type=gha,mode=max,scope=${{ matrix.arch }} - - - name: Build and push UI container for ${{ matrix.arch }} - if: github.event_name == 'push' || github.event_name == 'release' - uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 - with: - context: ${{ env.WORKING_DIRECTORY }} - build-args: | - NEXT_PUBLIC_PROWLER_RELEASE_VERSION=${{ github.event_name == 'release' && format('v{0}', env.RELEASE_TAG) || needs.setup.outputs.short_sha }} - NEXT_PUBLIC_API_BASE_URL=${{ env.NEXT_PUBLIC_API_BASE_URL }} - push: true - tags: | - ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short-sha }} - cache-from: type=gha - cache-to: type=gha,mode=max - - name: Notify container push started - if: github.event_name == 'release' + if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' uses: ./.github/actions/slack-notification env: SLACK_CHANNEL_ID: ${{ secrets.SLACK_PLATFORM_DEPLOYMENTS }} @@ -117,8 +94,24 @@ jobs: slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} payload-file-path: "./.github/scripts/slack-messages/container-release-started.json" + - name: Build and push UI container for ${{ matrix.arch }} + id: container-push + if: github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 + with: + context: ${{ env.WORKING_DIRECTORY }} + build-args: | + NEXT_PUBLIC_PROWLER_RELEASE_VERSION=${{ (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && format('v{0}', env.RELEASE_TAG) || needs.setup.outputs.short-sha }} + NEXT_PUBLIC_API_BASE_URL=${{ env.NEXT_PUBLIC_API_BASE_URL }} + push: true + platforms: ${{ matrix.platform }} + tags: | + ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short-sha }}-${{ matrix.arch }} + cache-from: type=gha,scope=${{ matrix.arch }} + cache-to: type=gha,mode=max,scope=${{ matrix.arch }} + - name: Notify container push completed - if: github.event_name == 'release' && always() + if: (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && always() uses: ./.github/actions/slack-notification env: SLACK_CHANNEL_ID: ${{ secrets.SLACK_PLATFORM_DEPLOYMENTS }} @@ -135,7 +128,7 @@ jobs: # Create and push multi-architecture manifest create-manifest: needs: [setup, container-build-push] - if: github.event_name == 'push' || github.event_name == 'release' + if: github.event_name == 'push' || github.event_name == 'release' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest steps: @@ -158,7 +151,7 @@ jobs: ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ needs.setup.outputs.short-sha }}-arm64 - name: Create and push manifests for release event - if: github.event_name == 'release' + if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' run: | docker buildx imagetools create \ -t ${{ env.PROWLERCLOUD_DOCKERHUB_REPOSITORY }}/${{ env.PROWLERCLOUD_DOCKERHUB_IMAGE }}:${{ env.RELEASE_TAG }} \