Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/tektoncd/pipeline into up…
Browse files Browse the repository at this point in the history
…date/release-label
  • Loading branch information
waveywaves committed Dec 23, 2019
2 parents 813e54f + 5a9e8ba commit 51a1d6e
Show file tree
Hide file tree
Showing 79 changed files with 4,299 additions and 215 deletions.
3 changes: 2 additions & 1 deletion cmd/git-init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func init() {
flag.StringVar(&fetchSpec.URL, "url", "", "Git origin URL to fetch")
flag.StringVar(&fetchSpec.Revision, "revision", "", "The Git revision to make the repository HEAD")
flag.StringVar(&fetchSpec.Path, "path", "", "Path of directory under which Git repository will be copied")
flag.BoolVar(&fetchSpec.SSLVerify, "sslVerify", true, "Enable/Disable SSL verification in the git config")
flag.BoolVar(&submodules, "submodules", true, "Initialize and fetch Git submodules")
flag.UintVar(&fetchSpec.Depth, "depth", 1, "Perform a shallow clone to this depth")
flag.StringVar(&terminationMessagePath, "terminationMessagePath", "/dev/termination-log", "Location of file containing termination message")
Expand All @@ -52,7 +53,7 @@ func main() {
}
if submodules {
if err := git.SubmoduleFetch(logger, fetchSpec.Path); err != nil {
logger.Fatalf("Error initalizing or fetching the git submodules")
logger.Fatalf("Error initializing or fetching the git submodules")
}
}

Expand Down
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ignore:
- "pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go"
- "pkg/apis/pipeline/v1alpha2/zz_generated.deepcopy.go"
27 changes: 26 additions & 1 deletion docs/pipelineruns.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Creation of a `PipelineRun` will trigger the creation of
- [Service account](#service-account)
- [Service accounts](#service-accounts)
- [Pod Template](#pod-template)
- [Workspaces](#workspaces)
- [Cancelling a PipelineRun](#cancelling-a-pipelinerun)
- [Examples](https://github.com/tektoncd/pipeline/tree/master/examples/pipelineruns)
- [Logs](logs.md)
Expand All @@ -27,7 +28,7 @@ following fields:

- Required:
- [`apiVersion`][kubernetes-overview] - Specifies the API version, for example
`tekton.dev/v1alpha1`.
`tekton.dev/v1alpha1`
- [`kind`][kubernetes-overview] - Specify the `PipelineRun` resource object.
- [`metadata`][kubernetes-overview] - Specifies data to uniquely identify the
`PipelineRun` resource object, for example a `name`.
Expand Down Expand Up @@ -219,6 +220,24 @@ allows to customize some Pod specific field per `Task` execution, aka
- `runtimeClassName`: the name of a
[runtime class](https://kubernetes.io/docs/concepts/containers/runtime-class/)
to use to run the pod.
- `automountServiceAccountToken`: whether the token for the service account
being used by the pod should be automatically provided inside containers at a
predefined path. Defaults to `true`.
- `dnsPolicy`: the
[DNS policy](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy)
for the pod, one of `ClusterFirst`, `Default`, or `None`. Defaults to
`ClusterFirst`. Note that `ClusterFirstWithHostNet` is not supported by Tekton
as Tekton pods cannot run with host networking.
- `dnsConfig`:
[additional DNS configuration](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-config)
for the pod, such as nameservers and search domains.
- `enableServiceLinks`: whether services in the same namespace as the pod will
be exposed as environment variables to the pod, similar to Docker service
links. Defaults to `true`.
- `priorityClassName`: the name of the
[priority class](https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/)
to use when running the pod. Use this, for example, to selectively enable
preemption on lower priority workloads.

In the following example, the `Task` is defined with a `volumeMount`
(`my-cache`), that is provided by the `PipelineRun`, using a
Expand Down Expand Up @@ -265,6 +284,12 @@ spec:
claimName: my-volume-claim
```

## Workspaces

It is not yet possible to specify [workspaces](tasks.md#workspaces) via `Pipelines`
or `PipelineRuns`, so `Tasks` requiring `workspaces` cannot be used with them until
[#1438](https://github.com/tektoncd/pipeline/issues/1438) is completed.

## Cancelling a PipelineRun

In order to cancel a running pipeline (`PipelineRun`), you need to update its
Expand Down
7 changes: 7 additions & 0 deletions docs/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This document defines `Pipelines` and their capabilities.

- [Syntax](#syntax)
- [Declared resources](#declared-resources)
- [Workspaces](#declared-workspaces)
- [Parameters](#parameters)
- [Pipeline Tasks](#pipeline-tasks)
- [From](#from)
Expand Down Expand Up @@ -72,6 +73,12 @@ spec:
type: image
```
### Declared Workspaces
It is not yet possible to specify [workspaces](tasks.md#workspaces) via `Pipelines`
or `PipelineRuns`, so `Tasks` requiring `workspaces` cannot be used with them until
[#1438](https://github.com/tektoncd/pipeline/issues/1438) is completed.

### Parameters

`Pipeline`s can declare input parameters that must be supplied to the `Pipeline`
Expand Down
3 changes: 3 additions & 0 deletions docs/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,12 @@ Params that can be added are the following:
1. `depth`: performs a [shallow clone][git-depth] where only the most recent
commit(s) will be fetched. If set to `'0'`, all commits will be fetched.
_If not specified, the default depth is 1._
1. `sslVerify`: defines if [http.sslVerify][git-http.sslVerify] should be set to `true` or `false`
in the global git config. _Defaults to `true` if omitted._

[git-rev]: https://git-scm.com/docs/gitrevisions#_specifying_revisions
[git-depth]: https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---depthltdepthgt
[git-http.sslVerify]: https://git-scm.com/docs/git-config#Documentation/git-config.txt-httpsslVerify

When used as an input, the Git resource includes the exact commit fetched in the
`resourceResults` section of the `taskRun`'s status object:
Expand Down
61 changes: 60 additions & 1 deletion docs/taskruns.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ A `TaskRun` runs until all `steps` have completed or until a failure occurs.
- [Overriding where resources are copied from](#overriding-where-resources-are-copied-from)
- [Service Account](#service-account)
- [Pod Template](#pod-template)
- [Workspaces](#workspaces)
- [Status](#status)
- [Steps](#steps)
- [Cancelling a TaskRun](#cancelling-a-taskrun)
Expand Down Expand Up @@ -57,7 +58,9 @@ following fields:
to configure the default timeout.
- [`podTemplate`](#pod-template) - Specifies a subset of
[`PodSpec`](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.15/#pod-v1-core)
configuration that will be used as the basis for the `Task` pod.
configuration that will be used as the basis for the `Task` pod.
- [`workspaces`](#workspaces) - Specify the actual volumes to use for the
[workspaces](tasks.md#workspaces) declared by a `Task`

[kubernetes-overview]:
https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields
Expand Down Expand Up @@ -189,6 +192,24 @@ allows to customize some Pod specific field per `Task` execution, aka
- `runtimeClassName`: the name of a
[runtime class](https://kubernetes.io/docs/concepts/containers/runtime-class/)
to use to run the pod.
- `automountServiceAccountToken`: whether the token for the service account
being used by the pod should be automatically provided inside containers at a
predefined path. Defaults to `true`.
- `dnsPolicy`: the
[DNS policy](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy)
for the pod, one of `ClusterFirst`, `Default`, or `None`. Defaults to
`ClusterFirst`. Note that `ClusterFirstWithHostNet` is not supported by Tekton
as Tekton pods cannot run with host networking.
- `dnsConfig`:
[additional DNS configuration](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-config)
for the pod, such as nameservers and search domains.
- `enableServiceLinks`: whether services in the same namespace as the pod will
be exposed as environment variables to the pod, similar to Docker service
links. Defaults to `true`.
- `priorityClassName`: the name of the
[priority class](https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/)
to use when running the pod. Use this, for example, to selectively enable
preemption on lower priority workloads.

In the following example, the Task is defined with a `volumeMount`
(`my-cache`), that is provided by the TaskRun, using a
Expand Down Expand Up @@ -227,7 +248,45 @@ spec:
claimName: my-volume-claim
```

## Workspaces

For a `TaskRun` to execute [a `Task` that declares `workspaces`](tasks.md#workspaces),
at runtime you need to map the `workspaces` to actual physical volumes with
`workspaces`. Values in `workspaces` are
[`Volumes`](https://kubernetes.io/docs/tasks/configure-pod-container/configure-volume-storage/), however currently we only support a subset of `VolumeSources`:

* [`emptyDir`](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir)
* [`persistentVolumeClaim`](https://kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim)

_If you need support for a `VolumeSource` not listed here
[please open an issue](https://github.com/tektoncd/pipeline/issues) or feel free to
[contribute a PR](https://github.com/tektoncd/pipeline/blob/master/CONTRIBUTING.md)._


If the declared `workspaces` are not provided at runtime, the `TaskRun` will fail
with an error.

For example to provide an existing PVC called `mypvc` for a `workspace` called
`myworkspace` declared by the `Pipeline`, using the `my-subdir` folder which already exists
on the PVC (there will be an error if it does not exist):

```yaml
workspaces:
- name: myworkspace
persistentVolumeClaim:
claimName: mypvc
subPath: my-subdir
```

Or to use [`emptyDir`](https://kubernetes.io/docs/concepts/storage/volumes/#emptydir) for the same `workspace`:

```yaml
workspaces:
- name: myworkspace
emptyDir: {}
```

_For a complete example see [workspace.yaml](../examples/taskruns/workspace.yaml)._

## Status

Expand Down
80 changes: 73 additions & 7 deletions docs/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ entire Kubernetes cluster.
- [Outputs](#outputs)
- [Controlling where resources are mounted](#controlling-where-resources-are-mounted)
- [Volumes](#volumes)
- [Container Template **deprecated**](#step-template)
- [Workspaces](#workspaces)
- [Step Template](#step-template)
- [Variable Substitution](#variable-substitution)
- [Examples](#examples)
Expand Down Expand Up @@ -77,6 +77,8 @@ following fields:
created by your `Task`
- [`volumes`](#volumes) - Specifies one or more volumes that you want to make
available to your `Task`'s steps.
- [`workspaces`](#workspaces) - Specifies paths at which you expect volumes to
be mounted and available
- [`stepTemplate`](#step-template) - Specifies a `Container` step
definition to use as the basis for all steps within your `Task`.
- [`sidecars`](#sidecars) - Specifies sidecar containers to run alongside
Expand Down Expand Up @@ -132,7 +134,6 @@ the body of a `Task`.

If multiple `steps` are defined, they will be executed in the same order as they
are defined, if the `Task` is invoked by a [`TaskRun`](taskruns.md).

Each `steps` in a `Task` must specify a container image that adheres to the
[container contract](./container-contract.md). For each of the `steps` fields,
or container images that you define:
Expand Down Expand Up @@ -281,7 +282,7 @@ spec:
inputs:
params:
- name: flags
value:
value:
- "--set"
- "arg1=foo"
- "--randomflag"
Expand Down Expand Up @@ -377,6 +378,48 @@ For example, use volumes to accomplish one of the following common tasks:
unsafe_. Use [kaniko](https://github.com/GoogleContainerTools/kaniko) instead.
This is used only for the purposes of demonstration.

### Workspaces

`workspaces` are a way of declaring volumes you expect to be made available to your
executing `Task` and the path to make them available at. They are similar to
[`volumes`](#volumes) but allow you to enforce at runtime that the volumes have
been attached and [allow you to specify subpaths](taskruns.md#workspaces) in the volumes
to attach.

The volume will be made available at `/workspace/myworkspace`, or you can override
this with `mountPath`. The value at `mountPath` can be anywhere on your pod's filesystem.
The path will be available via [variable substitution](#variable-substitution) with
`$(workspaces.myworkspace.path)`.

A task can declare that it will not write to the volume by adding `readOnly: true`
to the workspace declaration. This will in turn mark the volumeMount as `readOnly`
on the Task's underlying pod.

The actual volumes must be provided at runtime
[in the `TaskRun`](taskruns.md#workspaces).
In a future iteration ([#1438](https://github.com/tektoncd/pipeline/issues/1438))
it [will be possible to specify these in the `PipelineRun`](pipelineruns.md#workspaces)
as well.

For example:

```yaml
spec:
steps:
- name: write-message
image: ubuntu
script: |
#!/usr/bin/env bash
set -xe
echo hello! > $(workspaces.messages.path)/message
workspaces:
- name: messages
description: The folder where we write the message to
mountPath: /custom/path/relative/to/root
```

_For a complete example see [workspace.yaml](../examples/taskruns/workspace.yaml)._

### Step Template

Specifies a [`Container`](https://kubernetes.io/docs/concepts/containers/)
Expand Down Expand Up @@ -464,9 +507,17 @@ has been created to track this bug.

### Variable Substitution

`Tasks` support string replacement using values from all [`inputs`](#inputs) and
[`outputs`](#outputs).
`Tasks` support string replacement using values from:

* [Inputs and Outputs](#input-and-output-substitution)
* [Array params](#variable-substitution-with-parameters-of-type-array)
* [`workspaces`](#variable-substitution-with-workspaces)
* [`volumes`](#variable-substitution-with-volumes)

#### Input and Output substitution

[`inputs`](#inputs) and [`outputs`](#outputs) attributes can be used in replacements,
including [`params`](#params) and [`resources`](./resources.md#variable-substitution).

Input parameters can be referenced in the `Task` spec using the variable substitution syntax below,
where `<name>` is the name of the parameter:
Expand All @@ -477,7 +528,7 @@ $(inputs.params.<name>)

Param values from resources can also be accessed using [variable substitution](./resources.md#variable-substitution)

#### Variable Substitution with Parameters of Type `Array`
##### Variable Substitution with Parameters of Type `Array`

Referenced parameters of type `array` will expand to insert the array elements in the reference string's spot.

Expand Down Expand Up @@ -520,6 +571,21 @@ A valid reference to the `build-args` parameter is isolated and in an eligible f
args: ["build", "$(inputs.params.build-args)", "additonalArg"]
```

#### Variable Substitution with Workspaces

Paths to a `Task's` declared [workspaces](#workspaces) can be substituted with:

```
$(workspaces.myworkspace.path)
```
Since the name of the `Volume` is not known until runtime and is randomized, you can also
substitute the volume name with:
```
$(workspaces.myworkspace.volume)
```
#### Variable Substitution within Volumes
Task volume names and different
Expand Down Expand Up @@ -684,7 +750,7 @@ spec:
steps:
- name: release
image: goreleaser/goreleaser
workingdir: /workspace/src/$(inputs.params.package)
workingDir: /workspace/src/$(inputs.params.package)
command:
- goreleaser
args:
Expand Down
2 changes: 1 addition & 1 deletion examples/taskruns/custom-volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
image: ubuntu
script: |
#!/usr/bin/env bash
cat /short/and/stout/file
cat /short/and/stout/file | grep stuff
volumeMounts:
- name: custom
mountPath: /short/and/stout
Expand Down
Loading

0 comments on commit 51a1d6e

Please sign in to comment.