# the code in this file is augmented by an ejs template
# and by loading the yaml into memory.
# some of these values will be replaced.
apiVersion: batch/v1
kind: Job
metadata:
  finalizers:
    - foregroundDeletion
spec:
  backoffLimit: 2
  template:
    spec:
      restartPolicy: Never
      containers:
        - name: job-executor
          image: ubuntu
          command:
            - bash
            - -c
            - |
              #/usr/bin/env bash
              echo "Starting.."
              cur_count=0
              while true; do
                  cur_count=$((cur_count + 1))
                  if [ "$cur_count" -ge "$TICKS" ]; then
                      break
                  fi
                  date
                  sleep 1
              done

              echo "Exit code: $EXIT_CODE"
              exit $EXIT_CODE
          env:
            - name: EXIT_CODE
              value: '0'
            - name: TICKS
              value: '2'
