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

chore(ci): ignore private repositories (esp. backstage app, backend) when release plugins #1510

Merged

Conversation

christoph-jerolimov
Copy link
Member

@christoph-jerolimov christoph-jerolimov commented Oct 10, 2024

Hey, I just made a Pull Request!

This fixes #1508 by adding this configuration all changeset config.jsons:

  "privatePackages": {
    "tag": false,
    "version": false
  }

See changesets/changesets#1093 (comment) and https://github.com/changesets/changesets/blob/main/packages/cli/CHANGELOG.md#2251

I tried this locally in the npm package, which contains a changeset and a backstage app.

Without this ignore list it touches these files:

	deleted:    .changeset/proud-brooms-clean.md
	modified:   packages/app/package.json
	modified:   plugins/npm/package.json
	new:        packages/app/CHANGELOG.md
	new:        plugins/npm/CHANGELOG.md

With this change, it touches only:

	deleted:    .changeset/proud-brooms-clean.md
	modified:   plugins/npm/package.json
	new:        plugins/npm/CHANGELOG.md

I noticed that the changeset CLI crashes if a workspace contains only private packages and plugins. As discussed, I raise another PR to fix that for the npm plugin.

✔️ Checklist

  • A changeset describing the change and affected packages. (more info)
  • Added or updated documentation
  • Tests for new functionality and regression tests for bug fixes
  • Screenshots attached (for UI changes)
  • All your commits have a Signed-off-by line in the message. (more info)

Copy link
Contributor

@04kash 04kash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! Should we maybe document this in CONTRIBUTING.md that if someone includes an example app/backend they should add "ignore": ["app", "backend"] in the respective workspace's .changeset/config.json?

Copy link
Contributor

@awanlin awanlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jerolimov, thanks for running with this! I was wondering if would it be possible to leverage the private property in the package.json to drive this? Packages with private: true don't get published which in turn means they don't need to be versioned. Using this would mean that we don't have to manually maintain this list in the .changeset/config.json.

@04kash
Copy link
Contributor

04kash commented Oct 17, 2024

Some of them do have private: true but are still being included in the Version Packages PR. Eg: the app package in redhat-argocd has the private property set in package.json but was still included in this Version Packages PR

So I think setting the private property to true prevents the package from being published but a Version Packages PR is still made for it.

@christoph-jerolimov
Copy link
Member Author

Yes, I had the same hope but couldn't find another solution yet.

As said, I also tried first to run yarn changeset version --ignore app --ignore backend, but it works only fine on projects with an backstage app, but fail on these without.

Copy link
Contributor

@awanlin awanlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christoph-jerolimov
Copy link
Member Author

Hi @jerolimov, I've since found this: changesets/changesets#1093 (comment). Can we try that instead, please?

If this works we should update this as well: https://github.com/backstage/community-plugins/blob/main/workspaces/repo-tools/packages/cli/src/lib/workspaces/.changeset/config.json

Thanks, that's a better approche! I'm looking into this. But after adding

  "privatePackages": {
    "tag": false,
    "version": false
  }

with and without updating @changeset/cli it crashes:

[nix-shell:~/git/backstage/community-plugins/workspaces/npm]$ yarn changeset
🦋  error TypeError: Cannot read properties of undefined (reading 'packageJson')
🦋  error     at createChangeset (/home/christoph/git/backstage/community-plugins/workspaces/npm/node_modules/@changesets/cli/dist/changesets-cli.cjs.js:416:75)
🦋  error     at add (/home/christoph/git/backstage/community-plugins/workspaces/npm/node_modules/@changesets/cli/dist/changesets-cli.cjs.js:512:26)
🦋  error     at async run (/home/christoph/git/backstage/community-plugins/workspaces/npm/node_modules/@changesets/cli/dist/changesets-cli.cjs.js:1345:5)

I'll move this to a draft and keep you updated.

@christoph-jerolimov christoph-jerolimov marked this pull request as draft October 19, 2024 22:05
@christoph-jerolimov christoph-jerolimov force-pushed the ignore-backstage-apps-and-backends branch from 114c31a to 2997439 Compare October 19, 2024 22:31
@christoph-jerolimov christoph-jerolimov changed the title fix(ci): ignore backstage app, app-next (if exist) and backend packages when release plugins chore(ci): ignore private repositories (esp. backstage app, backend) when release plugins Oct 19, 2024
@christoph-jerolimov christoph-jerolimov marked this pull request as ready for review October 19, 2024 22:32
@christoph-jerolimov christoph-jerolimov force-pushed the ignore-backstage-apps-and-backends branch from e49cdd0 to 9665078 Compare October 22, 2024 13:56
@awanlin
Copy link
Contributor

