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

separateMajorMinor flag in package rule doesn't override the global one for grouped dependencies #10190

Closed
2 of 6 tasks
hisener opened this issue May 27, 2021 · 7 comments
Closed
2 of 6 tasks
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality

Comments

@hisener
Copy link
Contributor

hisener commented May 27, 2021

How are you running Renovate?

  • WhiteSource Renovate hosted app on github.com
  • Self hosted

Renovate version: 25.31.2

Describe the bug

separateMajorMinor flag in package rules doesn't seem to be overridden the global value for grouped dependencies.

For instance,

"separateMajorMinor": false,
"packageRules": [
  {
    "matchPackagePatterns": [
      "^org\\.eclipse\\.jetty:jetty-bom$",
      "^version\\.hibernate-validator$"
    ],
    "separateMajorMinor": true,
    "separateMinorPatch": true
  }
]

We should have two PRs for Hibernate Validator 6.1.7.Final given that 6.2.0.Final and 7.0.1.Final are available. However, there is only one open PR: hisener/renovate-tests#65

Seems like it only affects grouped dependencies as we have two separate PRs for Jetty. See hisener/renovate-tests#63 and hisener/renovate-tests#64.

Renovate config: https://github.com/hisener/renovate-tests/blob/master/renovate.json

See also #9746 (comment).

Relevant debug logs

Click me to see logs
DEBUG: packageFiles with updates
{
  "config": {
    "maven": [
      {
        "datasource": "maven",
        "packageFile": "pom.xml",
        "deps": [
          {
            "datasource": "maven",
            "depName": "org.hibernate.validator:hibernate-validator",
            "currentValue": "6.1.7.Final",
            "fileReplacePosition": 536,
            "registryUrls": [
              "https://repo.maven.apache.org/maven2"
            ],
            "groupName": "version.hibernate-validator",
            "depIndex": 0,
            "warnings": [],
            "currentVersion": "6.1.7.Final",
            "isSingleVersion": true,
            "fixedVersion": "6.1.7.Final",
            "updates": [
              {
                "bucket": "latest",
                "newVersion": "7.0.1.Final",
                "newValue": "7.0.1.Final",
                "releaseTimestamp": "2021-02-06T18:26:43.000Z",
                "newMajor": 7,
                "newMinor": 0,
                "updateType": "major",
                "branchName": "renovate/hibernate-validator"
              }
            ]
          },
          {
            "datasource": "maven",
            "depName": "org.hibernate.validator:hibernate-validator-test-utils",
            "currentValue": "6.1.7.Final",
            "fileReplacePosition": 536,
            "registryUrls": [
              "https://repo.maven.apache.org/maven2"
            ],
            "groupName": "version.hibernate-validator",
            "depIndex": 1,
            "warnings": [],
            "currentVersion": "6.1.7.Final",
            "isSingleVersion": true,
            "fixedVersion": "6.1.7.Final",
            "updates": [
              {
                "bucket": "latest",
                "newVersion": "7.0.1.Final",
                "newValue": "7.0.1.Final",
                "releaseTimestamp": "2021-02-06T18:26:28.000Z",
                "newMajor": 7,
                "newMinor": 0,
                "updateType": "major",
                "branchName": "renovate/hibernate-validator"
              }
            ]
          },
          {
            "datasource": "maven",
            "depName": "org.eclipse.jetty:jetty-bom",
            "currentValue": "9.4.40.v20210413",
            "fileReplacePosition": 1286,
            "registryUrls": [
              "https://repo.maven.apache.org/maven2"
            ],
            "depType": "import",
            "depIndex": 2,
            "warnings": [],
            "sourceUrl": "https://github.com/eclipse/jetty.project",
            "homepage": "https://eclipse.org/jetty",
            "currentVersion": "9.4.40.v20210413",
            "isSingleVersion": true,
            "fixedVersion": "9.4.40.v20210413",
            "updates": [
              {
                "bucket": "patch",
                "newVersion": "9.4.41.v20210516",
                "newValue": "9.4.41.v20210516",
                "releaseTimestamp": "2021-05-17T00:08:06.000Z",
                "newMajor": 9,
                "newMinor": 4,
                "updateType": "patch",
                "branchName": "renovate/org.eclipse.jetty-jetty-bom-9.4.x"
              },
              {
                "bucket": "major",
                "newVersion": "11.0.3",
                "newValue": "11.0.3",
                "releaseTimestamp": "2021-05-20T22:05:15.000Z",
                "newMajor": 11,
                "newMinor": 0,
                "updateType": "major",
                "branchName": "renovate/org.eclipse.jetty-jetty-bom-11.x"
              }
            ]
          },
          {
            "datasource": "maven",
            "depName": "org.apache.maven.plugins:maven-compiler-plugin",
            "currentValue": "3.8.1",
            "fileReplacePosition": 1709,
            "registryUrls": [
              "https://repo.maven.apache.org/maven2"
            ],
            "depIndex": 3,
            "warnings": [],
            "currentVersion": "3.8.1",
            "fixedVersion": "3.8.1",
            "updates": []
          },
          {
            "datasource": "maven",
            "depName": "org.hibernate.validator:hibernate-validator-annotation-processor",
            "currentValue": "6.1.7.Final",
            "fileReplacePosition": 536,
            "registryUrls": [
              "https://repo.maven.apache.org/maven2"
            ],
            "groupName": "version.hibernate-validator",
            "depIndex": 4,
            "warnings": [],
            "currentVersion": "6.1.7.Final",
            "isSingleVersion": true,
            "fixedVersion": "6.1.7.Final",
            "updates": [
              {
                "bucket": "latest",
                "newVersion": "7.0.1.Final",
                "newValue": "7.0.1.Final",
                "releaseTimestamp": "2021-02-06T18:26:48.000Z",
                "newMajor": 7,
                "newMinor": 0,
                "updateType": "major",
                "branchName": "renovate/hibernate-validator"
              }
            ]
          }
        ]
      }
    ]
  }
}
DEBUG: processRepo()
DEBUG: Processing 3 branches: renovate/hibernate-validator, renovate/org.eclipse.jetty-jetty-bom-11.x, renovate/org.eclipse.jetty-jetty-bom-9.4.x

