Skip to content

Improve release script#2558

Merged
cameronvoell merged 12 commits intodevelopfrom
fix/release-script
Sep 28, 2020
Merged

Improve release script#2558
cameronvoell merged 12 commits intodevelopfrom
fix/release-script

Conversation

@ceyhun
Copy link
Copy Markdown
Contributor

@ceyhun ceyhun commented Aug 18, 2020

This PR:

  • Fixes release script having wrong WPAndroid remote name
  • Fixes PR formatting to correctly include RELEASE-NOTES.txt text
  • Creates gutenberg/after_x.xx.x branch in WPiOS and WPAndroid
  • Updated release checklist accordingly

To test:

  1. Run the script and use an unusually high version number
  2. Check if Gutenberg, GB-Mobile, WPiOS and WPAndroid PRs are created as drafts
  3. Check if PRs have correct descriptions and changes
  4. Close the draft PRs
  5. Check if gutenberg/after_x.xx.x branches are created in WPiOS and WPAndroid repos
  6. Delete gutenberg/after_x.xx.x branches

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered if this change warrants user-facing release notes more info and have added them to RELEASE-NOTES.txt if necessary.

Copy link
Copy Markdown
Contributor

@cameronvoell cameronvoell left a comment

Choose a reason for hiding this comment

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

Failed during WPAndroid PR again. Latest error:

