mattermost / mattermost-mobile

Next generation iOS and Android apps for Mattermost in React Native
https://about.mattermost.com/
Apache License 2.0
2.22k stars 1.35k forks source link

Repeatable build process #2639

Closed dbrgn closed 4 years ago

dbrgn commented 5 years ago

I'm not submitting this to http://www.mattermost.org/feature-requests/ since it's not an app feature request.

Summary

In both of the following two use cases...

...I face difficulties getting the project to compile. There should be a reproducible way to build the app that is tested for every release.

Details

I have already built multiple versions of mattermost-mobile over the last few months. I cannot recall a single time where it just worked. Every time I faced different error messages, new dependencies, changed Android requirements, bugs related to RN, and similar.

The build instructions seem to be distributed over a few different places. In an attempt at saving myself work in the future, I tried coming up with a Dockerfile that should be able to build mattermost-mobile for Android:

https://github.com/coredump-ch/mattermost-mobile/commit/39879df1fbdfc44ec496f1bf84cc40978e829aef

This commit worked for version 1.14.0 but it fails for 1.16.1. This time the error message is Could not find org.webkit:android-jsc-intl:r224109. Maybe a changed Android toolchain dependency, I don't know.

If you want to grow mattermost-mobile as an open source project, and if it should be a viable way for enterprise customers to build a custom version of the app, you'll want to make it as easy as possible to compile it. Do you have any plans to try to automate the build process and its dependencies? Fastlane already simplifies a lot of this, but the dependencies still vary a lot from version to version.

In an ideal world, I would love to see the following:

Right now the friction of simply getting mattermost-mobile to build for every new release is already that high that I don't have any motivation left for bugfix-attempts. Maybe that's just me, but if you are getting that feedback from customers as well (and if there are very few bugfixes or features contributed by the community) then maybe the processes should be improved.

Thanks for your work! Mobile development is not an easy ecosystem, and the JS world isn't easy either :slightly_smiling_face:

enahum commented 5 years ago

Thanks for the feedback @dbrgn

Even though I understand where you coming from, I have to say that we need to constantly bump dependencies versions for every platform: iOS, Android and JavaScript.

That said we do update the developer setup docs and the build your own docs every time that there is a change that can disrupt the build process

For example this PR: https://github.com/mattermost/mattermost-developer-documentation/pull/248 which is waiting review will update some needed changes for Android.

After all that is done you should be able to build the apps without issues by executing make build, make build-ios and/or make build-android

if there is something that you find that we omitted or that can be improve in the documentation please do let us know or better yet submit a PR against it.

@cpanato do you think is possible to add to the docs our Jenkins pipeline as an example so others can replicate it?

Finally @dbrgn if you find yourself having issues building the app (which I do suffer from them a few times when I need to update dependencies) you can reach me in the Mattermost community server and talk about it in the Native Mobile Apps channel. My handle there is @elias

dbrgn commented 5 years ago

@enahum thanks for the quick reply! Those docs are much better than I had them in mind (last time I looked at them was over half a year ago).

If those instructions / dependencies could be put into a set of scripts or something like a Dockerfile that can be easily replicated in an isolated environment, I think that would really improve the situation tremendously.

I'll try again to build version 1.16.1 using the docs tonight or tomorrow.

cpanato commented 5 years ago

@enahum yes, I will make a PR adding the Jenkins pipeline in the documentation. Also, the plan is opensource the code we have so far, but I need some time to review to check if there is not sensitive data.

but for now i will make a pr adding the code in the documentation.

cpanato commented 5 years ago

assigning myself to make the pr :)

dbrgn commented 5 years ago

By the way, fastlane setup is missing in the developer setup docs. :slightly_smiling_face:

(Edit: Alternatively it could be part of your make pre-run step? It seems that rbenv/bundler is not set up properly on my system, but pre-run did not complain.)

BastienF commented 5 years ago

@dbrgn , You can freely fork the docker factory I made : https://github.com/BastienF/mattermost-mobile/tree/v1.22.1-slack.moi.ovh/factory

bradjones1 commented 4 years ago

I think an image factory might be a bit much, but regardless I will +1 here by linking to my own build; the CI file is for GitLab CI but it mostly uses a purpose-built Docker image and executor environment that should be easy enough to replicate using your preferred toolchain.

enahum commented 4 years ago

Going to close this issue as it hasn’t had any recent activity

bradjones1 commented 4 years ago

There may not be activity here but I think this is still a valid issue.

dbrgn commented 4 years ago

For the record, I have given up on building a custom Mattermost app version, because every new release required hours of work to update the build scripts and fix problems during compilation. Right now we switched to the official Mattermost app, with the downsides like pushes going through Mattermost servers, users not being able to use two Mattermost servers simultaneously and not being able to pre-configure things like the server URL or logos.

Automating the entire build process in a repeatable environment (e.g. Docker) would also have the added benefit that reproducible builds become a possibility. Reproducible builds would allow you to prove that your release on Google Play was actually built from the sources you're publishing, and doesn't contain any changes / backdoors. (Not sure how easy this is to achieve with RN, in a pure Android app it's certainly possible.)

This feedback is not meant to say "Mattermost sucks", I'm still thankful for the work that's being invested (and as an Android developer I know how complex toolchains can be). I just hope it can be valuable feedback for improving the build process. If you're primarily targeting on-premise enterprise customers, then those will want to build their own apps. In that case, a simple, reliable and repeatable build process is invaluable.