Using a task file inside of an image

The following is a pipeline that attempts to use a task step that references a file that is within a resource. According to the task step file documentation this should be possible.

For example, if in your plan you have the following get step:
- get: something
And the something resource provided a unit.yml file, you would set file: something/unit.yml .


An accurate example pipeline I’m working with:

resources:
  # This image contains a root directory at /tasks/ that contains .yml task files.
  - name: foo-tasks
    type: docker-image
    source:
      repository: org/foo-tasks
      tag: latest

jobs:
  - name: extraction
    public: true
    plan:
      - get: foo-tasks
      - task: run-my-task
        file: foo-tasks/tasks/extract.yml
        # I even tried the following:
        # file: foo-tasks//tasks/extract.yml
        vars:
          url: "grumble://dorf.boo"

The error: task config 'foo-tasks/tasks/extract.yml' not found

I’ve verified the the image does contain the task file.
I’ve tried putting in a debug task before it with pwd and ls /tasks. This actually seems to indicate that the working directory becomes something like /tmp/build/########, which would possibly explain why the file hasn’t be found.

Anyone have thoughts? What should I try next? Or better yet what am I doing wrong?

Thank you for taking the time to read this. I appreciate it.

Images fetched with docker-image are fetched and then extracted under rootfs/, so your file: line should actually be foo-tasks/rootfs/tasks/extract.yml.

Something like this should work:

jobs:
  - name: extraction
    public: true
    plan:
      - get: foo-tasks
      - task: run-my-task
        file: foo-tasks/rootfs/tasks/extract.yml
        vars:
          url: "grumble://dorf.boo"
1 Like