Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/actions/infra/serverless-container/redeploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ inputs:
container-ids:
description: Target Scaleway Serverless container IDs (comma separated)
required: true
container-image:
description: Container image reference without tag; only containers using this image are redeployed
required: false
# Vendor: Azure
azure-client-id:
description: Azure client ID for login with an Azure service principal
Expand Down Expand Up @@ -67,7 +70,25 @@ runs:
case "${{ inputs.vendor }}" in
scaleway)
container_ids="${{ inputs.container-ids }}"
container_image="${{ inputs.container-image }}"

for container_id in ${container_ids//,/ }; do
if [[ -n "$container_image" ]]; then
configured_image="$(
scw container container get "$container_id" \
region="${{ inputs.scaleway-region }}" \
-o json \
| jq -er '.image'
)"

if [[ "$configured_image" != "$container_image" ]] \
&& [[ "$configured_image" != "$container_image":* ]] \
&& [[ "$configured_image" != "$container_image"@* ]]; then
echo "Skipping Serverless Container $container_id: configured image is $configured_image"
continue
fi
fi

echo "Redeploying Serverless Container: $container_id"
scw container container redeploy "$container_id" region="${{ inputs.scaleway-region }}"
done
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker-build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ jobs:
with:
vendor: ${{ inputs.vendor }}
container-ids: ${{ vars.SERVERLESS_CONTAINER_IDS }}
container-image: ${{ steps.setup.outputs.registry }}/${{ steps.setup.outputs.image }}
# Vendor: azure
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/docker-promote-to-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ jobs:
with:
vendor: ${{ inputs.vendor }}
container-ids: ${{ vars.SERVERLESS_CONTAINER_IDS }}
container-image: ${{ steps.setup.outputs.registry }}/${{ steps.setup.outputs.image }}
# Vendor: azure
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
Expand Down
2 changes: 1 addition & 1 deletion Docs/docker-build-and-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. 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 image variants, each build job only redeploys listed containers whose configured image matches that variant's image.

For multiple containers, set `SERVERLESS_CONTAINER_IDS` to a comma-separated value such as `web-container-id,api-container-id`.

Expand Down
2 changes: 1 addition & 1 deletion Docs/docker-promote-to-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,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. 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.
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 image variants, each promotion job only redeploys listed containers whose configured image matches that variant's image.

For multiple containers, set `SERVERLESS_CONTAINER_IDS` to a comma-separated value such as `web-container-id,api-container-id`.

Expand Down