Skip to content

Class.Task

DecentM edited this page Jan 16, 2026 · 86 revisions

@decentm/concourse-ts / Task

Class: Task<Input, Output>

Defined in: components/task.ts:15

https://concourse-ci.org/docs/tasks/

Type Parameters

Input extends Identifier = Identifier

Output extends Identifier = Identifier

Constructors

new Task()

new Task<Input, Output>(name, customise?): Task<Input, Output>

Defined in: components/task.ts:66

https://concourse-ci.org/docs/tasks/

Parameters

name

string

The name of the task. Only used for error messages, task names are not included in the serialised output

customise?

(instance) => void

Returns

Task<Input, Output>

Properties

name

name: string

Defined in: components/task.ts:67

The name of the task. Only used for error messages, task names are not included in the serialised output

Methods

add_cache()

add_cache(...inputs): void

Defined in: components/task.ts:135

https://concourse-ci.org/docs/tasks/#task-config-schema

Parameters

inputs

...TaskCache[]

Returns

void


add_input()

add_input(...inputs): void

Defined in: components/task.ts:168

https://concourse-ci.org/docs/tasks/#input-schema

Parameters

inputs

...TaskInput<string>[]

Returns

void


add_output()

add_output(...outputs): void

Defined in: components/task.ts:181

https://concourse-ci.org/docs/tasks/#output-schema

Parameters

outputs

...TaskOutput<string>[]

Returns

void


as_task_step()

as_task_step(customise?): TaskStep<Input, Output>

Defined in: components/task.ts:228

Creates a TaskStep that already has this Task configured.

Parameters

customise?

(instance) => void

Customises the created TaskStep

Returns

TaskStep<Input, Output>


customise_task_step()

customise_task_step<CustomTask>(customise): void

Defined in: components/task.ts:53

Customises every TaskStep created from this Task instance. If called multiple times, only the last call will have an effect.

Type Parameters

CustomTask extends Task<Identifier, Identifier>

Parameters

customise

Customiser<TaskStep<Identifier, Identifier>, CustomTask>

Returns

void


serialise()

serialise(): Task<Input, Output>

Defined in: components/task.ts:251

Serialises this Task into a valid Concourse configuration fixture

Returns

Task<Input, Output>


set_cpu_limit_shares()

set_cpu_limit_shares(input): void

Defined in: components/task.ts:146

https://concourse-ci.org/docs/tasks/#container_limits-schema

Parameters

input

number

The amount of shares to allocate to this task

Returns

void


set_image_resource()

set_image_resource(input): void

Defined in: components/task.ts:89

Sets the image_resource of this task. If you pass a Resource, this function will create an anonymous resource from it automatically.

https://concourse-ci.org/docs/tasks/#task-config-schema

Parameters

input

Resource<never, never, never, never, never> | AnonymousResource<string>

Returns

void


set_memory_limit()

set_memory_limit(input): void

Defined in: components/task.ts:157

https://concourse-ci.org/docs/tasks/#container_limits-schema

Parameters

input

BytesInput

Returns

void


set_params()

set_params(params): void

Defined in: components/task.ts:204

Sets params in a key-value format. For example:

task.set_params(a: 1, b: 2)

task.serialise().params
//               ^ {a: '1', b: '2'}

https://concourse-ci.org/docs/tasks/#task-config-schema

Parameters

params

EnvVars

Returns

void


set_platform()

set_platform(platform): void

Defined in: components/task.ts:113

https://concourse-ci.org/docs/tasks/#task-config-schema

Parameters

platform

Platform

Returns

void


set_rootfs_uri()

set_rootfs_uri(rootfs_uri): void

Defined in: components/task.ts:218

https://concourse-ci.org/docs/tasks/#task-config-schema

Parameters

rootfs_uri

string

Returns

void


set_run()

set_run(run): void

Defined in: components/task.ts:124

https://concourse-ci.org/docs/tasks/#command-schema

Command

Parameters

run

Command

Returns

void


customise()

static customise(init): void

Defined in: components/task.ts:27

Customises every Task created after this function was called. If called multiple times, only the last call will have an effect.

Parameters

init

(instance) => void

Returns

void


customise_task_step()

static customise_task_step<CustomTask>(init): void

Defined in: components/task.ts:39

Customises every TaskStep created after this function was called. If called multiple times, only the last call will have an effect.

Type Parameters

CustomTask extends Task<Identifier, Identifier>

Parameters

init

Customiser<TaskStep<Identifier, Identifier>, CustomTask>

Returns

void

Clone this wiki locally