Have you created a minimal reproduction repository?

  • I have provided a minimal reproduction repository
  • I don't have time for that, but it happens in a public repository I have linked to
  • I don't have time for that, and cannot share my private repository
  • The nature of this bug means it's impossible to reproduce publicly
@hisener hisener added priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started type:bug Bug fix of existing functionality labels May 27, 2021
@github-actions
Copy link
Contributor

Thank you for providing a reproduction! 🎉 🚀

The Renovate team will take a look at the reproduction repository. Once we confirm the provided repository reproduces the problem, the label will be changed to reproduction:confirmed.

@rarkins
Copy link
Collaborator

rarkins commented May 27, 2021

This seems to be occurring due to the variable-based grouping (hibernate-validator). I wonder if your package rule is actually matching it at all and it's nothing to do with separateMajorMinor/etc. Can you try "^hibernate-validator$"? The logs should give an indication of which depName is being used.

@hisener
Copy link
Contributor Author

hisener commented May 27, 2021

In hisener/renovate-tests@b458ada. Looks like it didn't help, they are still in the latest bucket. Still only one PR: hisener/renovate-tests#66.

Relevant debug logs

Click me to see logs
DEBUG: migrated config
{
  "config": {
    "$schema": "https://docs.renovatebot.com/renovate-schema.json",
    "extends": [
      "github>whitesource/merge-confidence:beta",
      "config:base"
    ],
    "ignorePresets": [
      ":prHourlyLimit2"
    ],
    "separateMajorMinor": false,
    "packageRules": [
      {
        "matchPackagePatterns": [
          "^org\\.eclipse\\.jetty:jetty-bom$",
          "^hibernate-validator$"
        ],
        "separateMajorMinor": true,
        "separateMinorPatch": true
      }
    ]
  }
}

...

