-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use Image PipelineResource for input in tekton task #1984
Comments
Hey, I believe this is right (from reading through the image resource code). I don't think the image resource really does anything if it's used as an input, other than act as a container of data. (Happy to be told different though if anyone else knows!) Pipeline Resources are not being promoted to beta for reasons such as this - their behaviour is a bit confusing and opaque. |
This is exactly what I am trying to use it for. I simply need easy access to the contents of the container image. However, this doesn't seem to work as the contents of the image are not copied/mounted, so I am now considering an option of exporting the image to a tar bar, for example: docker export image-registry.openshift-image-registry.svc:5000/default/my > contents.tar |
No, it doesn't act as a container of data. It doesn't mount the flattened content of the image in a volume (it's not something k8s supports as far as I know). As of today, images as input are only useful when using it with variable interpolation, it doesn't add anything to the |
Indeed. Although this command (with $ podman export image-registry.openshift-image-registry.svc:5000/default/my > contents.tar |
oops, yeah sorry i should have specified - i meant that it holds the "tekton data" (digest / url) in the resource object but you're both right - it never gets mounted or otherwise injected into the container without variable interpolation. here's an example of variable interpolation to bring that "data" into the container: apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
generateName: print-image-digest-
spec:
taskSpec:
inputs:
resources:
- name: my-image
type: image
steps:
- name: print-digest
image: ubuntu
script: |
DIGEST=$(inputs.resources.my-image.digest)
echo "hello, my digest is $DIGEST"
inputs:
resources:
- name: my-image
resourceSpec:
type: image
params:
- name: "URL"
value: "url/to/container/image"
- name: "Digest"
value: "foobarbazdigest" |
Thank you for letting me know. This is the information I was looking for.
Not sure about k8s, however, OpenShift's build configs do support Image inputs: |
Right, the way Image Source work is quite different from what PipelineResource are in Tekton. We may have something like this at some point but it will need to wait the |
Expected Behavior
Find the contents of the input Image PipelineResource under the /workspace directory.
Actual Behavior
No error is thrown and the Image content is not available under the /workspace directory.
Steps to Reproduce the Problem
As documented in https://github.com/tektoncd/pipeline/blob/master/docs/resources.md I have configured an Image PipelineResource:
Now when I am using the above PipelineResource as an input to a task:
I cannot find the contents of the image under the /workspace directory or any other directory.
The documentation states that an Image PipelineResource is usually used as a Task output for Tasks that build images.
Does this mean that an Image PipelineResource cannot be used as a Task input instead of output?
The text was updated successfully, but these errors were encountered: