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

[No QA] Ensure bundle version strings are compatible before auto-merging CP PR #6199

Merged
merged 12 commits into from
Nov 17, 2021

Conversation

Jag96
Copy link
Contributor

@Jag96 Jag96 commented Nov 3, 2021

Details

This PR updates our CP workflow to ensure that auto-merge PRs won't merge if the bundleVersion string and shortBundleVersion strings aren't compatible.

Compatible bundle version strings: 1.1.1 and 1.1.1.0
Incompatible bundle version strings: 1.1.1 and 1.1.0.0

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/178225

Tests

To test this we'll merge this PR and then CP a dummy change to ensure that there are no CP flow regressions.

QA Steps

None

Tested On

N/A

@Jag96 Jag96 self-assigned this Nov 3, 2021
@Jag96 Jag96 changed the title Ensure bundle version strings are compatible before auto-merging CP PR [No QA] Ensure bundle version strings are compatible before auto-merging CP PR Nov 15, 2021
@Jag96 Jag96 marked this pull request as ready for review November 16, 2021 00:05
@Jag96 Jag96 requested a review from a team as a code owner November 16, 2021 00:05
@MelvinBot MelvinBot requested review from mountiny and removed request for a team November 16, 2021 00:05
const bundleVersion = execSync(`/usr/libexec/PlistBuddy -c "Print :CFBundleVersion" ${PLIST_PATH}`);
const shortBundleVersion = execSync(`/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" ${PLIST_PATH}`);

if (shortBundleVersion !== (bundleVersion.split('-') || [''])[0]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB: This comment is more for me to learn. I see in nativeVersionUpdater.js that the shortBundleVersion is obtained as following:

const shortVersion = version.split('-')[0];

That means in terms of your example from the PR body: 1-1-1-0 this would be 1 and then on the next line we add another zero to the version:

const cfVersion = version.includes('-') ? version.replace('-', '.') : `${version}.0`;

What I do not understand is taking the first - [0] element of the split would not check for the case you have described in the PR body:

  • Compatible bundle version strings: 1.1.1 and 1.1.1.0
  • Incompatible bundle version strings: 1.1.1 and 1.1.0.0

Thank you for explanation of this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, no worries! So in this case we're grabbing the version number from the info.plist, which has the versions formatted as x.x.x-x. So if the bundleVersion is 1.1.1-0 and the shortBundleVersion is 1.1.1, then they would match. Let me know if that makes sense!

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahaa! That makes a lot of sense, did not catch that, thank you!

mountiny
mountiny previously approved these changes Nov 16, 2021
Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

Still lots to learn for GH actions for me so I gave this an extra thorough check and the code LGTM. Left one comment as I have not understood one part. Thank you!

@Jag96
Copy link
Contributor Author

Jag96 commented Nov 16, 2021

Since we're testing this with a live CP, added some logging in to make it easier to debug in case things don't work properly

Copy link
Contributor

@mountiny mountiny left a comment

Choose a reason for hiding this comment

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

The logs will help for sure, great idea! Approving and all yours @roryabraham.

@roryabraham
Copy link
Contributor

@Jag96 I'll let you merge when you're ready to test with a CP to fix one of our several deploy blockers.

@Jag96
Copy link
Contributor Author

Jag96 commented Nov 17, 2021

Going to merge this and use #6341 to test there is no CP regression

@Jag96 Jag96 merged commit a61cfb4 into main Nov 17, 2021
@Jag96 Jag96 deleted the joe-check-bundle-version branch November 17, 2021 00:10
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@roryabraham
Copy link
Contributor

Testing this here

@Jag96
Copy link
Contributor Author

Jag96 commented Nov 17, 2021

From https://expensify.slack.com/archives/C03V9A4TB/p1637167714322500, PListBuddy only runs on macos, but repo-sync/pull-request needs to run on linux. Looks like we'll need to figure out a different way to support both, so going to revert this PR because CPs are currently broken and I'll look into how to make this work.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @Jag96 in version: 1.1.15-18 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @roryabraham in version: 1.1.16-10 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

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.

4 participants