diff --git a/.github/actions/infra/serverless-container/redeploy/action.yml b/.github/actions/infra/serverless-container/redeploy/action.yml index 25b40dd..52a94f3 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 + container-ids: + description: Target Scaleway Serverless container IDs (comma separated) required: true # Vendor: Azure azure-client-id: @@ -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 }} @@ -67,7 +66,11 @@ runs: case "${{ inputs.vendor }}" in scaleway) - scw container container redeploy "${{ inputs.container-id }}" region="${{ inputs.scaleway-region }}" + 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="${{ inputs.scaleway-region }}" + done ;; *) echo "Unsupported vendor '${{ inputs.vendor }}'" 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 37d1152..0832f8a 100644 --- a/.github/workflows/docker-build-and-deploy.yml +++ b/.github/workflows/docker-build-and-deploy.yml @@ -16,7 +16,7 @@ on: # - K8S_NAMESPACE # - RUNNER_DEFAULT # - RUNNER_INFRA - # - SERVERLESS_CONTAINER_ID + # - SERVERLESS_CONTAINER_IDS # For Azure vendor: # - AZURE_RESOURCE_GROUP # For DigitalOcean vendor: @@ -99,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 }} @@ -178,12 +183,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 }} @@ -197,9 +202,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 @@ -212,7 +217,7 @@ 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" 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 d4bfc03..b45d9f0 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. 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,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 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