hockeyapp plugin and jenkins pipeline and hockey app URL - android

I am using a declarative pipeline and in a stage I have a step using Hockey app to upload an APK. It works fine, but I can not seem to get the URL to the HockeyApp version. Supposedly its in an environment var HOCKEYAPP_INSTALL_URL, but alas, it is not. My question is how to get this URL to the version in HocekyApp?
step([$class: 'HockeyappRecorder',
applications: [[downloadAllowed: false, mandatory: false,
notifyTeam: false, releaseNotesMethod: [$class: 'NoReleaseNotes'],
uploadMethod: [$class: 'AppCreation', publicPage: false]]],
debugMode: false, failGracefully: false])

Related

Is it possible to use Jenkins for Flutter?

Is it possible to create pipeline for build release to play store using Jenkins with Flutter? I need to build a release for production/dev to play store.
It is possible, the easiest way to do this is to use a tool like Fastlane that integrates with Jenkins. I have used Fastlane myself and it's just incredible the amount of time it can save. It has an amazing CLI that can scaffold a deploy for you.
It has integrations with Jenkins https://docs.fastlane.tools/best-practices/continuous-integration/jenkins/
Example Fastfile file:
private_lane :push_test_flight do
sync_code_signing # Handles certificates
increment_build_number(
build_number: "1.2.5"
)
increment_version_number(
version_number: "1.0.0"
)
build_app(workspace: ENV["WORKSPACE"], scheme: "Example App")
upload_to_testflight(
reject_build_waiting_for_review: true,
demo_account_required: true,
beta_app_feedback_email: "some#mail-o.co",
beta_app_description: "A proof of concept app",
notify_external_testers: false,
changelog: "POC Updates",
beta_app_review_info: {
contact_email: "some#mail-o.co",
contact_first_name: "Some",
contact_last_name: "Mail",
contact_phone: "5558675309",
demo_account_name: "demo#mail.com",
demo_account_password: "demo#mail",
notes: "A proof of concept app"
},
)
end
This will manage my iOS distribution certificates, build the app with XCode and then push to testFlight!

App not found when migrating to appcenter from hockeyapp

I have an app that I build on CI using fastlane and I publish on HockeyApp.
I'm already accessing the build on AppCenter and everything is fine.
Now, I want to replace the call to the hockey plugin in the fastfile with a call to appcenter_upload.
The appcenter_upload asks me to define owner_name and app_name.
What I have seen is that these values are then used to build a URI:
https://appcenter.ms/orgs/{owner_name}/apps/{app_name}
When I open the app in AppCenter I can read that parts of the URI.
https://appcenter.ms/orgs/mobile-XXXX/apps/MyApp-Name
I tried to use
owner_name=mobile-XXXX
app_name=MyApp-Name
This was the code with hockey-app
hockey(
api_token: HOCKEYAPP_TOKEN,
apk: "path/to/apk",
notes: notes,
status: "2",
notes_type: "1",
teams: team,
commit_sha: `git rev-parse HEAD`.strip,
strategy: "add"
)
This is the code with appcenter_upload
ENV["APPCENTER_DISTRIBUTE_RELEASE_NOTES_CLIPPING"] = notes
appcenter_upload(
owner_name: "mobile-XXX",
app_name: "MyApp-Name,
api_token: HOCKEYAPP_TOKEN,
apk: "path/to/apk",
group: team
)
I was expecting this to be enough to publish directly in appcenter but the appcenter_plugin tells me that the app can't be found and asks me whether I want to create a new one.
I don't want to create another one.
This is the message I get:
Error 401: {"message"=>"12345678-abcd-ef01-994a-0123456789ab", "statusCode"=>401, "code"=>"Unauthorized"}
App with name MyApp-Name not found, create one? (y/n)

Pipeline script to upload build(apk) to hockeyApp

