I´m trying to retrieve some code from gitlab in my yaml. Unfortunatly the job fails to initalize the pod. I have checked all the logs and it fails with the following message:
0 container "filter-human-genome-and-create-mapping-stats" in pod "create-git-container-5lhp2" is waiting to start: PodInitializing
Here is the yaml file:
apiVersion: batch/v1
kind: Job
metadata:
name: create-git-container
namespace: diag
spec:
template:
spec:
initContainers:
- name: bash-script-git-downloader
image: alpine/git
volumeMounts:
- mountPath: /bash_scripts
name: bash-script-source
command: ["/bin/sh","-c"]
args: ["git", "clone", "https://.......@gitlab.com/scripts.git" ]
containers:
- name: filter-human-genome-and-create-mapping-stats
image: myimage
env:
- name: OUTPUT
value: "/output"
command: ["ls"]
volumeMounts:
- mountPath: /bash_scripts
name: bash-script-source
- mountPath: /output
name: output
volumes:
- name: bash-script-source
emptyDir: {}
- name: output
persistentVolumeClaim:
claimName: output
restartPolicy: Never
If you use bash -c
, it expects only one argument. So you have to pass your args[]
as one argument. There are ways to do it:
command: ["/bin/sh","-c"]
args: ["git clone https://.......@gitlab.com/scripts.git"]
or
command: ["/bin/sh","-c", "git clone https://.......@gitlab.com/scripts.git"]
or
args: ["/bin/sh","-c", "git clone https://.......@gitlab.com/scripts.git"]
or
command:
- /bin/sh
- -c
- |
git clone https://.......@gitlab.com/scripts.git
or
args:
- /bin/sh
- -c
- |
git clone https://.......@gitlab.com/scripts.git