---
apiVersion: batch/v1
kind: Job
metadata:
  namespace: cadanac-v0-1
  name: copyartifacts
spec:
  backoffLimit: 1
  template:
    metadata:
      name: copyartifacts
    spec:
      restartPolicy: "Never"
      volumes:
      - name: cadanacvolume
        persistentVolumeClaim:
          claimName: cadanac-pvc
      - name: dockersocket
        hostPath:
          path: /var/run/docker.sock
      containers:
      - name: copyartifacts
        image: alpine
        imagePullPolicy: Always
        command: ["sh", "-c", "ls -l /shared; rm -rf /shared/*; ls -l /shared; while [ ! -d /shared/artifacts ]; do echo Waiting for artifacts to be copied; sleep 2; done; sleep 10; ls -l /shared/artifacts; "]
        volumeMounts:
        - mountPath: /shared
          name: cadanacvolume
