diff --git a/API.md b/API.md index ea13cd9..da0cffb 100644 --- a/API.md +++ b/API.md @@ -3511,7 +3511,7 @@ new TaskBuilder(scope: Construct, id: string) | **Name** | **Description** | | --- | --- | | buildTask | Builds the `Task`. | -| referencingTask | TODO. | +| referencingTask | Sets the taskRef field of the `Task`. | | specifyRunAfter | Allows you to specify the names of which task(s), if any, the 'Task' should run after in a pipeline. | | withAnnotation | Adds an annotation to the `Task` `metadata` with the provided key and value. | | withDescription | Sets the `description` of the `Task` being built. | @@ -3538,13 +3538,16 @@ Builds the `Task`. public referencingTask(task: string | IRemoteTaskResolver): TaskBuilder ``` -TODO. +Sets the taskRef field of the `Task`. + +Use only for tasks within pipelines: +overrides `logicalID as the name of the `Task` in its individual yaml. ###### `task`Required - *Type:* string | IRemoteTaskResolver -TODO. +as string: name of the local task being referenced as IRemoteTaskResolver: resolver for a task in remote location. --- @@ -3717,7 +3720,7 @@ Adds the specified workspace to the `Task`. | --- | --- | --- | | logicalID | string | *No description.* | | name | string | Gets the name of the `Task` in the context of a pipeline. | -| taskRef | TaskRef \| RemoteTaskRef | TODO. | +| taskRef | TaskRef \| RemoteTaskRef | Gets the taskRef field of the `Task` for use within a pipeline. | | description | string | Gets the `description` of the `Task`. | | parameters | ParameterBuilder[] | *No description.* | | runAfter | string[] | Gets the list of task names for the runAfter value of the `Task`. | @@ -3757,7 +3760,9 @@ public readonly taskRef: TaskRef | RemoteTaskRef; - *Type:* TaskRef | RemoteTaskRef -TODO. +Gets the taskRef field of the `Task` for use within a pipeline. + +If not set, a locally-scoped task named with the `logicalID` is used. --- diff --git a/src/builders.ts b/src/builders.ts index 0d5f7db..c3f26a6 100644 --- a/src/builders.ts +++ b/src/builders.ts @@ -893,8 +893,10 @@ export class TaskBuilder { } /** - * TODO - * @param task TODO + * Sets the taskRef field of the `Task`. Use only for tasks within pipelines: + * overrides `logicalID as the name of the `Task` in its individual yaml. + * @param task as string: name of the local task being referenced + * as IRemoteTaskResolver: resolver for a task in remote location */ public referencingTask(task: string | IRemoteTaskResolver): TaskBuilder { if (typeof(task) == 'string') { @@ -906,7 +908,8 @@ export class TaskBuilder { } /** - * TODO + * Gets the taskRef field of the `Task` for use within a pipeline. + * If not set, a locally-scoped task named with the `logicalID` is used. */ public get taskRef(): TaskRef | RemoteTaskRef { return this._taskref || { name: this._id }; @@ -943,7 +946,8 @@ export class TaskBuilder { }); }); - // Note: buildTask called for this TaskBuilder object only if this.taskRef is a TaskRef + // Note: buildTask called for this TaskBuilder object only if this.taskRef is a TaskRef, + // not if it is a RemoteTaskRef const taskName = ('name' in this.taskRef) ? this.taskRef.name : this.logicalID; const props: TaskProps = {