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

[NT-424] Migrate HockeyApp to AppCenter #910

Merged
merged 12 commits into from
Oct 30, 2019
Merged

Conversation

justinswart
Copy link
Contributor

📲 What

Replaces HockeyApp with Microsoft's new AppCenter SDK.

Note: So far I have only migrated our alpha target in order to test this end-to-end. Once we're satisfied we should migrate our beta and production targets.

🤔 Why

HockeyApp is being sunset on Nov 16 2019. We're required to migrate to AppCenter to continue using the platform for distributing our internal alpha and beta builds.

🛠 How

  • Removed all references to Hockey in our codebase, secrets, circle.yml, Fastfile.
  • Configured AppCenter as closely as possible to how we had been configuring Hockey. However, some configuration properties that we had before don't seem to be available on AppCenter.
  • Added the AppCenter Fastlane plugin for distributing alpha and beta builds via CircleCI.
  • Added api token to secrets: https://github.com/kickstarter/native-secrets/pull/61

✅ Acceptance criteria

Distribute an alpha locally via fastlane using the following commands:

agvtool new-version -all $(($(date +%s)/100))
bundle exec fastlane alpha_gym
bundle exec fastlane alpha_appcenter
  • This should upload an Alpha build to AppCenter and it should be visible in the dashboard.
  • Push to alpha-dist-<something>. This will generate an ad hoc alpha build on CircleCI and distribute that to AppCenter.

⏰ TODO

  • Move Beta and Production apps over to AppCenter and generate their API tokens.

@@ -44,15 +41,6 @@ jobs:
keys:
- fabric-sdk-cache-{{ checksum "fabric_version.txt" }}

- run:
name: Store Hockey SDK Version
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The AppCenter SDK is managed via Carthage, no need to cache this separately.

manager.authenticator.authenticateInstallation()
.observeValues { data in
let customProperties = MSCustomProperties()
customProperties.setString(data.userName, forKey: "userName")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this because there doesn't appear to be a similar userName property like BITHockeyManager had before.

withServices: [
MSAnalytics.self,
MSCrashes.self,
MSDistribute.self
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to confirm that MSDistribute works correctly for us. In the set up docs it mentions adding the app secret to Info.plist which is obviously problematic for us. So I didn't do it but I'm not sure if it will cause issues.

@ksr-ci-bot
Copy link

1 Warning
⚠️ Big PR

Generated by 🚫 Danger

@@ -31,6 +31,7 @@
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>appcenter-$(APPCENTER_$(APPCENTER_SCHEME_NAME)_API_TOKEN)</string>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Scollaco @ifbarrera This accesses the environment var for the API token based on an environment var for this configuration.

So for our alpha target the concatenated environment var is APPCENTER_ALPHA_API_TOKEN and in this var name ALPHA is a variable based on APPCENTER_SCHEME_NAME which is a user-defined variable in our build settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These docs mention that we need to have the secret in the Info.plist

isa = XCBuildConfiguration;
buildSettings = {
APPCENTER_SCHEME_NAME = ALPHA;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exhibit A

@justinswart justinswart added the blocked a PR that is blocked for external reasons label Oct 28, 2019
@justinswart justinswart added needs review and removed blocked a PR that is blocked for external reasons labels Oct 29, 2019
@justinswart
Copy link
Contributor Author

@Scollaco this is ready for re-review. Just note, where previously I was calling it an API token per app, it's actually just one API token and rather a secret per app. I've also since removed the production target from being submitted to AppCenter. We will only use it for alpha and beta distribution.

@Scollaco
Copy link
Contributor

@Scollaco this is ready for re-review. Just note, where previously I was calling it an API token per app, it's actually just one API token and rather a secret per app. I've also since removed the production target from being submitted to AppCenter. We will only use it for alpha and beta distribution.

Ok, I will test now and approve once it works. Could you please merge the secrets PR?

Copy link
Contributor

@Scollaco Scollaco left a comment

Choose a reason for hiding this comment

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

🚀

@justinswart justinswart merged commit dfc6fde into master Oct 30, 2019
@justinswart justinswart deleted the migrate-hockey-app-center branch October 30, 2019 15:41
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.

None yet

3 participants