Skip to content

Commit

Permalink
Add developer docs
Browse files Browse the repository at this point in the history
Adding docs explaining how different parts are working in conjuction. In this initial attemp I am adding inputs/outputs contract is
controllers.
  • Loading branch information
Shash Reddy committed Dec 18, 2018
1 parent 8a935e8 commit 347b5e6
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions docs/developers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## Developer docs

This document is aimed at helping maintainers/developers of project understand the complexity.

### How are resources shared between tasks

Pipelineruns uses PVC to share resources between tasks. PVC volume is mounted on path `/pvc` by Pipelinerun.

* If resource in a task is declared as output then taskun controllers add step to copy each output resource to directory path `/pvc/task_name/resource_name`.

* If input resource includes `providedBy` condition then container definition to copy from PVC to directory from `/pvc/previous_task/resource_name`.

### How are inputs handled?

Input resources like source code(git) or artifacts are dumped at path `/workspace/`. Resource definition in task can have custom target directory. If `targetPath` is mentioned then controllers have to be responsible for adding container definition to create directories and pulling down the versioned artifacts into that directory.

### How are outputs handled?

Output resources like source code(git) or artifacts(storage resource) are expected in directory path `/workspace/output/resource_name`.

* If resource has output "action" like upload to blob storage, then container step is added for this action.
* If there is PVC volume present(taskrun holds owner reference to pipelinerun) then copy step is added as well.
* Copy step includes resource being copied to PVC to path `/pvc/task_name/resource_name` from `/workspace/output/resource_name` if resource is not declared in input resource like below example.

```yaml
kind: Task
metadata:
name: get-gcs-task
namespace: default
spec:
outputs:
resources:
- name: gcs-workspace
type: storage
```
* Copy step includes resource being copied to PVC to path `/pvc/task_name/resource_name` from `/workspace/random-space/` if resource is declared in input resource like below example.

```yaml
kind: Task
metadata:
name: get-gcs-task
namespace: default
spec:
inputs:
resources:
- name: gcs-workspace
type: storage
targetPath: random-space
outputs:
resources:
- name: gcs-workspace
type: storage
```

0 comments on commit 347b5e6

Please sign in to comment.