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

Linked-versions internal merge is misconfigured #1778

Closed
luxaritas opened this issue Dec 14, 2022 · 2 comments
Closed

Linked-versions internal merge is misconfigured #1778

luxaritas opened this issue Dec 14, 2022 · 2 comments
Assignees
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@luxaritas
Copy link
Contributor

Environment details

GitHub Actions ubuntu-latest with release-please-action 3.7.1

Steps to reproduce

I've attempted to configure two linked-versions plugins to create two separate groups, like so:

{
  "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
  "plugins": [
    {
      "type": "node-workspace",
      "merge": false
    },
    {
      "type": "linked-versions",
      "groupName": "groupa",
      "components": [
        "groupa",
        "packages-groupa-pkga1",
        "packages-groupa-pkga2"
      ],
      "merge": false
    },
    {
      "type": "linked-versions",
      "groupName": "groupb",
      "components": [
        "groupb",
        "packages-groupb-pkgb1",
        "packages-groupb-pkgb2"
      ],
      "merge": false
    }
  ],
  "packages": {
    "packages/groupa": {
      "component": "groupa",
      "release-type": "simple"
    },
    "packages/groupa/pkga1": {
      "component": "packages-groupa-pkga1",
      "skip-github-release": true
    },
    "packages/groupa/pkga2": {
      "component": "packages-groupa-pkga2",
      "skip-github-release": true
    },
    "packages/groupb": {
      "component": "groupb",
      "release-type": "simple"
    },
    "packages/groupb/pkgb1": {
      "component": "packages-groupb-pkgb1",
      "skip-github-release": true
    },
    "packages/groupb/pkgb2": {
      "component": "packages-groupb-pkgb2",
      "skip-github-release": true
    }
  }
}

However, only the second group makes it to the release PR. It seems like this is due to the following error:

pull request missing version {
  path: '.',
  pullRequest: {
    title: PullRequestTitle {
      version: undefined,
      component: undefined,
      targetBranch: 'main',
      pullRequestTitlePattern: 'chore${scope}: release groupa libraries',
      matchPattern: /^chore(\((?<branch>[\w-./]+)\))?: release groupa libraries$/
    },
    body: PullRequestBody {
      header: ':robot: I have created a release *beep* *boop*',
      footer: 'This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).',
      extra: undefined,
      releaseData: [Array],
      useComponents: true
    },
    updates: [
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object]
    ],
    labels: [ 'autorelease: pending' ],
    headRefName: 'release-please--branches--main',
    draft: false
  },
  config: { releaseType: 'simple' }
}

Analysis

My understanding of this is that when the first linked-versions plugin does its internal merge, it creates a PR without a version, and then the second linked-version plugin throws out that PR even though it is out of scope. Additionally, this is complicated by the fact that linked-versions does not honor the merge configuration property, as it is never passed when constructed by its plugin factory.

Resolution

I see two potential resolutions here:

  1. Regardless, the plugin should respect "merge": false. I've confirmed that modifying the plugin factory to pass additional options like the workspace plugins do resolves the issue and results in all packages being included in the release
  2. I imagine it would still be nice to allow two linked-versions plugins to coexist and create separate PRs. What is the reason for ensuring a PR version when doing the merge? Can it be only verified for in-scope candidates, or maybe even removed entirely? This check is done in WorkspacePlugin as well, and it isn't clear why.
@luxaritas luxaritas added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Dec 14, 2022
@luxaritas
Copy link
Contributor Author

Another possible option here would be to allow the merge plugin to accept a version directly, which could also be desirable as that way if you have a separate release PR for different sets of linked packages, they can eg include their shared version in the PR title

@luxaritas
Copy link
Contributor Author

NB: The configuration for the setup of one-pr-per-group is a bit weird currently. You'd need separate-pull-requests to be off in the root config (to skip adding the final merge plugin), but it would need to be enabled for each package in the group (so that the linked-versions' merge includes them). Probably there should either be a separate root config option to enable or disable the final merge separate from setting the default for inclusion of all packages, or maybe there should be a setting on the linked-versions plugin to determine whether or not its combined PR should be noted as a separate PR or not (the latter is probably more flexible).

@chingor13 chingor13 added priority: p3 Desirable enhancement or fix. May not be included in next release. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

2 participants