azure_pipelines.star¶
Edit Azure Pipelines YAML: hosted agent images, task versions and template refs.
Edits are line-based, so comments and layout stay as they were.
| Function | What it does |
|---|---|
pipelines |
Lists the repo's Azure Pipelines files. |
set_vm_image |
Sets vmImage on every pool that uses a Microsoft-hosted image. |
bump_task |
Moves a task to a new major version, such as Docker@1 to Docker@2. |
set_template_ref |
Sets the ref of a template repository under resources.repositories. |
pipelines¶
Lists the repo's Azure Pipelines files.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
Returns: The sorted paths of azure-pipelines*.yml files anywhere and of YAML files under .azure-pipelines and .azuredevops.
Example
set_vm_image¶
Sets vmImage on every pool that uses a Microsoft-hosted image.
Block (pool: then vmImage:) and flow (pool: { vmImage: ... }) forms
both work.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
image |
The new image, such as ubuntu-24.04. |
from_image |
When set, only this image is replaced, such as a retired ubuntu-20.04. |
Returns: The list of paths that changed.
Example
Used in: azure-ubuntu-24
bump_task¶
Moves a task to a new major version, such as Docker@1 to Docker@2.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
task |
The task name, such as PublishPipelineArtifact. |
major |
The new major version, such as 1. |
from_major |
When set, only this version is replaced. |
Returns: The list of paths that changed.
Example
Used in: azure-ubuntu-24
set_template_ref¶
Sets the ref of a template repository under resources.repositories.
A newer version already there is kept, so a campaign never lowers one.
The repository is matched by its name (the project/repo path), and a
missing ref is added.
Arguments
| Name | Description |
|---|---|
repo |
The repo passed to change(repo). |
name |
The repository's name, such as acme/pipeline-templates. |
ref |
The new ref, such as refs/tags/v2.0.0. |
Returns: The list of paths that changed.
Example
set_template_ref(repo, "acme/pipeline-templates", "refs/tags/v2.0.0")
# returns ["azure-pipelines.yml"]