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

[Hold][No QA]Update to deploy HybridApp production iOS and Android using slow rollouts #52283

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

AndrewGable
Copy link
Contributor

@AndrewGable AndrewGable commented Nov 8, 2024

Explanation of Change

Context: We currently do not have a way to automatically release HybridApp (Expensify aka OldApp) automatically to production. This historically has been done by hand when we determine we have enough to release in an ad-hoc manner. One reason for this was the standard process to preform a “slow rollout” by increasing the percentage of users who could update due to increased users and risk for fires on HybridApp/OldApp.

Problem: We are not keeping HybridApp up to date with New Expensify functionality, the current HybridApp release for production is already ~1 month old and there has been ~4,000 new commits since then.
Solution: Automate rollouts for HybridApp with GitHub Actions using our existing deploy.yml workflow with some additional logic to handle slow rollouts. At a high level I’d propose:

  1. On iOS we will start the automatic slow rollout when we have a production deploy (details here). On Android we will write a new cron workflow to update the rollout to match the iOS automatic rollout.
  2. Whenever we have a new production release, put the previous release to 100% if it’s currently being slowly rolled out, then repeat step 1.

Here is an example of the high level plan, if we did three production releases. Monday, Wednesday, and Friday.

  1. So on Monday we’d send the previous version to 100% production, then we’d put 9.0.48-2 on a slow rollout. Slow rollout is a automatic thing done by Apple that updates from 1% to 100% over a 7 day period.
  2. On Wednesday iOS would be at 2% for 9.0.48-2 , but we have a new production release, so we’d put 9.0.48-2 to 100% and start the slow rollout of 9.0.49-2.
  3. On Friday same thing, we’d update 9.0.49-2 to 100% from 2% and start the rollout of 9.0.50-8.
  4. Today 9.0.50-8 has been slow rolled out for 3 days, so it would be at 5%. If we release to production today then we would update it to 100%, otherwise it would bump to 10% tomorrow automatically by Apple.

Fixed Issues

Related https://github.com/Expensify/Expensify/issues/195693

Tests

  • I will need to verify all of this by testing manually, so we will need to merge this, and then verify the builds are being rollout correctly each day.

Offline tests

N/A

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
    • MacOS: Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

@AndrewGable AndrewGable changed the title Add new cron Android bump to update Android production version Update to deploy HybridApp production iOS and Android using slow rollouts Nov 12, 2024
@AndrewGable AndrewGable changed the title Update to deploy HybridApp production iOS and Android using slow rollouts [Hold]Update to deploy HybridApp production iOS and Android using slow rollouts Nov 12, 2024
@AndrewGable
Copy link
Contributor Author

On hold for https://github.com/Expensify/Expensify/issues/442751

Once we have that rolling out, I think we can merge this and begin testing.

@AndrewGable AndrewGable self-assigned this Nov 12, 2024
@AndrewGable AndrewGable marked this pull request as ready for review November 12, 2024 21:46
@AndrewGable AndrewGable requested a review from a team as a code owner November 12, 2024 21:46
Copy link

melvin-bot bot commented Nov 12, 2024

@ Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot removed the request for review from a team November 12, 2024 21:46
@AndrewGable AndrewGable changed the title [Hold]Update to deploy HybridApp production iOS and Android using slow rollouts [Hold][No QA]Update to deploy HybridApp production iOS and Android using slow rollouts Nov 12, 2024
version_code: ENV["VERSION"].to_i,
track: 'internal',
track_promote_to: 'production',
rollout: '0.01',
Copy link
Contributor

Choose a reason for hiding this comment

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

So when submitting for review, it will auto-rollout to 1% after approval?

});

try {
// Insert an edit to get an edit ID
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what this comment means, can you make it a bit clearer pls

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like were making a useless edit to grab the ID, but I'm not usure what it is we are editing.


// Check if the status is halted
const HALTED = status === HALTED_STATUS;
core.setOutput('HALTED', HALTED);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does setOutput return from the current action flow?

repo: CONST.APP_REPO,
});

const releaseDate = data.published_at?.split('T')[0];
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know if this is millis or formatted date? It doesn't matter but a comment here with the format might be useful in the future for people editing the file

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe ignore this actually, I see below it's a string that we pass into DATE

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update Rollout Percentage with Fastlane
if: ${{ steps.checkAndroidStatus.outputs.HALTED == 'false' }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we also return early if rollout is at 1?

Comment on lines +267 to +282
lane :complete_hybrid_rollout do
productionVersionCode = google_play_track_version_codes(track: 'production')
upload_to_play_store(
package_name: "org.me.mobiexpensifyg",
json_key: './android/app/android-fastlane-json-key.json',
version_code: productionVersionCode,
track: 'production',
rollout: '1',
skip_upload_apk: true,
skip_upload_aab: true,
skip_upload_metadata: true,
skip_upload_changelogs: true,
skip_upload_images: true,
skip_upload_screenshots: true
)
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we also skip this if rollout is already at 1 (perhaps we needed to halt releases for some reason and it got to 1 with the auto-rollout already)

Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

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

Looking pretty good, lets try it! Documenting the Fastlane params is very helpful

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.

2 participants