Skip to content

Commit

Permalink
fix: matrix strategy and output job logs (#109)
Browse files Browse the repository at this point in the history
* fix: matrix strategy and output job logs

* fix: kubectl wait
  • Loading branch information
andrewmooreio authored Nov 20, 2024
1 parent 50afc3d commit 019abf0
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/opensearch-backup.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: OpenSearch Backup
name: "Alfresco: OpenSearch Backup"

on:
schedule:
Expand All @@ -24,16 +24,9 @@ jobs:

strategy:
matrix:
environment:
- poc
- dev
- test
- stage
# - preprod
exclude:
- ${{ github.event_name == 'workflow_dispatch' && environment != github.event.inputs.environment }}
environment: ${{ github.event_name == 'schedule' && fromJson('["poc," "dev", "test", "stage"]') || fromJson(format('["{0}"]', github.event.inputs.environment)) }}

environment: ${{ matrix.environment || github.event.inputs.environment }}-preapproved
environment: ${{ matrix.environment }}-preapproved

steps:
- name: Checkout code
Expand All @@ -56,6 +49,14 @@ jobs:
helm install opensearch-backup . \
--set opensearch.environment=${{ matrix.environment || github.event.inputs.environment }}
kubectl wait jobs -l name-prefix=opensearch-backup --for=condition=complete --timeout=1h
kubectl wait job/opensearch-backup --for=condition=complete --timeout=1h
- name: Output job logs
run: |
# Get the pod name from the job
POD_NAME=$(kubectl get pods --selector=job-name=opensearch-backup -o jsonpath='{.items[0].metadata.name}')
# Output the logs
echo "=== Backup Job Logs ==="
kubectl logs $POD_NAME
- name: Cleanup
if: always()
run: helm uninstall opensearch-backup --ignore-not-found

0 comments on commit 019abf0

Please sign in to comment.