Pipeline: Workspace/docker-source in pipeline tutorial

Created on 16 Apr 2020  路  4Comments  路  Source: tektoncd/pipeline

TaskRun in the Pipeline tutorial, has a "pathToDockerFile":
/workspace/docker-source/examples/microservices/leeroy-web
but looking in the "PipelineResource" url there is no subfolder in the repo: https://github.com/GoogleContainerTools/skaffold

But I can find examples folde , so should it not be:
/workspace/examples/microservices/leeroy-web
Without the docker-source - for "pathToDockerFile"?

Looked for docker-source in:
Workspace: https://tekton.dev/docs/pipelines/workspaces/

kinquestion

Most helpful comment

See https://github.com/tektoncd/pipeline/blob/master/docs/resources.md#using-resources

Input resources, like source code (git) or artifacts, are dumped at path /workspace/task_resource_name within a mounted volume and are available to all steps of your Task. The path that the resources are mounted at can be overridden with the targetPath field. Steps can use the pathvariable substitution key to refer to the local path to the mounted resource.

So in the tutorial, /workspace/docker-source corresponds to the path used for the input resource named docker-source

All 4 comments

See https://github.com/tektoncd/pipeline/blob/master/docs/resources.md#using-resources

Input resources, like source code (git) or artifacts, are dumped at path /workspace/task_resource_name within a mounted volume and are available to all steps of your Task. The path that the resources are mounted at can be overridden with the targetPath field. Steps can use the pathvariable substitution key to refer to the local path to the mounted resource.

So in the tutorial, /workspace/docker-source corresponds to the path used for the input resource named docker-source

One thing that might make this clearer in the tutorial would be to use the variable interpolation for the path - then you don't need to think about it at all!

Right, thanks!

I see now:

      resources:
        inputs:
          - name: docker-source

Also found:

Configuring Workspaces

This section describes how to configure one or more Workspaces in a TaskRun.

Using Workspaces in Tasks

To configure one or more Workspaces in a Task, add a workspaces list with each entry using the following fields:

name - (required) A unique string identifier that can be used to refer to the workspace
description - An informative string describing the purpose of the Workspace
readOnly - A boolean declaring whether the Task will write to the Workspace.
mountPath - A path to a location on disk where the workspace will be available to Steps. Relative paths will be prepended with /workspace. If a mountPath is not provided the workspace will be placed by default at /workspace/<name> where <name> is the workspace鈥檚 unique name.

What do you mean by "variable interpolation"?

The variable interpolation that's being referenced is $(resources.inputs.docker-source.path) which you can use instead of hard-coding /workspace/docker-source in Tasks. The tutorial has been updated to use this variable now in PR https://github.com/tektoncd/pipeline/pull/2418.

Configuring Workspaces

Apologies it's a bit confusing but this doc, docs/workspaces.md, describes a different feature. It's not directly related to the issue you're describing here.

I'm closing this issue now as I think the original problem is resolved.

Was this page helpful?
0 / 5 - 0 ratings