-
Notifications
You must be signed in to change notification settings - Fork 800
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
Tools: Add steps to release script #40556
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! |
|
||
Conduct a full release of specified plugins through release branch creation. Just the plugin name is fine, such as 'jetpack' or 'backup.' The version is optional, and if not specified, will be set to the next stable version. | ||
Usage: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our other scripts, as well as examples like git --help
and jq --help
, all lead with usage and have the long description underneath.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair; updated in 40c39d9.
tools/release-plugin.sh
Outdated
|
||
Conduct a full release of specified plugins through release branch creation. Just the plugin name is fine, such as 'jetpack' or 'backup.' The version is optional, and if not specified, will be set to the next stable version. | ||
Usage: | ||
$0 -h |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Little need IMO to call out -h
specially.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tools/release-plugin.sh
Outdated
|
||
Options: | ||
-h Show this help message. | ||
-h, --help Show this help message. | ||
-s <step>, --step <step> Start at a given step. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point we should probably give some way for a user to list the steps. A --list-steps
option would work IMO.
But that can wait until it's not experimental anymore 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an undocumented --list-steps
option: ab31162
The harder part in a future iteration is to give the steps more understandable names. :^)
tools/release-plugin.sh
Outdated
# No args, help flag, or invalid flag, so show usage. | ||
if [[ $# -eq 0 || $1 == '-h' || $1 == '--help' ]]; then | ||
usage | ||
elif [[ $1 == '-s' || $1 == '--step' ]]; then | ||
if [[ $2 =~ ^[0-9]$ ]]; then | ||
CUR_STEP="$2" | ||
shift 2 | ||
else | ||
PROJECTS["$SLUG"]="${PROJECTS[$PLUGIN]}" | ||
unset "PROJECTS[$PLUGIN]" | ||
usage | ||
fi | ||
done | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want to switch away from getopts
so we can have long options, it might be better to look to something like this as an example
jetpack/tools/check-plugin-monorepo-deps.sh
Lines 40 to 61 in 9e3ae2f
while [[ $# -gt 0 ]]; do | |
arg="$1" | |
shift | |
case $arg in | |
-h|--help) | |
usage | |
exit | |
;; | |
--dev) | |
WHAT=dev | |
;; | |
--release) | |
WHAT=rel | |
;; | |
-*) | |
die "Unrecognized option \"$arg\"" | |
;; | |
*) | |
PLUGINS+=( "$arg" ) | |
;; | |
esac | |
done |
The advantage there is that if someone adds --help
anywhere in the command line it still gets processed correctly, instead of having to be the only option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of having to be the only option.
More accurately: instead of having to be the first option.
Ideally BSD getopt
would support long options. Gotta love the usage info on macOS:
$ getopt -h
--
The example you've listed gets a bit more complicated due to the version being optional, as the args could be jetpack --help
, which would try to detect a version. Obviously a workaround would be to check if $1 or $2 was --help
, which isn't pretty but is doable.
But then you have jetpack -s 8
vs. jetpack 19.2 -s 8
. If $2
is -s
then $3
is the step number, and if $1
is -s
then $2
is the step number...it gets rather ugly fast.
The version currently in trunk
doesn't handle it unless the first option either; getopts
fails as soon as a positional param is found, so the behaviour is the same as always.
At this stage I'd rather just keep positional args after flags unless you feel strongly about it.
Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good enough to merge and iterate on IMO. I didn't try to test it beyond --help
and --list-steps
though.
Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
This is a very light refactor of the release script to allow one to resume from a specific release step. This allows one to abort the script to adjust something without having to start over or do everything manually.
The main changes are as follows:
projects/plugins/X
,plugins/X
, andX
-s
flag was added to allow one to specify a stepCUR_STEP
is used in conjunction withRELEASE_STEPS
to determine which steps to runverify_prerelease_branch
was added to relevant steps to prevent execution if not on the correct branchgenerate_resume_command
function was added in case at some point we decide to hook it into atrap
or somethingI also added support for a
JP_DISABLE_TRACKS
flag insend_tracks_event
so we can prevent tracks from being sent during testing.Changes to the processes within the steps is out of scope for this PR and can be considered for a future PR. For now, this should be considered an advanced feature for those that are willing to take responsibility for what happens (there's no step rollback feature). :^)
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
-s
flag./tools/release-plugin.sh -s 8 crm boost jetpack