awanlin commented Oct 24, 2024

Thanks for the detailed follow up @christoph-jerolimov! Let's go with this:

  1. Keep the package private and remove the new attributes from workspaces/repo-tools/.changeset/config.json.
  • We can still change the config.json for new workspaces.
  • But the repo-tools is the only workspace with an unchanged config.json itself.

The repo-tool workspace is a special case and I think it's fine for now that it's not following this pattern.

@christoph-jerolimov christoph-jerolimov force-pushed the ignore-backstage-apps-and-backends branch from 9665078 to 10bb718 Compare October 26, 2024 22:16
@christoph-jerolimov
Copy link
Member Author

christoph-jerolimov commented Oct 26, 2024

Thanks for the detailed follow up @christoph-jerolimov! Let's go with this:

  1. Keep the package private and remove the new attributes from workspaces/repo-tools/.changeset/config.json.
  • We can still change the config.json for new workspaces.
  • But the repo-tools is the only workspace with an unchanged config.json itself.

The repo-tool workspace is a special case and I think it's fine for now that it's not following this pattern.

I rebased this PR and applied this change. This mean

  1. I removed the change from workspaces/repo-tools/.changeset/config.json
  2. I reverted the change in workspaces/repo-tools/packages/cli/package.json so that it includes the private: true flag again
  3. Kept the privatePackages flag in workspaces/repo-tools/packages/cli/src/lib/workspaces/.changeset/config.json
  4. Added the flat also to the workspace workspaces/mend/.changeset/config.json
find . -name config.json | grep -v node_modules | grep changeset | wc -l
82


grep -E '"updateInternalDependencies": "patch",$' -r workspaces/*/.changeset | wc -l
80


grep -E '"updateInternalDependencies": "patch"$' -r workspaces/*/.changeset        
workspaces/repo-tools/.changeset/config.json:  "updateInternalDependencies": "patch"


grep -E '"updateInternalDependencies": "patch",$' workspaces/repo-tools/packages/cli/src/lib/workspaces/.changeset/config.json 
  "updateInternalDependencies": "patch",

Thanks for your patience and let me know if I should address something else.

@christoph-jerolimov christoph-jerolimov force-pushed the ignore-backstage-apps-and-backends branch 3 times, most recently from 40174f1 to a1cc6ee Compare October 29, 2024 08:56
@christoph-jerolimov
Copy link
Member Author

@awanlin can you take a fresh look? Thanks :)

Copy link
Contributor

@awanlin awanlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @christoph-jerolimov, something seems to have gone wrong or I misunderstood the direction forward. None of the changes in this PR are using privatePackages and they are all still using ignore, also there are no repo-tool or mend changes. Can you take another look, please?

@christoph-jerolimov
Copy link
Member Author

Oh what a shame. Sorry, i switched between my pc and notebook and it looks like I rebased the old version. I will take a look later today.

@backstage-goalie
Copy link
Contributor

backstage-goalie bot commented Oct 29, 2024

Changed Packages

Package Name Package Path Changeset Bump Current Version
@backstage-community/cli workspaces/repo-tools/packages/cli none v0.0.3

@christoph-jerolimov
Copy link
Member Author

Oh what a shame. Sorry, i switched between my pc and notebook and it looks like I rebased the old version. I will take a look later today.

Fixed. (Rebased on the right machine. Code reviews are a life saver.)

Copy link
Contributor

@awanlin awanlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super close, if you can just remove the repo-tools changeset then we should be good to merge.

workspaces/repo-tools/.changeset/proud-ducks-knock.md Outdated Show resolved Hide resolved
…when release plugins

Signed-off-by: Christoph Jerolimov <[email protected]>
@christoph-jerolimov christoph-jerolimov force-pushed the ignore-backstage-apps-and-backends branch from 8279e37 to af4f860 Compare November 2, 2024 20:38
@christoph-jerolimov
Copy link
Member Author

Super close, if you can just remove the repo-tools changeset then we should be good to merge.

Sure. I've removed the file and rebased the branch. 🤞

Copy link
Contributor

@awanlin awanlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, let's get this in place. Thanks again for all your work back and forth on this @christoph-jerolimov 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🔧 Repository: Version job should skip the backstage apps (private npm packages)
3 participants