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
13 changes: 8 additions & 5 deletions .github/actions/infra/serverless-container/redeploy/action.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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 }}
Expand All @@ -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 }}'"
Expand Down
3 changes: 0 additions & 3 deletions .github/actions/infra/serverless-container/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/docker-build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ on:
# - K8S_NAMESPACE
# - RUNNER_DEFAULT
# - RUNNER_INFRA
# - SERVERLESS_CONTAINER_ID
# - SERVERLESS_CONTAINER_IDS
Comment thread
jorenvandeweyer marked this conversation as resolved.
# For Azure vendor:
# - AZURE_RESOURCE_GROUP
# For DigitalOcean vendor:
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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"
21 changes: 13 additions & 8 deletions .github/workflows/docker-promote-to-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions Docs/docker-build-and-deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
6 changes: 4 additions & 2 deletions Docs/docker-promote-to-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down