Mario
Mario

Reputation: 425

How to force renovate to set azure pipeline task from "x@1" to "x@2" instead of "[email protected]"

[CONTEXT]

I use renovate (azure-pipeline manager) to update my YML azure pipelines tasks.

[NEED]

If my pipeline calls my-task@1, I don't want a PR that sets [email protected], I want to keep this notation my-task@2.

Hence, I keep using the latest minor/patch at each execution.

[RESEARCHES]

LLMs keep saying wrong suggestions using any config tag containing "version" or whatever, even with fine tuned and detailed prompts.

I have read the whole Renovate config page without finding my answer... Maybe I missed something. Thanks in advance.

Upvotes: 1

Views: 108

Answers (2)

DavidH
DavidH

Reputation: 83

In most cases only major version numbers are specified in YAML when referencing a task version: NodeTool@0. By default, Renovate replaces these with the full version: [email protected].

To use the standard convention for Azure Pipelines, add:

{
  "packageRules": [
    {
      "matchDatasources": ["azure-pipelines-tasks"],
      "extractVersion": "^(?<version>\\d+)"
    }
  ]
}

found in the renovate docs

Upvotes: 0

wade zhou - MSFT
wade zhou - MSFT

Reputation: 8478

If my pipeline calls my-task@1, I don't want a PR that sets [email protected], I want to keep this notation my-task@2.

As per your requirement, you want only major version to update.

You can try to use matchUpdateTypes to match only major version, and add "extractVersion": "^(?<version>\\d+)" in renovate.json for the trick.

{
  "azure-pipelines": {
    "enabled": true
  },
  "packageRules": [
    {
      "matchDatasources": ["azure-pipelines-tasks"],
      "extractVersion": "^(?<version>\\d+)"
    },
    {
      "packageNames": ["DownloadBuildArtifacts"],
      "matchUpdateTypes": ["major"],
      "labels": ["UPDATE-MAJOR"]
    }
  ]
}

The PR created:

enter image description here

Upvotes: 2

Related Questions