executor-init could not chmod for artifacts dir
WZHZATA opened this issue · 0 comments
Describe the bug
When using container job template injected via JobTemplateReference in Test definition yaml file, executor-init fails chmod on directory. As a result artifacts are not being scraped upon test completion. See error below:

Interestingly the same job template with the same configuration works fine when defined inline in Test yaml definition.
I found some similar issue opened in the past, but i believe this is not the case here (#2928) otherwise it would fail also in classic inline job template definition.
To Reproduce
Steps to reproduce the behavior:
Below config works fine:
apiVersion: tests.testkube.io/v3
kind: Test
metadata:
name: custom-test
namespace: testkube
spec:
content:
repository:
branch: testing
tokenSecret:
key: password
name: testkube-github
type: git-dir
uri: 'my_branch'
usernameSecret:
key: username
name: name
workingDir: tests
type: git-dir
executionRequest:
artifactRequest:
storageClassName: standard
args:
- test.robot
jobTemplate: |
apiVersion: batch/v1
kind: Job
metadata:
name: "{{`{{ .Name }}`}}"
namespace: {{`{{ .Namespace }}`}}
labels:
executor: robot
spec:
activeDeadlineSeconds: 600
template:
spec:
initContainers:
- name: {{`{{ .Name }}`}}-init
image: {{`{{ .Registry }}`}}/{{`{{ .InitImage }}`}}
imagePullPolicy: IfNotPresent
command:
- "/bin/runner"
- '{{`{{ .Jsn }}`}}'
volumeMounts:
- name: data-volume
mountPath: /data
containers:
- name: "{{`{{ .Name }}`}}"
image: {{`{{ .Registry }}`}}/{{`{{ .Image }}`}}
imagePullPolicy: IfNotPresent
command:
{{`{{- range $cmd := .Command }}`}}
- {{`{{ $cmd -}}`}}
{{`{{- end }}`}}
args:
{{`{{- range $arg := .Args }}`}}
- {{`{{ $arg -}}`}}
{{`{{- end }}`}}
workingDir: {{`{{ .WorkingDir }}`}}
volumeMounts:
- name: data-volume
mountPath: /data
volumes:
- name: data-volume
emptyDir: {}
backoffLimit: 600
ttlSecondsAfterFinished: {{`{{ .DelaySeconds }}`}}
type: custom
Once I move the same job template to Template CRD (see config below) it fails to work properly:
apiVersion: tests.testkube.io/v1
kind: Template
metadata:
name: robot-job-template
namespace: testkube
spec:
type: container
body: |-
apiVersion: batch/v1
kind: Job
metadata:
name: "{{`{{ .Name }}`}}"
namespace: {{`{{ .Namespace }}`}}
labels:
executor: robot
spec:
activeDeadlineSeconds: 600
template:
spec:
initContainers:
- name: {{`{{ .Name }}`}}-init
image: {{`{{ .Registry }}`}}/{{`{{ .InitImage }}`}}
imagePullPolicy: IfNotPresent
command:
- "/bin/runner"
- '{{`{{ .Jsn }}`}}'
volumeMounts:
- name: data-volume
mountPath: /data
containers:
- name: "{{`{{ .Name }}`}}"
image: {{`{{ .Registry }}`}}/{{`{{ .Image }}`}}
imagePullPolicy: IfNotPresent
command:
{{`{{- range $cmd := .Command }}`}}
- {{`{{ $cmd -}}`}}
{{`{{- end }}`}}
args:
{{`{{- range $arg := .Args }}`}}
- {{`{{ $arg -}}`}}
{{`{{- end }}`}}
workingDir: {{`{{ .WorkingDir }}`}}
volumeMounts:
- name: data-volume
mountPath: /data
volumes:
- name: data-volume
emptyDir: {}
backoffLimit: 600
ttlSecondsAfterFinished: {{`{{ .DelaySeconds }}`}}
apiVersion: tests.testkube.io/v3
kind: Test
metadata:
name: custom-test
namespace: testkube
spec:
content:
repository:
branch: testing
tokenSecret:
key: password
name: testkube-github
type: git-dir
uri: 'my_repo'
usernameSecret:
key: username
name: name
workingDir: tests
type: git-dir
executionRequest:
jobTemplateReference: robot-job-template
artifactRequest:
storageClassName: standard
args:
- test.robot
type: custom
and when run the same job template via JobTemplateReference I'm getting this error:
Expected behavior
I would expect that when using the same job template I used to have inline in Test yaml definition, would also be working when it's defined in Template CRD and invoked via jobTemplateReference field.
Version / Cluster
- Which testkube version? testkube-1.17.0
- What Kubernetes cluster? (e.g. GKE, EKS, Openshift etc, local KinD, local Minikube) Openshift, OKD
- What Kubernetes version? 1.17
Screenshots
pls see above