Match Targets

Matching targets

The Match Targets functionality allows you to filter and select targets based on their ID, Scope, and Tags, rather than adding each target individually to an action. This feature enables precise matching of targets for specific actions within a pipeline, which is especially useful in projects with multiple environments, such as dev, stage, and production.

All selected criteria (ID, Scope, Tags) are applied using conjunction logic. This means that targets must meet all conditions simultaneously to be selected.

All selected criteria (ID, Scope, Tags) are applied simultaneously because they are connected using the logical AND operator. This means that targets must satisfy all the given conditions at the same time to be selected.

Image loading...

ID filtering

The target ID is unique, unlike the Name field (target name), which can be arbitrary and changed for organizational purposes. It is recommended to use the ID when matching targets in the Match Filters section.

In the ID field, you can use regular expressions (regex) to easily match targets with a specific naming pattern.

Examples:

  • *stage - matches all targets that ID end with stage.
  • stage_* - matches all targets that ID begin with stage_.
  • * - matches all available targets regardless of the name.
Hint
If you want to search for targets with similar IDs (e.g., Stage or Dev), you need to ensure that the ID of a given target is correctly defined and matches the pattern.

Image loading...

Based on the target in this screenshot:

Image loading...

By entering the value stage_* in the ID field, the function will find all targets whose IDs start with stage_, including stage_backend, stage_frontend, and stage_api.

Scope filtering

Scope defines where the target is available.

  • Workspace - targets are available across all projects and pipelines within the workspace.
  • Project - targets are available only in the pipelines of a specific project.
  • Pipeline - targets assigned to a specific pipeline.

In the Scope section, you can select the appropriate option from the dropdown list to narrow the search for targets to a specific area.

Image loading...

Tag filtering

Tags enable the organization and search of targets based on assigned tags.

Regex does not work in the Tags field – you must select the exact tag name from those previously used.

Image loading...

Examples:

In the ID field, entering stage_* will find all targets related to the stage environment. In the Scope field, selecting Project will limit the results to targets assigned to the current project. In the Tags field, selecting the staging tag will narrow down the results and find only targets marked with this tag.

Image loading...

Last modified on Dec 5, 2024