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

Renovate Not Detecting go.mod, go.sum #962

Closed evanstoddard23 closed 4 years ago

evanstoddard23 commented 4 years ago

Which Renovate are you using?

WhiteSource Renovate App

Which platform are you using?

GitHub.com

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

What would you like to do?

I would like Renovate to work with updates to Go packages. Currently I get PRs for terraform and GitHub actions, but none for Go, even though I have a go.mod and go.sum in a subdirectory in my repo.

{
  "extends": ["config:base", ":timezone(America/Chicago)", ":semanticCommits"],
  "packageRules": [
    {
      "updateTypes": ["patch"],
      "managers": ["terraform"],
      "semanticCommitType": "fix"
    },
    {
      "updateTypes": ["minor"],
      "managers": ["terraform"],
      "semanticCommitType": "feat"
    },
    {
      "updateTypes": ["major"],
      "managers": ["terraform"],
      "semanticCommitType": "feat!"
    },
    {
      "updateTypes": ["patch", "minor"],
      "automerge": true
    },
    {
      "paths": ["test/**"],
      "semanticCommitType": "chore"
    }
  ],
  "assigneesFromCodeOwners": true,
  "rebaseWhen": "behind-base-branch",
  "separateMinorPatch": true,
  "prHourlyLimit": 2
}
viceice commented 4 years ago

Please check the debug logs from app dashboard.

It would also help, if you provide a minimal reproduction repo.

rarkins commented 4 years ago

If you have any package files in test folders, it's ignored by this preset: https://docs.renovatebot.com/presets-default/#ignoremodulesandtests (which comes from config:base).

You can add this to config to disable that preset:

  "ignorePresets": [":ignoreModulesAndTests"]
evanstoddard23 commented 4 years ago

@rarkins that worked, thank you! I'm having another issue with this config (lmk if I should open a separate GH issue). I'm expecting my terraform dependencies under my test directory to get updates using the chore type, but am instead getting feat. This quote from the docs is what has me confused:

Renovate will evaluate all packageRules and not stop once it gets a first match. Therefore, you should order your packageRules in order of importance so that later rules can override settings from earlier rules if necessary.

{
  "extends": ["config:base", ":timezone(America/Chicago)", ":semanticCommits"],
  "ignorePresets": [":ignoreModulesAndTests"],
  "postUpdateOptions": ["gomodTidy"],
  "packageRules": [
    {
      "updateTypes": ["patch"],
      "managers": ["terraform"],
      "semanticCommitType": "fix"
    },
    {
      "updateTypes": ["minor", "major"],
      "managers": ["terraform"],
      "semanticCommitType": "feat"
    },
    {
      "updateTypes": ["patch", "minor"],
      "automerge": true
    },
    {
      "paths": ["test/**"],
      "extends": [":semanticCommitTypeAll(chore)"]
    }
  ],
  "assigneesFromCodeOwners": true,
  "rebaseWhen": "behind-base-branch",
  "separateMinorPatch": true
}
viceice commented 4 years ago

Do not use semanticCommitTypeAll in a package rule, as nested packaged rules are not supported.

Simply use "​semanticCommitType​"​: ​"​chore"​ in your tests rule

rarkins commented 4 years ago

I created https://github.com/renovatebot/renovate/issues/7649 to look into supporting that type of nested package rule + preset

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!

evanstoddard23 commented 4 years ago

Updated my config to this:

{
  "extends": ["config:base", ":timezone(America/Chicago)", ":semanticCommits"],
  "ignorePresets": [":ignoreModulesAndTests", ":prHourlyLimit2"],
  "postUpdateOptions": ["gomodTidy"],
  "packageRules": [
    {
      "updateTypes": ["patch"],
      "managers": ["terraform"],
      "semanticCommitType": "fix"
    },
    {
      "updateTypes": ["minor", "major"],
      "managers": ["terraform"],
      "semanticCommitType": "feat"
    },
    {
      "paths": ["test/**"],
      "semanticCommitType": "chore"
    },
    {
      "updateTypes": ["patch", "minor"],
      "automerge": true
    },
    {
      "managers": ["github-actions", "gomod"],
      "schedule": ["before 9am on monday"]
    }
  ],
  "assigneesFromCodeOwners": true,
  "rebaseWhen": "behind-base-branch",
  "separateMinorPatch": true
}

But I'm still getting Terraform updates under the test directory with type feat. The file is at test/basic-run/deps/main.tf

rarkins commented 4 years ago

Maybe the paths glob is somehow not matching. Can you reproduce this with same config in a public repo?

evanstoddard23 commented 4 years ago

@rarkins I replicated the issue here: https://github.com/evanstoddard23/renovate-test/pull/1

rarkins commented 4 years ago

@evanstoddard23 can you see if merging https://github.com/evanstoddard23/renovate-test/pull/2 makes a difference? There may be a specificity issue I hadn't expected.

evanstoddard23 commented 4 years ago

@rarkins looks like that did the trick!

rarkins commented 4 years ago

Glad to hear it. Unfortunately seems to be a legacy specificity issue. We consider rules with updateTypes to be the most specific you can be and so they are given preference regardless of ordering. We're going to need to do a breaking change before too long to revert that concept and instead just operate based on order.

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!