I am using Jenkins to build my android app. i added "Jenkinsfile" in my repo and my current pipeline script looks like this and it is working fine.
node
{
try {
stage("build.clone")
{
checkout scm
}
stage("build.clean")
{
sh "./gradlew clean"
}
stage("build.package")
{
sh "./gradlew assembleDebug"
}
} catch (error) {
throw error
}
}
Now i need to upload my apk to hockeyapp. HockeyApp's Jenkins plugin is installed. And they have made it compatible with pipeline in v 1.2.2
I have googled a lot but found not much help. Kindly guide me or point me to how I can use pipeline script to upload apk to hockeyapp.
Note: I have already created an app on hockey app and I have app token and app id. Also i know curl command is available but i want to use hockeyapp plugin with pipeline
You should be able to get the syntax for just about any Pipeline step via the snippet generator built in to Jenkins.
Doing so in my Jenkins install gives me something like this (horrifying) syntax:
step([$class: 'HockeyappRecorder',
applications: [[downloadAllowed: false, mandatory: false,
notifyTeam: false, releaseNotesMethod: [$class: 'NoReleaseNotes'],
uploadMethod: [$class: 'AppCreation', publicPage: false]]],
debugMode: false, failGracefully: false])

Requiring unknown module "react-native-safari-view" in Release mode

I have a React Native project and it runs successfully on both simulators and devices for iOS.
However, for Android, it runs successfully on simulators without any problems, but when run on devices as a Release build, it gives me this error:
Requiring unknown module "react-native-safari-view".
I tried npm cache clean and npm install several times, but it does not work.
The module exists in node_modules folder and it is also under dependencies in package.json.
What could be the cause of this? Why does it happen only in Release builds?
Update: If this is difficult to fix, is it possible to generate a signed apk with the js bundle included in dev mode?
It is because react-native-safari-view module is not designed for Android.
Check this out: (inside index.android.js file in GitHub)
var SafariViewManager = {
test: function() {
warning('Not yet implemented for Android.');
},
isAvailable: function() {
...
}
};
Maybe you are initiating a SafariViewManager object and calling other functions like show() in index.ios.js without checking it isAvailable()?

React Native Android - how to run in debug mode solely on device?

I'm trying to run my react native android app in debug mode on our devices, without the need for a dev server running on a dev box. I'm using the debug variant/scheme on both platforms to facilitate the "staging" version of our app, since I've read that react native is not super friendly with build modes other than release and debug.
On the iOS side, I was able to modify the AppDelegate.m as follows... basically, if it's a debug build and it was built by buddybuild, don't look for a dev machine for the js bundle, look to the device:
#ifdef DEBUG
NSDictionary *infoPlistDict = [[NSBundle mainBundle] infoDictionary];
if (infoPlistDict[#"BUDDYBUILD_BUILD_ID"]) {
// deployed via buddybuild, don't use localhost
jsCodeLocation = [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"];
} else {
jsCodeLocation = [NSURL URLWithString:#"http://localhost:8081/index.ios.bundle?platform=ios&dev=true"];
}
#else
jsCodeLocation = [[NSBundle mainBundle] URLForResource:#"main" withExtension:#"jsbundle"];
#endif
... I'm looking for a way to do this on android. I have the buddybuild bit of code I need, so no worries there, I just want to know how to programmatically change the location of the js bundle on android as I do above for iOS in AppDelegate.m. Right now, all code related to the location of the js bundle on android seems to be in the react-native package itself and I'd rather not hack that to get it to work.
If I can provide any more information, please let me know.
I would like to summarize the solution to bundle everything within a debug build. Especially the hint in point two did the trick for me. Thanks #Tspoon.
1. Android Studio
go to Preferences -> Build, Execution, Deployment -> Compiler
uncheck "Configure on Demand"
2. build.gradle
within your app/build.gradle file do the following:
project.ext.react = [
// whether to bundle JS and assets in debug mode
bundleInDebug: true,
// whether to bundle JS and assets in release mode
bundleInRelease: true,
]
apply from: "../../node_modules/react-native/react.gradle"
NOTE that it is important to define the react settings above the apply from ... statement, otherwise it will not work
3. Create APK
create your dev apk as usual with ./gradlew assembleDebug within your android folder
On Android, you'll want to modify android/app/build.gradle.
Before the apply from: "../../node_modules/react-native/react.gradle" line, you'll want to tell the packager to bundle the js assets and include them when deploying your APK.
For example:
project.ext.react = [
bundleInBuddybuild: true,
]
Where the syntax is bundleIn${productFlavor}${buildType}
Or if you just want to do it for for debug builds:
project.ext.react = [
bundleInDebug: true,
]

Categories

Resources