Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support registryAliases for customManagers #28699

Open
rarkins opened this issue Apr 27, 2024 Discussed in #28697 · 2 comments
Open

Support registryAliases for customManagers #28699

rarkins opened this issue Apr 27, 2024 Discussed in #28697 · 2 comments
Labels
manager:regex priority-4-low Low priority, unlikely to be done unless it becomes important to more people type:feature Feature (new functionality)

Comments

@rarkins
Copy link
Collaborator

rarkins commented Apr 27, 2024

Discussed in #28697

Originally posted by candrews April 27, 2024

How are you running Renovate?

Mend Renovate hosted app on github.com

If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.

No response

Please tell us more about your question or problem

The regex/custom manager doesn't apply registryAlias configuration to the registryUrl value (if present).

For example:

renovate.json

{
    "$schema": "https://docs.renovatebot.com/renovate-schema.json",
    "extends": [
        "config:base"
    ],
    "registryAliases": {
        "$CI_SERVER_URL": "https://gitlab.com",
        "https://$CI_SERVER_HOST": "https://gitlab.com"
    },
    "customManagers": [
        {
          "customType": "regex",
          "fileMatch": [".*\\.gitlab-ci\\.yml$"],
          "matchStrings": [
            "datasource=(?<datasource>.*?) depName=(?<depName>.*?) (versioning=(?<versioning>.*?))? (registryUrl=(?<registryUrl>.*?))?\\s.*?_VERSION:\\s*\"(?<currentValue>.*)\"\\s"
          ],
          "versioningTemplate": "{{#if versioning}}{{{versioning}}}{{else}}semver{{/if}}"
        }
    ]
}

and .gitlab-ci.yml

test:
  variables:
    # renovate: datasource=gitlab-tags depName=gitlab-com/gl-infra/common-ci-tasks versioning=semver registryUrl=https://${CI_SERVER_HOST}
    GITLAB_COMMON_CI_TASKS_VERSION: "v2.5.0"
    testing: "yes"

Renovate should report a version update being available, but instead the Dependency Dashboard shows a warning:

Renovate failed to look up the following dependencies: Failed to look up gitlab-tags package gitlab-com/gl-infra/common-ci-tasks.

Files affected: .gitlab-ci.yml

Renovate should apply the registry alias configuration in this case.

Project demonstrating this issue: https://github.com/candrews/renovate-registry-url-test/

Logs (if relevant)

Logs
DEBUG: Deleted cached dep updates
INFO: Dependency extraction complete
{
  "baseBranch": "main"
  "stats": {
    "managers": {
      "regex": {
        "fileCount": 1,
        "depCount": 1
      }
    },
    "total": {
      "fileCount": 1,
      "depCount": 1
    }
  }
}

DEBUG: hostRules: no authentication for ${ci_server_host}
DEBUG: GET https://${ci_server_host}/api/v4/projects/gitlab-com%2Fgl-infra%2Fcommon-ci-tasks/repository/tags?per_page=100 = (code=ENOTFOUND, statusCode=-1 retryCount=2, duration=1)
DEBUG: Gitlab API error
{
  "err": {
    "name": "RequestError",
    "code": "ENOTFOUND",
    "timings": {
      "start": 1714177595111,
      "socket": 1714177595111,
      "lookup": 1714177595112,
      "error": 1714177595112,
      "phases": {
        "wait": 0,
        "dns": 1,
        "total": 1
      }
    },
    "message": "getaddrinfo ENOTFOUND ${ci_server_host}",
    "stack": "RequestError: getaddrinfo ENOTFOUND ${ci_server_host}\n    at ClientRequest.<anonymous> (/usr/local/renovate/node_modules/.pnpm/got@11.8.6/node_modules/got/dist/source/core/index.js:970:111)\n    at Object.onceWrapper (node:events:632:26)\n    at ClientRequest.emit (node:events:529:35)\n    at ClientRequest.emit (node:domain:489:12)\n    at ClientRequest.origin.emit (/usr/local/renovate/node_modules/.pnpm/@szmarczak+http-timer@4.0.6/node_modules/@szmarczak/http-timer/dist/source/index.js:43:20)\n    at TLSSocket.socketErrorListener (node:_http_client:501:9)\n    at TLSSocket.emit (node:events:517:28)\n    at TLSSocket.emit (node:domain:489:12)\n    at emitErrorNT (node:internal/streams/destroy:151:8)\n    at emitErrorCloseNT (node:internal/streams/destroy:116:3)\n    at processTicksAndRejections (node:internal/process/task_queues:82:21)\n    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:107:26)",
    "options": {
      "headers": {
        "user-agent": "RenovateBot/37.321.2 (https://github.com/renovatebot/renovate)",
        "accept": "application/json",
        "accept-encoding": "gzip, deflate, br"
      },
      "url": "https://${ci_server_host}/api/v4/projects/gitlab-com%2Fgl-infra%2Fcommon-ci-tasks/repository/tags?per_page=100",
      "hostType": "gitlab-tags",
      "username": "",
      "password": "",
      "method": "GET",
      "http2": false
    }
  }
}

DEBUG: Datasource connection error
{
  "datasource": "gitlab-tags"
  "packageName": "gitlab-com/gl-infra/common-ci-tasks"
  "errCode": "ENOTFOUND"
}

DEBUG: Failed to look up gitlab-tags package gitlab-com/gl-infra/common-ci-tasks
{
  "dependency": "gitlab-com/gl-infra/common-ci-tasks"
  "packageFile": ".gitlab-ci.yml"
}

from https://developer.mend.io/github/candrews/renovate-registry-url-test/-/job/a59304a4-09ac-4898-afa2-878cd94ab342

@rarkins rarkins added type:bug Bug fix of existing functionality priority-4-low Low priority, unlikely to be done unless it becomes important to more people manager:regex labels Apr 27, 2024
@viceice
Copy link
Member

viceice commented Apr 29, 2024

this is not a bug. only a few managers support registry aliases. it's documented

https://docs.renovatebot.com/configuration-options/#registryaliases

@rarkins
Copy link
Collaborator Author

rarkins commented Apr 29, 2024

Users think everything's a bug :)

@viceice viceice added type:feature Feature (new functionality) and removed type:bug Bug fix of existing functionality labels Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
manager:regex priority-4-low Low priority, unlikely to be done unless it becomes important to more people type:feature Feature (new functionality)
Projects
None yet
Development

No branches or pull requests

2 participants