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

Add command to prepare GBM release #158

Merged
merged 35 commits into from
Oct 17, 2023
Merged

Add command to prepare GBM release #158

merged 35 commits into from
Oct 17, 2023

Conversation

derekblank
Copy link
Contributor

Adds prepare function for Gutenberg Mobile:

The intent of the Gutenberg Mobile prepare command:

  • Update the GB reference to the release tag
  • Prepare the bundle
  • Update the release notes
  • Create the release PR

@derekblank derekblank requested a review from jhnstn October 11, 2023 06:30
@derekblank
Copy link
Contributor Author

derekblank commented Oct 11, 2023

@jhnstn This is currently a WIP based on the previous version of gbm-cli/cli/pkg/gbm/gbm.go.

There are still a few items to address and get feedback on:

  • The structure of the original gbm-cli branch and the branch the current trunk (with the Gutenberg prepare command) are a bit different. Does the directory structure proposed here make sense, or should we move where we want to place this Gutenberg Mobile prepare command?

  • In gbm.go in this PR, I started updating some of the git methods from using go-git to using our own git.go methods. We already discussed not using go-git library due to some of its limitations (which I agree is a good idea), but wanted to check on the methods that this PR adds in git.go. Some of them still need some updating, particularly with the pointers.

@@ -14,6 +16,30 @@ func Clone(repo, dir string, shallow bool) error {
return cmd("clone", repo)
}

func CloneGBM(dir string, pr gh.PullRequest, verbose bool) (*g.Repository, error) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure about putting something this GBM specific in the git package. Feels like it belongs in gbm/gbm.go

Not a blocker but something to consider as a refactor.

@derekblank derekblank marked this pull request as ready for review October 12, 2023 05:41
@derekblank
Copy link
Contributor Author

@jhnstn Updated the PR with the output of our pairing session and then continued the rest of the steps to create the PR based on (gb.go and the previous release-automation script). There may be some tweaks needed to gbm.go as you work it into a release command, but otherwise marking this release pkg PR as read to review. Feel free to make any tweaks on this branch as well, or we can merge and iterate from there to keep code consolidated more quickly.

@derekblank
Copy link
Contributor Author

@jhnstn I merged the prepare subcommands from trunk, and wired up the GBM prepare command to call CreateGbmPR, e.g.:

GBM_WORDPRESS_ORG=derekblank go run main.go release prepare gbm v1.0.6

It's invoking the CreateGbmPR command correctly, but there's still an issue with the tmp directory. Perhaps it's how we're passing tempDir here, or setting the gbmDir here.

@derekblank
Copy link
Contributor Author

@jhnstn I believe the issue with nothing to commit, working tree clean was that the remote origin and upstream branch was not being set in git. I added git interfaces to add these to the GBM prepare command, but the syntax might need some tweaks to get it right.

@jhnstn
Copy link
Member

jhnstn commented Oct 17, 2023

@derekblank I got this working. The PR body is empty but going to merge as is

@jhnstn jhnstn enabled auto-merge (squash) October 17, 2023 19:44
cli/pkg/git/git.go Outdated Show resolved Hide resolved
cli/pkg/git/git.go Outdated Show resolved Hide resolved
cli/pkg/git/git.go Outdated Show resolved Hide resolved
cli/pkg/gbm/gbm.go Outdated Show resolved Hide resolved
cli/pkg/gbm/gbm.go Outdated Show resolved Hide resolved
cli/pkg/release/gbm.go Outdated Show resolved Hide resolved
cli/pkg/release/gbm.go Outdated Show resolved Hide resolved
@jhnstn jhnstn merged commit bc68e6b into trunk Oct 17, 2023
1 check passed
@jhnstn jhnstn deleted the cli/gbm-prepare branch October 17, 2023 19:44
jhnstn added a commit that referenced this pull request Oct 17, 2023
* Add base gbm prepare command

* Add CloneGBM function to git pkg

* Add git submodule utility functions

* Update gbm.go

* Add Submodule to git client

* Update gbm.go steps

* Add UpdateReleaseNotes util

* Add Bundle exec command

* Add GBM PR body template

* Add steps to preview and create Gutenberg Mobile PR

* Add code comments to gbm prepare command

* Call CreateGbmPR from gbm release subcommand

* Add shell package for shell based commands

inludes git, npm, and bundler

* Update gb.go to use the new shell commands

* Update gbm release package

* Add SetUpstreamTo and AddRemote git interfaces

* Add remote and set upstream to GBM prepare command

* Place the success message after verifying the PR was created

* Add prepare cmd utils

* Update SetUpstreamTo signature

* Reorder some events and clean up logging messages

* Add a cmd utils package

* Move temp directory helpers to the cmd utils

* Deprecate the console error functions

* Use the cmd utils to exit on error

* Fix how the deferred function is handling cleanup

