pub trait Resource {
    type Version: Serialize + DeserializeOwned;
    type Source: DeserializeOwned;
    type InParams: DeserializeOwned;
    type InMetadata: Serialize + IntoMetadataKV;
    type OutParams: DeserializeOwned;
    type OutMetadata: Serialize + IntoMetadataKV;
    fn resource_check(
        source: Option<Self::Source>,
        version: Option<Self::Version>
    ) -> Vec<Self::Version>;
fn resource_in(
        source: Option<Self::Source>,
        version: Self::Version,
        params: Option<Self::InParams>,
        output_path: &str
    ) -> Result<InOutput<Self::Version, Self::InMetadata>, Box<dyn Error>>;
fn resource_out(
        source: Option<Self::Source>,
        params: Option<Self::OutParams>,
        input_path: &str
    ) -> OutOutput<Self::Version, Self::OutMetadata>; fn build_metadata() -> BuildMetadata { ... } }
Expand description

The methods and associated types needed to implement a resource

Associated Types

A version of the resource

Resource configuration, from the source field

Parameters for the “in” step, from the params field

A list of key-value pairs for the “in” step. This data is intended for public consumption and will make it upstream, intended to be shown on the build’s page.

Parameters for the “out” step, from the params field

A list of key-value pairs for the “out” step. This data is intended for public consumption and will make it upstream, intended to be shown on the build’s page.

Required methods

A resource type’s check method is invoked to detect new versions of the resource. It is given the configured source and current version, and must return the array of new versions, in chronological order, including the requested version if it’s still valid.

Concourse documentation

The in method is passed the configured source, a precise version of the resource to fetch and a destination directory. The method must fetch the resource and place it in the given directory.

If the desired resource version is unavailable (for example, if it was deleted), the method must return an error.

The method must return the fetched version, and may return metadata as a list of key-value pairs. This data is intended for public consumption and will make it upstream, intended to be shown on the build’s page.

Concourse documentation

The out method is called with the resource’s source configuration, the configured params and a path to the directory containing the build’s full set of sources.

The script must return the resulting version of the resource. Additionally, it may return metadata as a list of key-value pairs. This data is intended for public consumption and will make it upstream, intended to be shown on the build’s page.

Concourse documentation

Provided methods

When used in a “get” or “put” step, will return metadata about the running build is made available via environment variables.

Concourse documentation

Implementors