Consider an enterprise mobile app available for both Android and iOS, with build and release pipelines.
What I'm trying to achieve is a promotional model for the release pipeline, such that the app binaries are built only one time in a build pipeline, and are then promoted through the environments to production by a release pipeline:
- Build pipeline builds the IPA and APK files
- Release pipeline is triggered after a successful build, and deploys to the Test environment
- QA manager promotes to the QA environment, and it's pushed out to testers
- QA manager promotes to the Production environment, and it's pushed out to end users
[ APK/IPA ]---->Test ---> QA ---> Production---->[ Same APK/IPA ]
There are corresponding Test, QA and Production versions of a backend API that the app must connect to (e.g. while the app is at the Test stage, it should connect to the Test API) - but how can the app know which one to connect to?
Now, if I was creating a web app, this is simple enough to handle using environment variables, so the web app knows which environment it's running in - not so with a mobile app.
The only way I can figure to handle this is for the app to connect to a kind of configuration API, sending it's version number, so it's "told" what environment it belongs to by the backend. But this seems a little inflexible.
Is there perhaps some way to bundle a file in the APK/IPA files to let it know which environment it belongs to? What ways are there to handle this?