Skip to content

Feature Request: ignore error flag #32

Description

@spencerdcarlson

It would nice if there were a ignore_error option that could be set to true and default to false.

Use case: I want to execute kubectl delete job <job-name> and not fail if the job doesn't exist, so that in the next stage I can execute kubectl apply -f job.yaml

Here is my current workaround

- name: Delete Migration Job
  if: ${{ contains(fromJSON('["prod"]'), matrix.env) }}
  env:
    KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
  run: |
    set -e
    if [ ! -f "$HOME/.kube/config" ]; then
      if [ ! -z "${KUBE_CONFIG}" ]; then
        mkdir -p $HOME/.kube
        echo "$KUBE_CONFIG" | base64 -d > $HOME/.kube/config
      fi
    fi
    kubectl delete job accounts-migrate-database || true
- name: Run Database Migration Job
  if: ${{ contains(fromJSON('["prod"]'), matrix.env) }}
  uses: actions-hub/kubectl@master
  env:
    KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
  with:
    args: apply -f kube/job-db-migrate.yaml    

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions