jycouet / VSTSExtensions

MIT License
30 stars 11 forks source link

Started getting error "npx: command not found: renovate" after July 21th 2024. #78

Closed mlanglet closed 2 weeks ago

mlanglet commented 3 weeks ago

I noticed our renovate pipeline has had a few failed weekly executions. The first error was because we were using node version 20.9.0 which was too old for the renovate task. I have tried using node version 20.17.0 and 21.7.3 but both results in the same error. Please advise!

Build output

Starting: Renovate
==============================================================================
Task         : Renovate Me
Description  : Renovate your libs on your selected Azure Repo
Version      : 1.0.5
Author       : Jean-Yves COUET
Help         : [Renovate Me](https://marketplace.visualstudio.com/items?itemName=jyc.vsts-extensions-renovate-me) based on [renovate](https://github.com/singapore/renovate)
==============================================================================
/opt/hostedtoolcache/node/10.24.1/x64/bin/npx --yes --package renovate@latest -- renovate-config-validator

npx: installed 203 in 6.26s

npx: command not found: renovate

##[error]exec(npx, --yes --package renovate@latest -- renovate-config-validator): Error: The process '/opt/hostedtoolcache/node/10.24.1/x64/bin/npx' failed with exit code 127
##[error]Error: exec(npx, --yes --package renovate@latest -- renovate-config-validator): Error: The process '/opt/hostedtoolcache/node/10.24.1/x64/bin/npx' failed with exit code 127
Finishing: Renovate

Pipeline definition

trigger: none

schedules:
  - cron: "0 0 * * 1-4"
    displayName: "Run renovatebot at midnight (Monday-Thursday)"
    branches:
      include:
        - develop
    always: true

pool:
  vmImage: ubuntu-latest

steps:
  - task: UseNode@1
    displayName: 'Use Node 21.7.3'
    inputs:
      versionSpec: '21.7.3'
  - task: RenovateMe@1
    inputs:
      renovateOptionsVersion: 'latest'
    displayName: Renovate
jycouet commented 3 weeks ago

So it's sometime failing sometime not? 🤔

mlanglet commented 3 weeks ago

It's failing consistently right now.

jycouet commented 3 weeks ago

Hummm, I'm not using renovateMe anymore but directly renovate (in github), and from the same date I have also issues with renovate! On my side, it seems to be a config that was deprecated and not working anymore.

Here is the discussion: https://github.com/renovatebot/renovate/discussions/30891

Maybe you can share your config file? You can also try to point to an old renovate version to see ?

mlanglet commented 2 weeks ago

Interesting, I'll try to run with an older version, thanks.

Here is our config file.

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "packageRules": [
    {
      "groupName": "all non-major dependencies",
      "groupSlug": "all-minor-patch",
      "matchPackagePatterns": [
        "*"
      ],
      "matchUpdateTypes": [
        "minor",
        "patch"
      ]
    },
    {
      "datasources": [
        "docker"
      ],
      "packageNames": [
        "postgres"
      ],
      "allowedVersions": "13.12"
    },
    {
      "datasources": [
        "docker"
      ],
      "packageNames": [
        "eclipse-temurin"
      ],
      "allowedVersions": "21-jre-alpine"
    }
  ]
}
jycouet commented 2 weeks ago

I updated https://github.com/renovatebot/renovate/discussions/30891#discussioncomment-10448176

Can you also add more logs ? Maybe it's saying that one key is not valid ?

mlanglet commented 2 weeks ago

I tried adding

    env:
      LOG_LEVEL: debug

But I don't get any additional logs.

Isn't this problem caused because the extension doesn't seem to have access to the renovate command via npx for some reason? I'm not sure why that would happen though.

npx: command not found: renovate

mlanglet commented 2 weeks ago

It's one of those days. Feeling kinda stupid right now.

Swapping from the task NodeTool@0 to UseNode@1 changes the parameter name from versionSpec to version. If none is provided it defaults to node 10.x.. No wonder it couldn't find the command.

Updated and working pipeline definition:

trigger: none

schedules:
  - cron: "0 0 * * 1-4"
    displayName: "Run renovatebot at midnight (Monday-Thursday)"
    branches:
      include:
        - develop
    always: true

pool:
  vmImage: ubuntu-latest

steps:
  - task: UseNode@1
    displayName: 'Use Node 20.17.0'
    inputs:
      version: '20.17.0'
  - task: RenovateMe@1
    displayName: Renovate

Please excuse my idiocy, case closed.

jycouet commented 2 weeks ago

Haha, thanks or the update. I like this issues where I have nothing to do ;)