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

[MOB-3112] Set Firebase as AppCenter alternative #832

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

Conversation

d4r1091
Copy link
Member

@d4r1091 d4r1091 commented Jan 20, 2025

MOB-3112

Context

AppCenter is set to retire at the end of March 2025.
We went after finding an alternative that would match our needs, with minimum impact on the current workflow.

Approach

This has been implemented so that there will be no other changes on the codebase side when setting the new project from the Firebase dashboard.

  • Have Firebase as the new Automation tool
  • Created a new Firebase App linked to a temporary project
  • Created testers groups

Other

I created a Browserstack link with the new Firebase project so the builds from Browserstack can be picked up directly from there.

Before merging

🚧 🚧 🚧 We should not merge this in until the rollout to both iOS and Android is done against the new Firebase App ID🚧 🚧 🚧

Checklist

  • I performed the check via Firebase and installed the App
  • I included documentation updates to the coding standards or Confluence doc, when needed

@d4r1091 d4r1091 requested a review from a team January 20, 2025 08:33
Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Workflow Consistency

Ensure that the new build-and-deploy-firebase-and-browserstack workflow is consistent with the removed build-and-deploy-appcenter-and-browserstack workflow, and that all necessary steps for Firebase integration are correctly implemented.

build-and-deploy-firebase-and-browserstack:
  <<: *environment_common
  <<: *macos_common
  steps:
    - checkout
    - macos/switch-ruby:
        version: "3.2"
    - restore_cache:
        key: 1-gems-{{ checksum "Gemfile.lock" }}
    - run:
        name: Bundle install
        command: bundle check || bundle install --path vendor/bundle
    - save_cache:
        key: 1-gems-{{ checksum "Gemfile.lock" }}
        paths:
          - vendor/bundle
    - run:
        name: Verify github
        command: for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts
    - run:
        name: Extract Staging XCConfig
        command: echo "$STAGING_XCCONFIG" | base64 --decode > Client/Configuration/Staging.xcconfig
    - run:
        name: Execute bootstrap
        command: ./bootstrap.sh
    - run:
        name: Build the Ecosia app
        command: bundle exec fastlane build_ecosia_app
    - run:
        name: Upload to Firebase
        command: bundle exec fastlane upload_to_firebase
Firebase Integration

Validate that the new upload_to_firebase lane correctly handles all required environment variables and configurations for Firebase App Distribution.

desc "Upload to Firebase"
lane :upload_to_firebase do
  ensure_env_vars(
    env_vars: [
      'IPA_PATH',
      'DSYM_PATH',
      'FIREBASE_TOKEN',
      'FIREBASE_APP_ID']
  )
  firebase_app_distribution(
    app: ENV["FIREBASE_APP_ID"],
    firebase_cli_token: ENV["FIREBASE_TOKEN"],
    ipa_path: ENV["IPA_PATH"],
    release_notes: ENV["CIRCLE_BRANCH"],
    groups: "ecosia-internal-testers"
  )
Build Configuration Updates

Verify that all references to Development_AppCenter have been correctly replaced with Development_Firebase and that the new configurations are properly set up for Firebase.

2C6189AB2B7A8B15006B70D7 /* Development_Firebase */ = {
	isa = XCBuildConfiguration;
	baseConfigurationReference = 2CBCAB0B2B88EEE40080AD68 /* EcosiaBeta.xcconfig */;
	buildSettings = {

Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Score
Possible issue
Add validation for Firebase environment variables

Validate that the firebase_app_distribution lane correctly handles missing or
invalid environment variables like FIREBASE_TOKEN and FIREBASE_APP_ID to prevent
runtime errors.

fastlane/Fastfile [80-85]

 ensure_env_vars(
   env_vars: [
     'IPA_PATH',
     'DSYM_PATH',
     'FIREBASE_TOKEN',
     'FIREBASE_APP_ID']
-)
+) rescue raise "Missing required environment variables for Firebase distribution"
Suggestion importance[1-10]: 8

Why: The suggestion enhances the code by ensuring that missing or invalid environment variables are caught early, preventing runtime errors. This is a critical improvement for reliability and debugging.

8
Add error handling for Firebase uploads

Ensure that the firebase_app_distribution lane includes proper error handling for
failed uploads, such as retrying or logging detailed error messages for debugging.

fastlane/Fastfile [87-92]

 firebase_app_distribution(
   app: ENV["FIREBASE_APP_ID"],
   firebase_cli_token: ENV["FIREBASE_TOKEN"],
   ipa_path: ENV["IPA_PATH"],
   release_notes: ENV["CIRCLE_BRANCH"],
   groups: "ecosia-internal-testers"
-)
+) rescue raise "Firebase upload failed. Check your credentials and network connection."
Suggestion importance[1-10]: 8

Why: Adding error handling for Firebase uploads ensures that failures are properly logged and actionable messages are provided, improving maintainability and debugging. This is a significant enhancement for production readiness.

8
Add error handling for Firebase upload

Ensure that the bundle exec fastlane upload_to_firebase command in the
build-and-deploy-firebase-and-browserstack job is properly tested to verify that it
handles errors gracefully, such as invalid Firebase tokens or app IDs.

.circleci/config.yml [75]

-command: bundle exec fastlane upload_to_firebase
+command: bundle exec fastlane upload_to_firebase || echo "Firebase upload failed" && exit 1
Suggestion importance[1-10]: 7

Why: Adding error handling to the Firebase upload command improves robustness by ensuring failures are logged and the process exits gracefully. However, the suggestion could be more comprehensive by including retry logic or more detailed error messages.

7
General
Ensure Firebase plugin compatibility

Verify that the fastlane-plugin-firebase_app_distribution gem is compatible with the
current Fastlane version and does not introduce breaking changes.

fastlane/Pluginfile [8]

-gem 'fastlane-plugin-firebase_app_distribution'
+gem 'fastlane-plugin-firebase_app_distribution', '~> 1.0'
Suggestion importance[1-10]: 6

Why: Specifying a version constraint for the Firebase plugin helps prevent compatibility issues with Fastlane. While useful, this suggestion has a moderate impact as it addresses a potential but not immediate problem.

6

Copy link
Collaborator

@lucaschifino lucaschifino left a comment

Choose a reason for hiding this comment

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

Looks good! 🔥 👏
(not approving since we don't have the final id yet like you mentioned)

There will be some interesting project conflicts with the upgrade 😬

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.

2 participants