From 3e00e57f0d7b07df3133e2a3dea80886f8ff1c40 Mon Sep 17 00:00:00 2001 From: Joren Vandeweyer Date: Thu, 17 Sep 2026 11:44:43 +0200 Subject: [PATCH 1/2] Support multiple serverless container redeploys --- .../serverless-container/redeploy/action.yml | 20 ++++++-- .github/workflows/docker-build-and-deploy.yml | 46 +++++++++---------- Docs/docker-build-and-deploy.md | 7 ++- 3 files changed, 43 insertions(+), 30 deletions(-) diff --git a/.github/actions/infra/serverless-container/redeploy/action.yml b/.github/actions/infra/serverless-container/redeploy/action.yml index 25b40dd..200a280 100644 --- a/.github/actions/infra/serverless-container/redeploy/action.yml +++ b/.github/actions/infra/serverless-container/redeploy/action.yml @@ -1,12 +1,12 @@ --- name: Serverless Container Redeploy -description: Trigger a redeploy on a Serverless Container +description: Trigger a redeploy on one or more Serverless Containers inputs: vendor: description: The vendor to communicate with (azure, digitalocean, scaleway) required: true container-id: - description: Target Scaleway Serverless container ID + description: Target Scaleway Serverless container IDs (comma separated) required: true # Vendor: Azure azure-client-id: @@ -62,15 +62,25 @@ runs: - name: Trigger redeploy shell: bash + env: + CONTAINER_IDS: ${{ inputs.container-id }} + SCALEWAY_REGION: ${{ inputs.scaleway-region }} + VENDOR: ${{ inputs.vendor }} run: | set -euo pipefail - case "${{ inputs.vendor }}" in + case "$VENDOR" in scaleway) - scw container container redeploy "${{ inputs.container-id }}" region="${{ inputs.scaleway-region }}" + container_ids_input="${CONTAINER_IDS//,/ }" + read -r -a container_ids <<< "$container_ids_input" + + for container_id in "${container_ids[@]}"; do + echo "Redeploying Serverless Container: $container_id" + scw container container redeploy "$container_id" region="$SCALEWAY_REGION" + done ;; *) - echo "Unsupported vendor '${{ inputs.vendor }}'" + echo "Unsupported vendor '$VENDOR'" exit 1 ;; esac diff --git a/.github/workflows/docker-build-and-deploy.yml b/.github/workflows/docker-build-and-deploy.yml index 37d1152..2d95d5c 100644 --- a/.github/workflows/docker-build-and-deploy.yml +++ b/.github/workflows/docker-build-and-deploy.yml @@ -17,6 +17,7 @@ on: # - RUNNER_DEFAULT # - RUNNER_INFRA # - SERVERLESS_CONTAINER_ID + # - SERVERLESS_CONTAINER_IDS # For Azure vendor: # - AZURE_RESOURCE_GROUP # For DigitalOcean vendor: @@ -178,12 +179,31 @@ jobs: scaleway-project-id: ${{ vars.SCALEWAY_PROJECT_ID }} scaleway-region: ${{ vars.SCALEWAY_REGION }} scaleway-secret-key: ${{ secrets.SCALEWAY_SECRET_KEY }} - - name: Redeploy Serverless Container - if: ${{ vars.SERVERLESS_CONTAINER_ID }} + - name: Deployment summary + if: ${{ vars.K8S_CLUSTER_ID }} + run: | + { + echo "## Docker build & deploy" + echo "" + echo "- Image: \`${{ env.tags }}\`" + echo "- Vendor: \`${{ inputs.vendor }}\`" + if [ -n "${{ vars.K8S_CLUSTER_ID }}" ]; then + echo "- Cluster: \`${{ vars.K8S_CLUSTER_ID }}\`" + fi + } >> "$GITHUB_STEP_SUMMARY" + + redeploy-serverless-containers: + name: Redeploy Serverless Containers + needs: [build-and-deploy] + runs-on: ${{ vars.RUNNER_INFRA || 'ubuntu-latest' }} + environment: ${{ inputs.environment }} + steps: + - name: Redeploy Serverless Containers + if: ${{ vars.SERVERLESS_CONTAINER_IDS || vars.SERVERLESS_CONTAINER_ID }} uses: wisemen-digital/devops-github-actions/.github/actions/infra/serverless-container/redeploy@v1 with: vendor: ${{ inputs.vendor }} - container-id: ${{ vars.SERVERLESS_CONTAINER_ID }} + container-id: ${{ vars.SERVERLESS_CONTAINER_IDS || vars.SERVERLESS_CONTAINER_ID }} # Vendor: azure azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} @@ -196,23 +216,3 @@ jobs: scaleway-project-id: ${{ vars.SCALEWAY_PROJECT_ID }} scaleway-region: ${{ vars.SCALEWAY_REGION }} scaleway-secret-key: ${{ secrets.SCALEWAY_SECRET_KEY }} - - name: Deployment summary - if: ${{ vars.K8S_CLUSTER_ID && !vars.SERVERLESS_CONTAINER_ID }} - run: | - if [[ -z "${{ vars.K8S_CLUSTER_ID }}" && -z "${{ vars.SERVERLESS_CONTAINER_ID }}" ]]; then - echo "::error title=MISSING TARGET::No k8s cluster or serverless container provided!" - exit 1 - fi - - { - echo "## Docker build & deploy" - echo "" - echo "- Image: \`${{ env.tags }}\`" - echo "- Vendor: \`${{ inputs.vendor }}\`" - if [ -n "${{ vars.K8S_CLUSTER_ID }}" ]; then - echo "- Cluster: \`${{ vars.K8S_CLUSTER_ID }}\`" - fi - if [ -n "${{ vars.SERVERLESS_CONTAINER_ID }}" ]; then - echo "- Container: \`${{ vars.SERVERLESS_CONTAINER_ID }}\`" - fi - } >> "$GITHUB_STEP_SUMMARY" diff --git a/Docs/docker-build-and-deploy.md b/Docs/docker-build-and-deploy.md index d4bfc03..cf1d9c2 100644 --- a/Docs/docker-build-and-deploy.md +++ b/Docs/docker-build-and-deploy.md @@ -10,7 +10,9 @@ A rollout on a cluster in the given namespace. If kubernetes labels are provided ### Serverless Container Redeploy -A redeploy on an existing Serverless Container. It does not create or update the Serverless Container configuration. The target container must already exist and already be configured to pull the image tag that this workflow publishes. +A redeploy on one or more existing Serverless Containers. Serverless redeploys start after all image variants have been built and pushed. The workflow does not create or update Serverless Container configuration. Every target container must already exist and already be configured to pull an image tag that this workflow publishes. + +For multiple containers, set `SERVERLESS_CONTAINER_IDS` to a comma-separated value such as `web-container-id,api-container-id`. ## Inputs @@ -37,7 +39,8 @@ These are always available, regardless of vendor: | `K8S_NAMESPACE` | Target cluster namespace | Variable | Yes | | `RUNNER_DEFAULT` | The CI runner for default actions. Defaults to `ubuntu-latest` | Variable | No | | `RUNNER_INFRA` | The CI runner for infra actions. Defaults to `ubuntu-latest` | Variable | No | -| `SERVERLESS_CONTAINER_ID` | Target Serverless Container ID to redeploy | Variable | No | +| `SERVERLESS_CONTAINER_ID` | Target Serverless Container ID to redeploy (legacy single-container variable) | Variable | No | +| `SERVERLESS_CONTAINER_IDS` | Target Serverless Container IDs to redeploy, separated by commas. Takes precedence over `SERVERLESS_CONTAINER_ID` | Variable | No | ### Vendor-Specific Inputs From 0939c6acb2ab5c51a679e9f1a6a9446b1bbed719 Mon Sep 17 00:00:00 2001 From: Joren Vandeweyer Date: Wed, 23 Sep 2026 16:13:22 +0200 Subject: [PATCH 2/2] Address serverless redeploy review feedback --- .../serverless-container/redeploy/action.yml | 19 +++---- .../serverless-container/setup/action.yml | 3 -- .github/workflows/docker-build-and-deploy.yml | 49 ++++++++++--------- .../docker-promote-to-environment.yml | 21 +++++--- Docs/docker-build-and-deploy.md | 5 +- Docs/docker-promote-to-environment.md | 6 ++- 6 files changed, 52 insertions(+), 51 deletions(-) diff --git a/.github/actions/infra/serverless-container/redeploy/action.yml b/.github/actions/infra/serverless-container/redeploy/action.yml index 200a280..52a94f3 100644 --- a/.github/actions/infra/serverless-container/redeploy/action.yml +++ b/.github/actions/infra/serverless-container/redeploy/action.yml @@ -5,7 +5,7 @@ inputs: vendor: description: The vendor to communicate with (azure, digitalocean, scaleway) required: true - container-id: + container-ids: description: Target Scaleway Serverless container IDs (comma separated) required: true # Vendor: Azure @@ -46,7 +46,6 @@ runs: - uses: wisemen-digital/devops-github-actions/.github/actions/infra/serverless-container/setup@v1 with: vendor: ${{ inputs.vendor }} - container-id: ${{ inputs.container-id }} # Vendor: azure azure-client-id: ${{ inputs.azure-client-id }} azure-tenant-id: ${{ inputs.azure-tenant-id }} @@ -62,25 +61,19 @@ runs: - name: Trigger redeploy shell: bash - env: - CONTAINER_IDS: ${{ inputs.container-id }} - SCALEWAY_REGION: ${{ inputs.scaleway-region }} - VENDOR: ${{ inputs.vendor }} run: | set -euo pipefail - case "$VENDOR" in + case "${{ inputs.vendor }}" in scaleway) - container_ids_input="${CONTAINER_IDS//,/ }" - read -r -a container_ids <<< "$container_ids_input" - - for container_id in "${container_ids[@]}"; do + container_ids="${{ inputs.container-ids }}" + for container_id in ${container_ids//,/ }; do echo "Redeploying Serverless Container: $container_id" - scw container container redeploy "$container_id" region="$SCALEWAY_REGION" + scw container container redeploy "$container_id" region="${{ inputs.scaleway-region }}" done ;; *) - echo "Unsupported vendor '$VENDOR'" + echo "Unsupported vendor '${{ inputs.vendor }}'" exit 1 ;; esac diff --git a/.github/actions/infra/serverless-container/setup/action.yml b/.github/actions/infra/serverless-container/setup/action.yml index d6cb9b6..647aa77 100644 --- a/.github/actions/infra/serverless-container/setup/action.yml +++ b/.github/actions/infra/serverless-container/setup/action.yml @@ -5,9 +5,6 @@ inputs: vendor: description: The vendor to communicate with (azure, digitalocean, scaleway) required: true - container-id: - description: Target Scaleway Serverless container ID - required: true # Vendor: Azure azure-client-id: description: Azure client ID for login with an Azure service principal diff --git a/.github/workflows/docker-build-and-deploy.yml b/.github/workflows/docker-build-and-deploy.yml index 2d95d5c..0832f8a 100644 --- a/.github/workflows/docker-build-and-deploy.yml +++ b/.github/workflows/docker-build-and-deploy.yml @@ -16,7 +16,6 @@ on: # - K8S_NAMESPACE # - RUNNER_DEFAULT # - RUNNER_INFRA - # - SERVERLESS_CONTAINER_ID # - SERVERLESS_CONTAINER_IDS # For Azure vendor: # - AZURE_RESOURCE_GROUP @@ -100,6 +99,11 @@ jobs: # Vendor: scaleway scaleway-access-key: ${{ secrets.SCALEWAY_ACCESS_KEY }} scaleway-secret-key: ${{ secrets.SCALEWAY_SECRET_KEY }} + - name: Check obsolete variables + if: ${{ vars.SERVERLESS_CONTAINER_ID }} + run: | + echo "::error title=OBSOLETE VARIABLE::SERVERLESS_CONTAINER_ID is obsolete. Use SERVERLESS_CONTAINER_IDS instead." + exit 1 build-and-deploy: name: Build & Deploy ${{ matrix.variant.path }} to ${{ inputs.environment }} @@ -179,31 +183,12 @@ jobs: scaleway-project-id: ${{ vars.SCALEWAY_PROJECT_ID }} scaleway-region: ${{ vars.SCALEWAY_REGION }} scaleway-secret-key: ${{ secrets.SCALEWAY_SECRET_KEY }} - - name: Deployment summary - if: ${{ vars.K8S_CLUSTER_ID }} - run: | - { - echo "## Docker build & deploy" - echo "" - echo "- Image: \`${{ env.tags }}\`" - echo "- Vendor: \`${{ inputs.vendor }}\`" - if [ -n "${{ vars.K8S_CLUSTER_ID }}" ]; then - echo "- Cluster: \`${{ vars.K8S_CLUSTER_ID }}\`" - fi - } >> "$GITHUB_STEP_SUMMARY" - - redeploy-serverless-containers: - name: Redeploy Serverless Containers - needs: [build-and-deploy] - runs-on: ${{ vars.RUNNER_INFRA || 'ubuntu-latest' }} - environment: ${{ inputs.environment }} - steps: - name: Redeploy Serverless Containers - if: ${{ vars.SERVERLESS_CONTAINER_IDS || vars.SERVERLESS_CONTAINER_ID }} + if: ${{ vars.SERVERLESS_CONTAINER_IDS }} uses: wisemen-digital/devops-github-actions/.github/actions/infra/serverless-container/redeploy@v1 with: vendor: ${{ inputs.vendor }} - container-id: ${{ vars.SERVERLESS_CONTAINER_IDS || vars.SERVERLESS_CONTAINER_ID }} + container-ids: ${{ vars.SERVERLESS_CONTAINER_IDS }} # Vendor: azure azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} @@ -216,3 +201,23 @@ jobs: scaleway-project-id: ${{ vars.SCALEWAY_PROJECT_ID }} scaleway-region: ${{ vars.SCALEWAY_REGION }} scaleway-secret-key: ${{ secrets.SCALEWAY_SECRET_KEY }} + - name: Deployment summary + if: ${{ vars.K8S_CLUSTER_ID && !vars.SERVERLESS_CONTAINER_IDS }} + run: | + if [[ -z "${{ vars.K8S_CLUSTER_ID }}" && -z "${{ vars.SERVERLESS_CONTAINER_IDS }}" ]]; then + echo "::error title=MISSING TARGET::No k8s cluster or serverless container provided!" + exit 1 + fi + + { + echo "## Docker build & deploy" + echo "" + echo "- Image: \`${{ env.tags }}\`" + echo "- Vendor: \`${{ inputs.vendor }}\`" + if [ -n "${{ vars.K8S_CLUSTER_ID }}" ]; then + echo "- Cluster: \`${{ vars.K8S_CLUSTER_ID }}\`" + fi + if [ -n "${{ vars.SERVERLESS_CONTAINER_IDS }}" ]; then + echo "- Containers: \`${{ vars.SERVERLESS_CONTAINER_IDS }}\`" + fi + } >> "$GITHUB_STEP_SUMMARY" diff --git a/.github/workflows/docker-promote-to-environment.yml b/.github/workflows/docker-promote-to-environment.yml index 6aede28..8536eed 100644 --- a/.github/workflows/docker-promote-to-environment.yml +++ b/.github/workflows/docker-promote-to-environment.yml @@ -15,7 +15,7 @@ on: # - K8S_NAMESPACE # - RUNNER_DEFAULT # - RUNNER_INFRA - # - SERVERLESS_CONTAINER_ID + # - SERVERLESS_CONTAINER_IDS # For Azure vendor: # - AZURE_RESOURCE_GROUP # For DigitalOcean vendor: @@ -115,6 +115,11 @@ jobs: # Vendor: scaleway scaleway-access-key: ${{ secrets.SCALEWAY_ACCESS_KEY }} scaleway-secret-key: ${{ secrets.SCALEWAY_SECRET_KEY }} + - name: Check obsolete variables + if: ${{ vars.SERVERLESS_CONTAINER_ID }} + run: | + echo "::error title=OBSOLETE VARIABLE::SERVERLESS_CONTAINER_ID is obsolete. Use SERVERLESS_CONTAINER_IDS instead." + exit 1 - name: Calculate source id: gen-source run: | @@ -203,12 +208,12 @@ jobs: scaleway-project-id: ${{ vars.SCALEWAY_PROJECT_ID }} scaleway-region: ${{ vars.SCALEWAY_REGION }} scaleway-secret-key: ${{ secrets.SCALEWAY_SECRET_KEY }} - - name: Redeploy Serverless Container - if: ${{ vars.SERVERLESS_CONTAINER_ID }} + - name: Redeploy Serverless Containers + if: ${{ vars.SERVERLESS_CONTAINER_IDS }} uses: wisemen-digital/devops-github-actions/.github/actions/infra/serverless-container/redeploy@v1 with: vendor: ${{ inputs.vendor }} - container-id: ${{ vars.SERVERLESS_CONTAINER_ID }} + container-ids: ${{ vars.SERVERLESS_CONTAINER_IDS }} # Vendor: azure azure-client-id: ${{ secrets.AZURE_CLIENT_ID }} azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }} @@ -222,9 +227,9 @@ jobs: scaleway-region: ${{ vars.SCALEWAY_REGION }} scaleway-secret-key: ${{ secrets.SCALEWAY_SECRET_KEY }} - name: Deployment summary - if: ${{ vars.K8S_CLUSTER_ID && !vars.SERVERLESS_CONTAINER_ID }} + if: ${{ vars.K8S_CLUSTER_ID && !vars.SERVERLESS_CONTAINER_IDS }} run: | - if [[ -z "${{ vars.K8S_CLUSTER_ID }}" && -z "${{ vars.SERVERLESS_CONTAINER_ID }}" ]]; then + if [[ -z "${{ vars.K8S_CLUSTER_ID }}" && -z "${{ vars.SERVERLESS_CONTAINER_IDS }}" ]]; then echo "::error title=MISSING TARGET::No k8s cluster or serverless container provided!" exit 1 fi @@ -237,8 +242,8 @@ jobs: if [ -n "${{ vars.K8S_CLUSTER_ID }}" ]; then echo "- Cluster: \`${{ vars.K8S_CLUSTER_ID }}\`" fi - if [ -n "${{ vars.SERVERLESS_CONTAINER_ID }}" ]; then - echo "- Container: \`${{ vars.SERVERLESS_CONTAINER_ID }}\`" + if [ -n "${{ vars.SERVERLESS_CONTAINER_IDS }}" ]; then + echo "- Containers: \`${{ vars.SERVERLESS_CONTAINER_IDS }}\`" fi } >> "$GITHUB_STEP_SUMMARY" - name: Mirror production image to secondary registry diff --git a/Docs/docker-build-and-deploy.md b/Docs/docker-build-and-deploy.md index cf1d9c2..b45d9f0 100644 --- a/Docs/docker-build-and-deploy.md +++ b/Docs/docker-build-and-deploy.md @@ -10,7 +10,7 @@ A rollout on a cluster in the given namespace. If kubernetes labels are provided ### Serverless Container Redeploy -A redeploy on one or more existing Serverless Containers. Serverless redeploys start after all image variants have been built and pushed. The workflow does not create or update Serverless Container configuration. Every target container must already exist and already be configured to pull an image tag that this workflow publishes. +A redeploy on one or more existing Serverless Containers. The workflow does not create or update Serverless Container configuration. Every target container must already exist and already be configured to pull an image tag that this workflow publishes. For multiple containers, set `SERVERLESS_CONTAINER_IDS` to a comma-separated value such as `web-container-id,api-container-id`. @@ -39,8 +39,7 @@ These are always available, regardless of vendor: | `K8S_NAMESPACE` | Target cluster namespace | Variable | Yes | | `RUNNER_DEFAULT` | The CI runner for default actions. Defaults to `ubuntu-latest` | Variable | No | | `RUNNER_INFRA` | The CI runner for infra actions. Defaults to `ubuntu-latest` | Variable | No | -| `SERVERLESS_CONTAINER_ID` | Target Serverless Container ID to redeploy (legacy single-container variable) | Variable | No | -| `SERVERLESS_CONTAINER_IDS` | Target Serverless Container IDs to redeploy, separated by commas. Takes precedence over `SERVERLESS_CONTAINER_ID` | Variable | No | +| `SERVERLESS_CONTAINER_IDS` | Target Serverless Container IDs to redeploy, separated by commas | Variable | No | ### Vendor-Specific Inputs diff --git a/Docs/docker-promote-to-environment.md b/Docs/docker-promote-to-environment.md index bddc884..0718bb4 100644 --- a/Docs/docker-promote-to-environment.md +++ b/Docs/docker-promote-to-environment.md @@ -12,7 +12,9 @@ A rollout on a cluster in the given namespace. If kubernetes labels are provided ### Serverless Container Redeploy -A redeploy on an existing Serverless Container. It does not create or update the Serverless Container configuration. The target container must already exist and already be configured to pull the image tag that this workflow publishes. +A redeploy on one or more existing Serverless Containers. It does not create or update Serverless Container configuration. Every target container must already exist and already be configured to pull the image tag that this workflow publishes. + +For multiple containers, set `SERVERLESS_CONTAINER_IDS` to a comma-separated value such as `web-container-id,api-container-id`. ## Inputs @@ -41,7 +43,7 @@ These are always available, regardless of vendor: | `K8S_NAMESPACE` | Target cluster namespace | Variable | Yes | | `RUNNER_DEFAULT` | The CI runner for default actions. Defaults to `ubuntu-latest` | Variable | No | | `RUNNER_INFRA` | The CI runner for infra actions. Defaults to `ubuntu-latest` | Variable | No | -| `SERVERLESS_CONTAINER_ID` | Target Serverless Container ID to redeploy | Variable | No | +| `SERVERLESS_CONTAINER_IDS` | Target Serverless Container IDs to redeploy, separated by commas | Variable | No | ### Vendor-Specific Inputs