renovatebot / config-help

Please use the Discussions feature of https://github.com/renovatebot/renovate instead
https://github.com/renovatebot/renovate/discussions
MIT License
27 stars 16 forks source link

How to exactly pinpoint Yarn version used by Renovate #976

Closed p3k closed 4 years ago

p3k commented 4 years ago

Renovate Open Source CLI

Which platform are you using?

GitLab self-hosted

What would you like to do?

We are using Gradle as our main build system, together with gradle-node-plugin and a fixed Yarn version.

This was a deliberate decision after we ran into some troubles when different people using different Yarn versions pushed their yarn.lock files.

Besides the version string in build.gradle the path to this very version is defined in .yarnrc:

yarn-path "./.gradle/yarn/yarn-v1.22.4/bin/yarn"

When running the CI pipeline Renovate does not find this path:

internal/modules/cjs/loader.js:834
  throw err;
  ^
Error: Cannot find module '/builds/tobi/app/.gradle/yarn/yarn-v1.22.4/bin/yarn'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Certainly, we could now begin to install Gradle, i.e. Java, and our little Renovate job would become quite elaborate… Unless there might be a better way.

What is the best approach to make sure, Renovate is using this exact same version?

rarkins commented 4 years ago

Our official Docker Renovate image comes with all binaries installed.

If you are using a custom image or binaries then you'll need to be responsible for making sure they're found.

That error message isn't coming from Renovate directly - it's perhaps Gradle throwing it.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon if no further activity occurs. If this question is not done (either you plan to update it or are waiting on someone to respond) then please add a comment here to bump it and/or get the other person's attention. We aim to do our best to solve every problem. This bot is here to help us clean up issues which are no longer of use to the original poster, and not to close anything prematurely, so bump as you need!

p3k commented 4 years ago

If you are using a custom image or binaries then you'll need to be responsible for making sure they're found.

sure, and my question is about what can be done in renovate’s configuration, if anything…?

rarkins commented 4 years ago

Gradle seems to be trying to find /builds/tobi/app/.gradle/yarn/yarn-v1.22.4/bin/yarn so you need to make sure that file exists in the file system that you run Renovate/Gradle in. Maybe you need to run gradle install prior to Renovate for example?

It's Gradle looking for this file, not Renovate - so you need to solve it with Gradle.

p3k commented 4 years ago

OK so I did this:

  1. symlinking the path /builds/tobi/app/.gradle/yarn/yarn-v1.22.4/bin/yarn to $(which yarn)
  2. enforcing the desired yarn version with yarn policies set-version
  3. profit

closing this issue.