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
9 changes: 2 additions & 7 deletions .github/actions/docker/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,8 @@ runs:
;;
esac

# Transform K8S labels
if [ -z "${{ inputs.variant-path }}" ]; then
echo "k8s_labels=${{ inputs.k8s-labels }}" >> "$GITHUB_OUTPUT"
else
labels=(${{ inputs.k8s-labels }} variant=${{ inputs.variant-path }})
echo "k8s_labels=$(IFS=,;echo "${labels[*]}")" >> "$GITHUB_OUTPUT"
fi
# K8S rollout labels
echo "k8s_labels=${{ inputs.k8s-labels }}" >> "$GITHUB_OUTPUT"
# Prep. docker environment
- name: Checkout
if: ${{ inputs.prepare-for-building == 'true' }}
Expand Down
12 changes: 12 additions & 0 deletions .github/actions/infra/k8s/rollout/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ inputs:
rollout-labels:
description: List of labels to rollout (comma separated)
required: false
rollout-image:
description: Image reference without tag; restarts deployments running this image
required: false
rollout-namespace:
description: Rollout namespace filter
required: true
Expand Down Expand Up @@ -79,6 +82,7 @@ runs:
env:
DEPLOYMENTS: ${{ inputs.rollout-deployments }}
LABELS: ${{ inputs.rollout-labels }}
IMAGE: ${{ inputs.rollout-image }}
run: |
# Restart multiple deployments
if [ -n "$DEPLOYMENTS" ]; then
Expand All @@ -94,6 +98,14 @@ runs:
--selector="$LABELS" \
--namespace="${{ inputs.rollout-namespace }}"

# Restart deployments running the image
elif [ -n "$IMAGE" ]; then
kubectl get deployment \
--namespace="${{ inputs.rollout-namespace }}" -o json \
| jq -r --arg img "$IMAGE" '.items[] | select(any(.spec.template.spec.containers[]; .image | startswith($img + ":"))) | .metadata.name' \
| xargs -r kubectl rollout restart deployment \
--namespace="${{ inputs.rollout-namespace }}"

# Restart everything
else
kubectl rollout restart deployment \
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 @@ -158,6 +158,7 @@ jobs:
cluster-id: ${{ vars.K8S_CLUSTER_ID }}
rollout-deployments: ${{ vars.K8S_DEPLOYMENTS }}
rollout-labels: ${{ steps.setup.outputs.k8s-labels }}
rollout-image: ${{ steps.setup.outputs.registry }}/${{ steps.setup.outputs.image }}
rollout-namespace: ${{ vars.K8S_NAMESPACE }}
# Vendor: azure
azure-client-id: ${{ secrets.AZURE_CLIENT_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 @@ -178,6 +178,7 @@ jobs:
cluster-id: ${{ vars.K8S_CLUSTER_ID }}
rollout-deployments: ${{ vars.K8S_DEPLOYMENTS }}
rollout-labels: ${{ steps.setup.outputs.k8s-labels }}
rollout-image: ${{ steps.setup.outputs.registry }}/${{ steps.setup.outputs.image }}
rollout-namespace: ${{ vars.K8S_NAMESPACE }}
# Vendor: azure
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
Expand Down
Loading