Skip to main content

tw labels

Manage workspace labels and resource labels.

Run tw labels -h to view supported label operations.

tw labels add

Add a label.

tw labels add [OPTIONS]

Options

OptionDescriptionRequiredDefault
-n, --nameLabel nameYesnull
-v, --valueLabel valueNonull
-w, --workspaceWorkspace numeric identifier or reference in OrganizationName/WorkspaceName format (defaults to TOWER_WORKSPACE_ID environment variable, or personal workspace if not set)NoTOWER_WORKSPACE_ID

Run tw labels add -h to view the required and optional fields for adding a label.

note

Resource labels consist of a name=value pair and can only be applied to compute environments, pipelines, runs, and actions. Labels require only a name and can be applied to pipelines, runs, and actions.

Examples

Example 1: Add a resource label (with value)

Command:

tw labels add -n environment -v production -w 123456789012345

Example output:

Label 'environment=production' added at [my-organization / my-workspace] workspace with id '268741348267491'

Example 2: Add a regular label (name only)

Command:

tw labels add -n high-priority -w 123456789012345

Example output:

Label 'high-priority' added at [my-organization / my-workspace] workspace with id '268741348267492'
tip

Resource labels (with values) are useful for cost tracking and filtering cloud resources. Regular labels are useful for categorizing and organizing pipelines, runs, and actions within Platform.

tw labels list

List labels.

tw labels list [OPTIONS]

Options

OptionDescriptionRequiredDefault
-t, --typeLabel type: normal, resource, or all (default: all)Noall
-f, --filterFilter labels by substringNonull
-w, --workspaceWorkspace numeric identifier or reference in OrganizationName/WorkspaceName format (defaults to TOWER_WORKSPACE_ID environment variable, or personal workspace if not set)NoTOWER_WORKSPACE_ID
--pagePage number for paginated results (default: 1)Nonull
--offsetRow offset for paginated results (default: 0)Nonull
--maxMaximum number of records to display (default: )Nonull

Run tw labels list -h to view the optional fields for filtering labels.

Example

Command:

tw labels list

Example output:

Labels at 97652229034604 workspace:

ID | Name | Value | Type
-----------------+------------------------+-----------+----------
116734717739444 | manual-fusion-amd64 | | Normal
120599302764779 | test-with-prefix | | Normal
128477232893714 | manual-fusion-arm64 | | Normal
214201679620273 | test-config-link | | Normal
244634136444435 | manual-nonfusion-amd64 | | Normal
9184612610501 | Resource1 | Value1 | Resource

tw labels update

Update a label.

tw labels update [OPTIONS]

Options

OptionDescriptionRequiredDefault
-i, --idLabel identifierYesnull
-n, --nameLabel nameNonull
-v, --valueLabel valueNonull
-w, --workspaceWorkspace numeric identifier or reference in OrganizationName/WorkspaceName format (defaults to TOWER_WORKSPACE_ID environment variable, or personal workspace if not set)NoTOWER_WORKSPACE_ID

Run tw labels update -h to view the required and optional fields for updating labels.

Example

Command:

tw labels update -i 444555666777888 -n label3 -w 123456789012345

Example output:

Label with id '444555666777888' at '123456789012345' workspace updated to 'label3'

tw labels delete

Delete a label.

tw labels delete [OPTIONS]

Options

OptionDescriptionRequiredDefault
-i, --idLabel IDYesnull
-w, --workspaceWorkspace numeric identifier or reference in OrganizationName/WorkspaceName format (defaults to TOWER_WORKSPACE_ID environment variable, or personal workspace if not set)NoTOWER_WORKSPACE_ID

Run tw labels delete -h to view the required and optional fields for deleting labels.

Example

Command:

tw labels delete -i 203879852150462

Example output:

Label '203879852150462' deleted at '97652229034604' workspace