* Add git submodule utility functions

* Add Submodule to git client

* Call CreateGbmPR from gbm release subcommand

* Update gb.go to use the new shell commands

* Update exit on prepare gbm command

---------

Co-authored-by: jhnstn <[email protected]>
Co-authored-by: Jason Johnston <[email protected]>
jhnstn added a commit that referenced this pull request Oct 19, 2023
* Add yaml processor

* Fix mod files

* Pass pr by value to preview function

* Add new subcommand for target repos

* Add a cmd utils package

* Move temp directory helpers to the cmd utils

* Deprecate the console error functions

* Use the cmd utils to exit on error

* Fix how the deferred function is handling cleanup

* Add command to prepare GBM release (#158)

* Add base gbm prepare command

* Add CloneGBM function to git pkg

* Add git submodule utility functions

* Update gbm.go

* Add Submodule to git client

* Update gbm.go steps

* Add UpdateReleaseNotes util

* Add Bundle exec command

* Add GBM PR body template

* Add steps to preview and create Gutenberg Mobile PR

* Add code comments to gbm prepare command

* Call CreateGbmPR from gbm release subcommand

* Add shell package for shell based commands

inludes git, npm, and bundler

* Update gb.go to use the new shell commands

* Update gbm release package

* Add SetUpstreamTo and AddRemote git interfaces

* Add remote and set upstream to GBM prepare command

* Place the success message after verifying the PR was created

* Add prepare cmd utils

* Update SetUpstreamTo signature

* Reorder some events and clean up logging messages

* Add a cmd utils package

* Move temp directory helpers to the cmd utils

* Deprecate the console error functions

* Use the cmd utils to exit on error

* Fix how the deferred function is handling cleanup

* Add git submodule utility functions

* Add Submodule to git client

* Call CreateGbmPR from gbm release subcommand

* Update gb.go to use the new shell commands

* Update exit on prepare gbm command

---------

Co-authored-by: jhnstn <[email protected]>
Co-authored-by: Jason Johnston <[email protected]>

* Make shell command interfaces public

Also rename factory functions to add clarity

* Work in progress

* add dir to the try exec command

* Update yq test to handle dots in values

* Update integration package to return the pr

* Fill in the create pr flows to the integrate cmd

* Update integrate to use the new exit flow

* Get Android PR working

* Add keep flag to keep the temp directory around after the command

* Add cleaner factory function

* Add rake to the shell package

* get integrate working for ios

---------

Co-authored-by: Derek Blank <[email protected]>
jhnstn added a commit that referenced this pull request Oct 23, 2023
* Add yaml processor

* Fix mod files

* Pass pr by value to preview function

* Add new subcommand for target repos

* Add a cmd utils package

* Move temp directory helpers to the cmd utils

* Deprecate the console error functions

* Use the cmd utils to exit on error

* Fix how the deferred function is handling cleanup

* Add command to prepare GBM release (#158)

* Add base gbm prepare command

* Add CloneGBM function to git pkg

* Add git submodule utility functions

* Update gbm.go

* Add Submodule to git client

* Update gbm.go steps

* Add UpdateReleaseNotes util

* Add Bundle exec command

* Add GBM PR body template

* Add steps to preview and create Gutenberg Mobile PR

* Add code comments to gbm prepare command

* Call CreateGbmPR from gbm release subcommand

* Add shell package for shell based commands

inludes git, npm, and bundler

* Update gb.go to use the new shell commands

* Update gbm release package

* Add SetUpstreamTo and AddRemote git interfaces

* Add remote and set upstream to GBM prepare command

* Place the success message after verifying the PR was created

* Add prepare cmd utils

* Update SetUpstreamTo signature

* Reorder some events and clean up logging messages

* Add a cmd utils package

* Move temp directory helpers to the cmd utils

* Deprecate the console error functions

* Use the cmd utils to exit on error

* Fix how the deferred function is handling cleanup

* Add git submodule utility functions

* Add Submodule to git client

* Call CreateGbmPR from gbm release subcommand

* Update gb.go to use the new shell commands

* Update exit on prepare gbm command

---------

Co-authored-by: jhnstn <[email protected]>
Co-authored-by: Jason Johnston <[email protected]>

* Make shell command interfaces public

Also rename factory functions to add clarity

* Work in progress

* add dir to the try exec command

* Update yq test to handle dots in values

* Update integration package to return the pr

* Fill in the create pr flows to the integrate cmd

* Update integrate to use the new exit flow

* Get Android PR working

* Add keep flag to keep the temp directory around after the command

* Add cleaner factory function

* Add rake to the shell package

* get integrate working for ios

* Add workspace package for managing the temp directories

* update commands to use the new workspace package

* Refactor workspace into an interface

---------

Co-authored-by: Derek Blank <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request [Feature] CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants