Skip to content

Commit

Permalink
allow skip migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
ictorn committed Aug 25, 2022
1 parent a7816d7 commit 0d9b633
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ inputs:
required: true
migrations:
description: 'migration job name'
required: true
required: false
default: null
do-access-token:
description: 'DO access token'
required: true
Expand Down Expand Up @@ -50,16 +51,17 @@ runs:
run: doks -n ${{ inputs.namespace }} rollout status deployment/${{ inputs.deployment }}
shell: bash
- name: wait for migrations job to complete
if: inputs.migrations != null
run: doks -n ${{ inputs.namespace }} wait --for=condition=Complete --timeout=30s job "${{ inputs.migrations }}" -o=jsonpath='{.status.conditions[*].type}' | grep -q Complete || exit 1
id: migrations
continue-on-error: true
shell: bash
- name: get logs from migrations job
if: ${{ success() }}
if: success() && inputs.migrations != null
run: doks -n ${{ inputs.namespace }} logs $(doks -n ${{ inputs.namespace }} get pod -l controller-uid=$(doks -n ${{ inputs.namespace }} get job "${{ inputs.migrations }}" -o "jsonpath={.metadata.labels.controller-uid}") -o name)
shell: bash
- name: throw an error if migrations job failed
if: ${{ failure() && steps.migrations.conclusion == 'failure' }}
if: failure() && steps.migrations.conclusion == 'failure' && inputs.migrations != null
run: |
echo "database migration error"
exit 1
Expand Down

0 comments on commit 0d9b633

Please sign in to comment.