Configuring convey is done via a file named
`convey.yml`. This file defines the tasks as well as the plans. This document explains how that file is structured and what options are available.
There are a handful of examples in the [
examples/](
examples/) directory.
This example shows how to use the convey/bitbucket-upload image to upload files to a Bitbucket repository's downloads section.
## default-plan-alias.yml A simple plan that aliases the default plan.
A simple plan to show how you can detach a container.
A simple plan to show how you can specify health commands for a detached container.
This example shows how environment substitution works in your config file.
This example shows how you can use meta-plans to group multiple plans together.
This example shows how environment substitution overriding works and uses a -override.yml file as well.
This example shows how to have one file extend another, inheriting all of the plans and tasks that are
not otherwise overwritten by the configuration file.
This example shows how to expand an environment variable into a list in the context of a extended task.
This example shows how you can login and logout of a Docker registry by using environment variables.
This example shows how to use the script attribute of a run task.
This example shows how you can specify an ssh identity to automatically turn on ssh-agent forwarding.
A simple example showing how to use the run attribute of a stage.
This example shows your traditional clone, test, build, deploy, and report for a project.
The complete reference for convey.yml can be found below.
The options section let's you fine tune a few things about your configuration.
`default-plan` is the name of the plan that should be ran by default. When not set, this defaults to
`default`.
You can specify a list of SSH key fingerprints that are required for your run. This is done by using the
`ssh-identities` attribute which is a list of SSH key fingerprints with an option checksum prefix. You can also specify
`*` to allow any key that's been added to the
`ssh-agent`.
`ssh-identities` are also supported in your override file. However, any
`ssh-identities` specified in your
`convey.yml` will be overridden by the values in the override file; they will not be merged.
**NOTE** If running on docker4mac, there is an [
issue](
https://github.com/docker/for-mac/issues/483) with xhyve (the hypervisor that the Docker daemon runs in) where you can't volume mount the
`ssh-agent` socket. You can use this [
workaround](
https://hub.docker.com/r/uber/ssh-agent-forward/) to expose the
`ssh-agent` via an alternative method.
- ivZaDYamb5xdguIUUVT7DXvXwvE9JLsOkOkR3XAfzeI
- SHA256:Efrocgd+rvwjDAnHt2jZAcwDqeka0s8Vv7N3m08cVnA
When using
`*` you have to quote it because
`*` treated specially in
`yaml`.
The extends option allows you to define a base configuration file. The filepath is relative to the current configuration file.
The current file will inherit the options, tasks, and plans of the base configuration file. If an option is supplied, or a task or plan with the same name is defined in the current file, it replaces the inherited item.
The tasks section defines each task. By defining them separately from the plan the tasks can be reused in multiple plans.
There are many tasks types that you can use by setting the
`type` attribute. However if the
`type` attribute is not set, it default to
`run`.
An extend task overrides the environment of another task.
| Name | Required | Default | Description |
| ---------------- | -------- | ------- | ----------- |
| task | Yes | | The name of the task to extend |
| environment | | | The override environment |
| expand | | | The envvars which can be expanded into lists on use |
| expand_delimiter | | ; | The string to split mapped values by |
The
`expand` and
`expand_delimiter` attributes allow an environment variable, which is an unstructured string, to act as if it is an array. This is useful for supplying an "abstract" parent task with several arguments for the same attribute (e.g. tags in a build task). Variables that occur in the environment with a name in expand will be split by the expand delimiter to form a list, where applicable.
image: gliderlabs/alpine:edge
#### Example with Variable Expansion source: gliderlabs/alpine:edge
A build task will build a docker image.
| Name | Required | Default | Description |
| ---------- | -------- | ------- | ----------- |
| dockerfile | Yes | | The dockerfile to use while building |
| files | | | A list of files that should be made available for the build |
| labels | | | A list of labels to set on the image being built |
| tag | | | The tag to apply to the image |
| tags | | | The list of tags as described above |
At least one tag must be supplied by either the
`tag` or
`tags` attribute. If both are
supplied,
`tag` is inserted to the front of
`tags`.
A clean task will remove files from the host relative and limited to the working directory of convey.
| Name | Required | Default | Description |
| --------- | -------- | ------- | ----------- |
| files | Yes | | A list of filenames relative to the convey working directory to remove. |
An export task copies files from the volume to the host.
| Name | Required | Default | Description |
| ----- | -------- | ------- | ----------- |
| files | Yes | | A single filename or a list of files to copy from the workspace to the host. Files can be specified in one of two forms which can be mixed. The first is
`source:destination` and the other is
`filename` where filename will be used for both the host and the volume. |
- binary:binary-linux-x86_64
An import task copies files from the host to the volume. It has one required attribute named sources. This is a list of files relative to the directory that convey was run from that will be copied into the volume.
| Name | Required | Default | Description |
| ----- | -------- | ------- | ----------- |
| files | Yes | | A single filename or a list of files to copy from the host to the workspace. Files can be specified in one of two forms which can be mixed. The first is
`source:destination` and the other is
`filename` where filename will be used for both the host and the volume. |
A login task will run docker login to login to a registry.
| Name | Required | Default | Description |
| -------- | -------- | ------- | ----------- |
| username | Yes | | The username to login with. |
| password | Yes | | The password to login with. |
| server | | | The server to login to. If omitted docker hub is used. |
A logout task will log you out from a Docker registry.
| Name | Required | Default | Description |
| ------ | -------- | ------- | ----------- |
| server | | | The server to logout from. If omitted docker hub is used. |
server: registry.my.domain:5000
A pull task pulls an image.
| Name | Required | Default | Description |
| ------ | -------- | ------- | ----------- |
| image | | | The name including the tag and registry of the image to pull. |
| images | | | A list of images as described above. |
At least one image must be supplied by either the
`image` or
`images` attribute. If both are
supplied,
`image` is inserted to the front of
`images`.
image: gliderlabs/alpine:edge
A push task pushes an image.
| Name | Required | Default | Description |
| ------ | -------- | ------- | ----------- |
| image | | | The name including the tag and registry of the image to push. |
| images | | | A list of images as described above. |
At least one image must be supplied by either the
`image` or
`images` attribute. If both are
supplied,
`image` is inserted to the front of
`images`.
- registry.my.domain:5000/newimage:master-latest
- registry.my.domain:5000/newimage:master-deadbeef
A remove task removes an image.
| Name | Required | Default | Description |
| ------ | -------- | ------- | ----------- |
| image | | | The name including the tag and registry of the image to remove. |
| images | | | A list of images as described above. |
At least one image must be supplied by either the
`image` or
`images` attribute. If both are
supplied,
`image` is inserted to the front of
`images`.
- registry.my.domain:5000/newimage:master-latest
- registry.my.domain:5000/newimage:master-deadbeef
A run task runs an image.
| Name | Required | Default | Description |
| ----------- | -------- | ---------- | ----------- |
| command | | | The command to run in the container. This is only necessary if the image does not provide a command by default. |
| detach | | false | Will run the container in the background allowing other tasks to run. The container will be cleaned up on exit. If the image has a HEALTHCHECK specified in the Dockerfile, convey will wait until it is healthy before proceeding. |
| entrypoint | | | The entrypoint to use for the container. This is only necessary if the image does not provide one by default. |
| environment | | | A list of environment variables to set. The should be specified in a
`NAME` or
`NAME=VALUE` format. If no value is provided, the value of the variable from the host will be provided if it is available. |
| healthcheck | | | See the HealthCheck attributes below. |
| image | Yes | | The image including the registry and tag to run. |
| labels | | | A list of labels to set on the image being built |
| workdir | | | The working directory to use in the container. |
| workspace | | /workspace | The path inside the container to mount the workspace volume. |
#### HealthCheck Attributes All of these attributes map directory to the
`--health` arguments to
`docker run`.
| -------- | ----------- |
| command | The command to run as the health check. |
| interval | The interval with which to check the health. |
| retries | The number of attempts before giving up. |
| start-period | How long to wait before starting to check the container's health. |
| timeout | How long to wait for a health check to return before aborting. |
A basic example where the image knows everything to do.
A basic example using a standard image to do something else
image: debian:jessie-slim
- wget https://somedomain.tld/file1
- wget https://somedomain.tld/file1.sha256
- sha256sum -c file1.sha256
A more compilicated example waiting for a detached nginx to start
command: wget http://localhost
A tag task will tag an existing image.
| Name | Required | Default | Description |
| ----------- | -------- | ---------- | ----------- |
| source | | | The source image, including registry and tag, to tag. |
| destination | | | The destination tag, including registry and tag, to tag. |
source: registry.my.domain:5000/newimage:latest
destination: registry.my.domain:5000/newimage:development
The environment section defines a list of environment variables to set for the run.
It should be specified in a
`NAME` or
`NAME=VALUE` format. If no value is provided, the value of the variable from the host will be provided if it is available.
The plans sections defines your execution plans which tie everything together by organizing
`tasks` into
`stages` into the order that they will be executed.
Each plan is defined by a name in the plans section.
Plans themselves are pretty straight forward. They group
`stages` with an optional
`environment`.
| Name | Required | Description |
| ----------- | -------- | ----------- |
| environment | | A list of environment variables to set. The should be specified in a
`NAME` or
`NAME=VALUE` format. If no value is provided, the value of the variable from the host will be provided if it is available. These environment variables will be applied on top of any that were set at the top-level. |
| stages | Yes | A list of
`stages` to be run as part of this
`plan` in the order that they should be run in. |
Stages group
`tasks` together into a logical unit. They can be run sequentially or concurrently.
| Name | Required | Default | Description |
| ----------- | -------- | ------- | ----------- |
| always | | false | (Deprecated, used run instead) Whether or not this stage should be run if a previous stage has failed. |
| enabled | | true | Whether or not to run the stage at all. |
| concurrent | | false | Whether or not the tasks should be run at the same time. |
| environment | | | A list of environment variables to set. The should be specified in a
`NAME` or
`NAME=VALUE` format. If no value is provided, the value of the variable from the host will be provided if it is available. These environment variables will be applied on top of any that were set at the top-level and the plan level. |
| name | | stageN | A name to give the stage.
| run | No | on-success | When a stage should be run. Possible values are
`on-success`,
`on-failure`, or
`always`. Defaults to
`on-success`. |
| tasks | Yes | | A list of task names to be run as part during this stage. If running sequentially they are run in the order that they are provided. |
Meta plans are used to group plans together and run them in serial. This is also possible via the command line by specifying multiple plans to run.
There is currently no support for nesting meta plans.
Meta plans contain a single attribute which is the list of
`plans` to run.
| Name | Required | Description |
| ----------- | -------- | ----------- |
| plans | Yes | A list of
`plans` to run in the order they should be run in. |