==> Update strings
DEBUG:root:Parsing ./WordPress/src/main/res/values/strings.xml
DEBUG:root:Parsing ./libs/gutenberg-mobile/bundle/android/strings.xml
DEBUG:root:Section Gutenberg Native found, emptying...
DEBUG:root:Done emptying.
DEBUG:root:Filling section Gutenberg Native
On branch gutenberg/integrate_release_999.999.999
Changes not staged for commit:
modified: libs/gutenberg-mobile (modified content)
no changes added to commit
Failed during: git commit -m Release\ script:\ Update\ strings `

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile Bot commented Aug 24, 2020

Wanna run full suite of Android and iOS UI tests? Click here and 'Approve' CI job!

@ceyhun
Copy link
Copy Markdown
Contributor Author

ceyhun commented Aug 24, 2020

Thanks for the test run @cameronvoell! Seems like there were no changes to the strings in this case and trying to commit them failed. Updated the script to not commit when there are no changes.

@ceyhun ceyhun requested a review from cameronvoell August 24, 2020 18:28
@cameronvoell
Copy link
Copy Markdown
Contributor

Errors on WPAndroid, didn't get a chance to troubleshoot today, but I'll leave errors here:

==> Create Draft WPAndroid Release PR in GitHub

Creating pull request for gutenberg/integrate_release_99.99.99 into develop in wordpress-mobile/WordPress-Android

error adding remote: From https://github.com/cameronvoell/WordPress-Android

...

Fetching submodule libs/gutenberg-mobile/jetpack
From github.com:Automattic/jetpack
 * branch                09d73e94da3b5005578b6d5d2ba490de690e186c -> FETCH_HEAD
 * branch                276e42512e1baae09727d1e1ef129c263a5b207d -> FETCH_HEAD
 * branch                3052f50ead87fd1c59f37ebfb0f381dbe1e9c14e -> FETCH_HEAD
 * branch                91ed9da32c963e6ed50c38616c5013afe257af52 -> FETCH_HEAD
 * branch                97092d79b00e33869d0f97e57ef1327ab7994639 -> FETCH_HEAD
 * branch                b34e858230be2ea4155288bb7ead0bd2b5ac7a6f -> FETCH_HEAD
 * branch                d9bbec6d07f3e40614525fd1dc956297e6196316 -> FETCH_HEAD
fatal: remote error: upload-pack: not our ref 2189352faefe803e8d86548310416ec66308cce8
fatal: unable to write to remote: Broken pipe
error: Could not fetch fork
git: exit status 1

script continues, then:

==> WPAndroid PR Created: 
Failed during: gh pr create --title Integrate\ gutenberg-mobile\ release\ 99.99.99 --body ##\ Description
This\ PR\ incorporates\ the\ 99.99.99\ release\ of\ gutenberg-mobile.\ \ 
For\ more\ information\ about\ this\ release\ and\ testing\ instructions,\ please\ see\ the\ related\ Gutenberg-Mobile\ PR:\ https://github.com/wordpress-mobile/gutenberg-mobile/pull/2576

Release\ Submission\ Checklist

-\ [\ ]\ I\ have\ considered\ if\ this\ change\ warrants\ user-facing\ release\ notes\ and\ have\ added\ them\ to\ `RELEASE-NOTES.txt`\ if\ necessary. --base develop --label gutenberg-mobile --draft

And for WPiOS , at end of this step:
==> Create release branch in WordPress-iOS Switched to a new branch 'gutenberg/integrate_release_99.99.99' ==> Update gutenberg-mobile ref https://github.com/wordpress-mobile

I got this error:

Pod installation complete! There are 75 dependencies from the Podfile and 94 total pods installed.
SwiftLint dependencies missing or outdated. Installing...
Installing SwiftLint 0.27.0 into /private/var/folders/vq/71_sc5r53h55bltlxmn9mxyc0000gn/T/tmp.1kDBl8nJ/vendor/swiftlint
curl --fail --location -o /var/folders/vq/71_sc5r53h55bltlxmn9mxyc0000gn/T/d20200826-43154-1u4xdgf/swiftlint-0.27.0.zip https://github.com/realm/SwiftLint/releases/download/0.27.0/portable_swiftlint.zip || true
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   646  100   646    0     0   3105      0 --:--:-- --:--:-- --:--:--  3090
100 5052k  100 5052k    0     0  3247k      0  0:00:01  0:00:01 --:--:-- 8675k
unzip /var/folders/vq/71_sc5r53h55bltlxmn9mxyc0000gn/T/d20200826-43154-1u4xdgf/swiftlint-0.27.0.zip -d /var/folders/vq/71_sc5r53h55bltlxmn9mxyc0000gn/T/d20200826-43154-1u4xdgf/swiftlint-0.27.0
Archive:  /var/folders/vq/71_sc5r53h55bltlxmn9mxyc0000gn/T/d20200826-43154-1u4xdgf/swiftlint-0.27.0.zip
  inflating: /var/folders/vq/71_sc5r53h55bltlxmn9mxyc0000gn/T/d20200826-43154-1u4xdgf/swiftlint-0.27.0/swiftlint  
  inflating: /var/folders/vq/71_sc5r53h55bltlxmn9mxyc0000gn/T/d20200826-43154-1u4xdgf/swiftlint-0.27.0/LICENSE  
Generate internal icon set
On branch gutenberg/integrate_release_99.99.99
Untracked files:
	Podfile.orig

nothing added to commit but untracked files present

Failed during: git commit -m Release\ script:\ Update\ gutenberg-mobile\ ref

@mchowning
Copy link
Copy Markdown
Contributor

mchowning commented Aug 27, 2020

git: exit status 1
script continues, then:
...

I wonder why the script continued instead of exiting when the submodule command failed.

@ceyhun
Copy link
Copy Markdown
Contributor Author

ceyhun commented Aug 27, 2020

I wonder why the script continued instead of exiting when the submodule command failed.

I think it's because it does not exit for failing commands from a command substitution $() like WP_ANDROID_PR_URL=$(failing_command). Adding set -e should fix this.

error adding remote: From https://github.com/cameronvoell/WordPress-Android

I'm curious about how did this happen though. It should've been ran with a brand new clone of wordpress-mobile/WordPress-Android in a temp directory. @cameronvoell did you maybe run this script from inside WordPress-Android/libs/gutenberg-mobile? But still this shouldn't be the case.

And for WPiOS , at end of this step:

I think I know why:

sed -i'.orig' -E "s/gutenberg :commit => '(.*)'/gutenberg :commit => '$GB_MOBILE_PR_REF'/" Podfile || abort "Error: Failed updating gutenberg ref in Podfile"

It was looking to replace: gutenberg :commit => but instead there was gutenberg :tag => in the Podfile.

@mchowning
Copy link
Copy Markdown
Contributor

I think it's because it does not exit for failing commands from a command substitution $() like WP_ANDROID_PR_URL=$(failing_command). Adding set -e should fix this.

Without set -e a bash script will not exit for any failing commands unless they call exit, right? That's why I have added all the explicit error handling along the lines of:

npm run bundle || abort "Error: 'npm bundle' ...

I've had bad luck with unexpected behavior from set -e in the past. I think that we're better off explicitly verifying that the command succeeds with "|| abort "Error:..." type handling. I'm wondering if we could build that into the execute helper function.

@ceyhun
Copy link
Copy Markdown
Contributor Author

ceyhun commented Aug 27, 2020

Without set -e a bash script will not exit for any failing commands unless they call exit, right? That's why I have added all the explicit error handling along the lines of:

That's right. I thought they were there to only give more meaningful error messages. But I think for the WP_ANDROID_PR_URL=$(failing_command) case we have a different problem.

To fail the whole script when a command in $() fails set -e could be needed. Because even though we write it like this it won't exit the whole script:
WP_ANDROID_PR_URL=$(execute failing_command || { echo "Error: this command failed"; exit 1; })

or maybe we should bring back this code:

WP_ANDROID_PR_URL=$(failing_command)
if [[ $? != 0 ]]; then
    echo "Error: the previous command failed"
    exit 1
fi

But that means adding it to all the places that run code inside $() and before doing that I'm curious if you remember what bad luck and unexpected behavior you had from set -e in the past?

@mchowning
Copy link
Copy Markdown
Contributor

mchowning commented Aug 27, 2020

The two issues I recall are that sometimes I didn't mind if a command failed and it doesn't work well with tee iirc. If using it works fine in this script and we don't have a better solution, then let's go ahead with it.

@ceyhun
Copy link
Copy Markdown
Contributor Author

ceyhun commented Sep 14, 2020

@mchowning Maybe it could have happened because of one of the cases mentioned in the docs The shell does not exit if ...? I think trying set -e for now could be ok.

@ceyhun ceyhun changed the title Fix release script having wrong WPAndroid remote name Improve release script Sep 21, 2020
@ceyhun
Copy link
Copy Markdown
Contributor Author

ceyhun commented Sep 21, 2020

@cameronvoell I think this is ready for another round of review and testing

@cameronvoell
Copy link
Copy Markdown
Contributor

Still failing at getting one solid run through all 4 PRs. Testing this evening I got caught up in the gb-mobile PR step with this error:

failed to create pull request: graphql error: 'Head sha can't be blank, Base sha can't be blank, No commits between main and release/999.999.999, Base ref must be a branch'

Copy link
Copy Markdown
Contributor

@cameronvoell cameronvoell left a comment

Choose a reason for hiding this comment

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

Looking good now! Thanks Ceyhun!

@cameronvoell cameronvoell merged commit a21c363 into develop Sep 28, 2020
@cameronvoell cameronvoell deleted the fix/release-script branch September 28, 2020 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants