如https://github.com/tektoncd/pipeline/blob/master/docs/resources.md中所述,我配置了一个 Image PipelineResource:
apiVersion: tekton.dev/v1alpha1
kind: PipelineResource
metadata:
name: my-data-image
spec:
type: image
params:
- name: url
value: image-registry.openshift-image-registry.svc:5000/default/my-data
现在,当我使用上述 PipelineResource 作为任务的输入时:
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: my-task
spec:
inputs:
resources:
- name: my-data-image
type: image
steps:
- name: print-info
image: image-registry.openshift-image-registry.svc:5000/default/my-task-runner-image:latest
imagePullPolicy: Always
command: ["/bin/sh"]
args:
- "-c"
- >
echo "List the contents of the input image" &&
ls -R "$(inputs.resources.my-data-image.path)"
我无法列出图像的内容,因为我收到了错误
[test : print-info] List the contents of the input image
[test : print-info] ls: cannot access '/workspace/my-data-image': No such file or directory
文档 ( https://github.com/tektoncd/pipeline/blob/master/docs/resources.md ) 指出 Image PipelineResource通常用作构建图像的任务的任务输出。
如何从 tekton 任务中访问容器数据映像的内容?