DEBUG: packageFiles with updates
{
  "config": {
    "maven": [
      {
        "datasource": "maven",
        "packageFile": "pom.xml",
        "deps": [
          {
            "datasource": "maven",
            "depName": "org.hibernate.validator:hibernate-validator",
            "currentValue": "6.1.7.Final",
            "fileReplacePosition": 536,
            "registryUrls": [
              "https://repo.maven.apache.org/maven2"
            ],
            "groupName": "version.hibernate-validator",
            "depIndex": 0,
            "warnings": [],
            "currentVersion": "6.1.7.Final",
            "isSingleVersion": true,
            "fixedVersion": "6.1.7.Final",
            "updates": [
              {
                "bucket": "latest",
                "newVersion": "7.0.1.Final",
                "newValue": "7.0.1.Final",
                "releaseTimestamp": "2021-02-06T18:26:43.000Z",
                "newMajor": 7,
                "newMinor": 0,
                "updateType": "major",
                "branchName": "renovate/hibernate-validator"
              }
            ]
          },
          {
            "datasource": "maven",
            "depName": "org.hibernate.validator:hibernate-validator-test-utils",
            "currentValue": "6.1.7.Final",
            "fileReplacePosition": 536,
            "registryUrls": [
              "https://repo.maven.apache.org/maven2"
            ],
            "groupName": "version.hibernate-validator",
            "depIndex": 1,
            "warnings": [],
            "currentVersion": "6.1.7.Final",
            "isSingleVersion": true,
            "fixedVersion": "6.1.7.Final",
            "updates": [
              {
                "bucket": "latest",
                "newVersion": "7.0.1.Final",
                "newValue": "7.0.1.Final",
                "releaseTimestamp": "2021-02-06T18:26:28.000Z",
                "newMajor": 7,
                "newMinor": 0,
                "updateType": "major",
                "branchName": "renovate/hibernate-validator"
              }
            ]
          },
          {
            "datasource": "maven",
            "depName": "org.eclipse.jetty:jetty-bom",
            "currentValue": "9.4.40.v20210413",
            "fileReplacePosition": 1286,
            "registryUrls": [
              "https://repo.maven.apache.org/maven2"
            ],
            "depType": "import",
            "depIndex": 2,
            "warnings": [],
            "sourceUrl": "https://github.com/eclipse/jetty.project",
            "homepage": "https://eclipse.org/jetty",
            "currentVersion": "9.4.40.v20210413",
            "isSingleVersion": true,
            "fixedVersion": "9.4.40.v20210413",
            "updates": [
              {
                "bucket": "patch",
                "newVersion": "9.4.41.v20210516",
                "newValue": "9.4.41.v20210516",
                "releaseTimestamp": "2021-05-17T00:08:06.000Z",
                "newMajor": 9,
                "newMinor": 4,
                "updateType": "patch",
                "branchName": "renovate/org.eclipse.jetty-jetty-bom-9.4.x"
              },
              {
                "bucket": "major",
                "newVersion": "11.0.3",
                "newValue": "11.0.3",
                "releaseTimestamp": "2021-05-20T22:05:15.000Z",
                "newMajor": 11,
                "newMinor": 0,
                "updateType": "major",
                "branchName": "renovate/org.eclipse.jetty-jetty-bom-11.x"
              }
            ]
          },
          {
            "datasource": "maven",
            "depName": "org.apache.maven.plugins:maven-compiler-plugin",
            "currentValue": "3.8.1",
            "fileReplacePosition": 1709,
            "registryUrls": [
              "https://repo.maven.apache.org/maven2"
            ],
            "depIndex": 3,
            "warnings": [],
            "currentVersion": "3.8.1",
            "fixedVersion": "3.8.1",
            "updates": []
          },
          {
            "datasource": "maven",
            "depName": "org.hibernate.validator:hibernate-validator-annotation-processor",
            "currentValue": "6.1.7.Final",
            "fileReplacePosition": 536,
            "registryUrls": [
              "https://repo.maven.apache.org/maven2"
            ],
            "groupName": "version.hibernate-validator",
            "depIndex": 4,
            "warnings": [],
            "currentVersion": "6.1.7.Final",
            "isSingleVersion": true,
            "fixedVersion": "6.1.7.Final",
            "updates": [
              {
                "bucket": "latest",
                "newVersion": "7.0.1.Final",
                "newValue": "7.0.1.Final",
                "releaseTimestamp": "2021-02-06T18:26:48.000Z",
                "newMajor": 7,
                "newMinor": 0,
                "updateType": "major",
                "branchName": "renovate/hibernate-validator"
              }
            ]
          }
        ]
      }
    ]
  }
}
DEBUG: processRepo()

@rarkins rarkins added priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others status:ready and removed priority-5-triage status:requirements Full requirements are not yet known, so implementation should not be started labels May 31, 2021
@hisener
Copy link
Contributor Author

hisener commented Jun 11, 2021

@rarkins I saw you've added the status:ready label. Do you think this is something I can pick it up? But I will need some pointers. :)

@rarkins
Copy link
Collaborator

rarkins commented Jun 11, 2021

Honestly, I forgot why I marked it as ready. I think I worked out in my head what was going on but only updated the label instead of adding the description. Is it possible for you to separate this reproduction into its own repo so that only the minimum dependencies are present? Then I'll try to step through it again and let you know if I am able to fix it right away or if it will need your help.

@hisener
Copy link
Contributor Author

hisener commented Jun 11, 2021

I've already reset the repo before creating the reproduction. Currently, it contains 3 grouped dependencies and one independent dependency (to show it works fine for non-grouped dependencies). Please have a look at https://github.com/hisener/renovate-tests/blob/master/pom.xml. Let me know if that works.

@Gabriel-Ladzaretti
Copy link
Collaborator

Looks like a configuration issue.
Was able to get the expected result with the following changes:

{
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
  "extends": [
    "config:base"
  ],
  "ignorePresets": [
     ":prHourlyLimit2"
  ],
  "separateMajorMinor": false,
  "packageRules": [
    {
      "matchPackagePatterns": [
        "^org\\.eclipse\\.jetty:jetty-bom$",
-       "^hibernate-validator$",
+       "^org\\.hibernate\\.validator:hibernate"
      ],
      "separateMajorMinor": true,
      "separateMinorPatch": true,
+     "groupName": "group jetty&hibernate-validator"
    }
  ]
}

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants