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

Repeated commit to branch with same update #960

Closed literat closed 4 years ago

literat commented 4 years ago

Which Renovate are you using?

Renovate Open Source CLI

Which platform are you using?

Bitbucket Server

Have you checked the logs? Don't forget to include them if relevant

renovate.log

What would you like to do?

Hi, I do not understand behaviour of renovate bot when updating same branch on every run. Here is an image for example:

Screenshot 2020-11-02 at 08 49 53

It is so much noisy and looks like an issue for me.

I am expecting that the change happen once or twice or when new version of package is published but not instantly on every run which is happening now (every hour).

Have I something misconfigured badly? Here is project config:

{
  "extends": [
    ":prConcurrentLimit10"
  ],
  "branchPrefix": "dependencies/",
  "commitMessagePrefix": "Deps: ",
  "packageRules": [
    {
      "packagePatterns": [
        "hoek",
        "hawk",
        "mime",
        "qs",
        "request",
        "acorn",
        "cryptfiles",
        "js-yaml",
        "node"
      ],
      "enabled": false
    },
    {
      "packagePatterns": [ "eslint" ],
      "groupName": "eslint"
    },
    {
      "packagePatterns": [ "@babel", "babel" ],
      "groupName": "babel"
    },
    {
      "packagePatterns": [ "@graphql", "graphql" ],
      "groupName": "graphql"
    },
    {
      "packagePatterns": [ "jest" ],
      "groupName": "jest"
    },
    {
      "packagePatterns": [ "webpack" ],
      "groupName": "webpack"
    },
    {
      "packagePatterns": [ "enzyme" ],
      "groupName": "enzyme"
    },
    {
      "packagePatterns": [ "flow" ],
      "groupName": "flow"
    },
    {
      "packagePatterns": [ "react" ],
      "groupName": "react"
    },
    {
      "packagePatterns": [ "lodash" ],
      "groupName": "lodash"
    },
    {
      "packagePatterns": [ "apollo", "@apollo" ],
      "groupName": "apollo"
    },
    {
      "updateTypes": ["minor", "patch", "pin", "digest"],
      "automerge": true,
      "automergeType": "pr"
    }
  ],
  "enabledManagers": ["npm"],
  "rangeStrategy": "update-lockfile",
  "persistRepoData": true,
  "schedule": ["on monday"]
}

Thank you for your help or advice.

viceice commented 4 years ago

Did you changed your config recently? I see a pr conflict in your logs: image

How does your bot config looks like? How do you run renovate?

literat commented 4 years ago

Last change of project config is from 15th October when I have enabled automerge.

Here is bot config:

module.exports = {
  platform: 'bitbucket-server',
  endpoint: // endpoint
  username: 'jenkins',
  password: process.env.RENOVATE_TOKEN,
  gitAuthor: 'jenkins@lmc.eu',

  repositories: [
    // repos
  ],

  logLevel: 'info',

  requireConfig: true,
  onboarding: true,
  onboardingConfig: {
    "extends": [
      ":prConcurrentLimit10"
    ],
    "branchPrefix": "dependencies/",
    "commitMessagePrefix": "Deps: ",
    "rangeStrategy": "update-lockfile",
    "persistRepoData": true,
  },

  enabledManagers: [
    'npm', 'docker-compose', 'dockerfile', 'composer', 'maven', 'gradle'
  ],
};

We run renovate via Jenkins pipeline using renovate docker image.

rarkins commented 4 years ago

Simplest fix would be to rename then close all Renovate PRs, making sure to delete the branches too. You should then see them recreated on the next run (because the rename will trick Renovate into thinking they never existed) and hopefully stop seeing pushes on subsequent runs. But if you do, we know it's something reproducible with your current config.

literat commented 4 years ago

Ok, I do that.

Just for context. This behaviour is same in multiple projects and maybe causing another issues. Like newly created PRs with only package.json updated (major version) and no yarn.lock update. And few newly created eslint update PRs which are declined/closed in another run.

rarkins commented 4 years ago

Assume problems are separate until concluded otherwise.

rarkins commented 4 years ago
DEBUG: Error committing files (repository=~literat/test-renovate-bot-php, branch=dependencies/aws-aws-sdk-php-symfony-2.x)
       "err": {
         "task": {
           "commands": [
             "push",
             "origin",
             "dependencies/aws-aws-sdk-php-symfony-2.x:dependencies/aws-aws-sdk-php-symfony-2.x",
             "--force",
             "-u",
             "--no-verify",
             "--verbose",
             "--porcelain"
           ],
           "format": "utf-8"
         },
         "message": "Pushing to https://bitbucket.lmc.cz/scm/~literat/test-renovate-bot-php.git\nfatal: remote error: Insufficient permissions\nYou cannot push to ~LITERAT/test-renovate-bot-php. Pushing requires write\naccess and your access is read-only.\n",
         "stack": "Error: Pushing to https://bitbucket.lmc.cz/scm/~literat/test-renovate-bot-php.git\nfatal: remote error: Insufficient permissions\nYou cannot push to ~LITERAT/test-renovate-bot-php. Pushing requires write\naccess and your access is read-only.\n\n    at GitExecutorChain.onFatalException (/usr/src/app/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:66:77)\n    at GitExecutorChain.<anonymous> (/usr/src/app/node_modules/simple-git/src/lib/runners/git-executor-chain.ts:58:21)\n    at Generator.throw (<anonymous>)\n    at rejected (/usr/src/app/node_modules/simple-git/src/lib/runners/git-executor-chain.js:6:65)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (internal/process/task_queues.js:97:5)"
       }

If you have these types of errors, you're going to have a bad time

literat commented 4 years ago

Ok, I will treat them as separate problems. Thank you! 🔝 this is testing repo for PHP which is currently not used. My bad that is still part of that runs.

literat commented 4 years ago

Well, I try to rename created PRs and also delete them (both PR and a branch). Newly created branches are without updated yarn.lock and repeatedly updated. On multiple projects. That seems like an issue to me.

viceice commented 4 years ago

please provide new debug logs

rarkins commented 4 years ago

rangeStrategy=update-lockfile can result in regular commits to existing branches, because if there's any change to the lockfile on each run then the new version is pushed. e.g.

Run 1: Runs yarn update foo and commits lockfile Run 2: Runs yarn update foo. If the lockfile changed compared to Run 1, then it pushes the change

I suggest you also try removing persistRepoData to reduce the chances it is causing any problem.

literat commented 4 years ago

Here is new debug logs:

renovate.log

And I came over all runs in one PR and it looks like this:

Run 1: package.json modified Run 2: package.json + yarn.lock modified Run 3: package.json modified (yarn.lock missing) Run 4: package.json + yarn.lock modified Run 5: package.json modified (yarn.lock missing) and so on...

Diff in both files are always same, even hashes.

I can try remove persistRepoData but I added this option to reduce significant load of data when installing dependencies. You can see from logs that there are 6 repositories and the job is running for almost 40 min.

viceice commented 4 years ago

persistRepoData is a admin only config and can't be in onboardingConfig

literat commented 4 years ago

Ok, my bad. Removing...

viceice commented 4 years ago

Can you please provide a (public) github.com repo for minimal reproduction? eg: only add package.json (redacted), yarn.lock and renovate.json

rarkins commented 4 years ago

update-lockfile causes runs to be slow more than almost any feature, because it means a full yarn process must be run every time. If you are building an app instead of a library, please read https://docs.renovatebot.com/dependency-pinning/

rarkins commented 4 years ago

If you search for DEBUG: yarn.lock you can see the times when the yarn.lock needed updating and times when it didn't. Then it's usually combined with a count of files to commit, e.g.

DEBUG: yarn.lock hasn't changed (repository=~literat/test-renovate-bot-js, branch=dependencies/styled-components-5.x)
DEBUG: No updated lock files in branch (repository=~literat/test-renovate-bot-js, branch=dependencies/styled-components-5.x)
DEBUG: 1 file(s) to commit (repository=~literat/test-renovate-bot-js, branch=dependencies/styled-components-5.x)

I'm definitely starting to wonder if the persistRepoData setting is causing the problem. e.g. the yarn.lock is already updated from a previous run and Renovate thinks it doesn't need modifying again.

rarkins commented 4 years ago

If you can reduce this to a single dependency and branch and still reproduce it, it would be beneficial information.

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!