Skip to content

Feat/mobile multi env v3 - CU-86bw68jpw

Platform Automation requested to merge feat/mobile-multi-env-v3 into master

ClickUp- https://app.clickup.com/t/86bw68jpw


*** Builder.ai - Mobile Multi-Environment App Releases ***



About

This job analyses commits to the "app-release" folder in the root of your front end mobile project and the rest of the pipeline will respond to those changes accordingly.

This folder contains 2 files:

  1. app-release/build.yaml - For controlling debug/release builds targetting different backend URLs for specific environments.
  2. app-release/deploy.yaml - For controlling which release builds get pushed to the app store (production).

Here is example of "app-release/build.yaml":

stage: 0.0.3
uat: 0.0.2
prod: 0.0.1

Here is an example of "app-release/deploy.yaml":

prod: 0.0.1

Builds

In this section we describe how you can target different environments using the "app-release/build.yaml".

For each environment (please refer to about), you will have a corresponding helm values file located in the "app-deploy" folder in the root of your project. Here is an example:

app-deploy/
  .
  ├── values-prod.yaml
  ├── values-stage.yaml
  ├── values-uat.yaml
  └── values.yaml

In each of the values files there is an "appExtConfig" block with the definition for REACT_APP_API_PATH. An example for uat would look like this:

appExtConfig: extval1: "example1" EXTVAL2: "example2" REACT_APP_API_PATH: "https://automationblocksteststore913-213781-ruby.b213781.uat.eastus.az.svc.builder.ai"

So if you decided that you want to create a build from the current tag for stage (0.0.3) but instead you wanted it built with the backend URL for the uat environment then you would commit the following change to the "app-release/build.yaml" file:

stage: 0.0.3
uat: 0.0.3
prod: 0.0.1

This will then build the mobile using the backend URL for uat and do a beta deployment for you.


Deploys

The "app-release/deploy.yaml" is very similar to "app-release/build.yaml" with the exception that it will promote the deployment to production. So beware any changes to this file will go live!


Related Jobs

Other stages and jobs that generate dynamic pipelines based on the artifacts of this job are described below:

"Results/increment version" - This job will only create a new tag if a "app-release-triggers/build_dev.yaml" artifact exists. If not, no tag is created and the version number for the highest environment is written into the version.txt artifact.

"Prepare_build_config/create mobile build config" - This job will dynamically generate parallel build pipelines based on the artifacts of this job. So if "app-release-triggers/build_stage.yaml" and "app-release-triggers/build_uat.yaml", then debug/release builds will generated for both and can be found in the "child-pipelines/build.yaml" artifact of this job.

"Build/build mobile" - This job will trigger the dynamically generated pipeline from "Prepare_build_config/create mobile build config" using the "child-pipelines/build.yaml" artifact.

"Collect_build_artifacts/collect mobile build artifacts" - This will harvest all the debug/release builds from "Build/build mobile" and publish them under the "build" artifact folder.

"Prepare_release_config/create mobile release config" - This job will dynamically generate beta and production deployment child pipelines based on the contents of the "app-release-triggers/" artifact folder from this job. eg. "app-release-triggers/build_uat.yaml" will do a beta deploy targetting the uat backend url whilst a "app-release-triggers/deploy_prod.yaml" will do a production deployment to the app store.

"Release/release" - This job will execute the dynamically generated child pipeline from the "Prepare_release_config/create mobile release config" job using the "child-pipelines/deploy.yaml" artifact.


FAQs

Q: What happens when I make a source code change?

A: A default development workflow is assumed, the backend URL is taken from "app-deploy/values.yaml" and a beta deploy is executed without any production deploy.

Q: What happens if I change a build for multiple environments?

A: The builds will execute in parallel but the beta deployment for the highest environment wins, eg. for stage, uat, and prod ... prod will be deployed to beta. This can be unstable and is not recommended.

Q: What happens if I add more environments to "app-release/deploy.yaml"?

A: You could technically do this but you have to remember that your production deployment of the mobile app will be pointing to a lower environment.

Edited by Platform Automation

Merge request reports