No problem at all!
If you follow the Managing an app's bitrise.yml file - Bitrise Docs guide then you basically have two build configs, one on bitrise.io and one in your repository (bitrise.yml
).
The trick to do what you described is: make the bitrise.yml
generic, if it really can be used for multiple projects, and define the parameters in the “wrapper” config you have on bitrise.io.
We usually mark parameters which we expect to be defined outside of the build config by adding it to App Env Vars or Workflow env vars like this:
envs:
- A_REQUIRED_PARAM: $A_REQUIRED_PARAM
If you want to run this locally, then you can specify A_REQUIRED_PARAM
either in the terminal / command line as an env var before you’d run bitrise run ...
(e.g. export A_REQUIRED_PARAM=my-value
) or add to the .bitrise.secrets.yml
and specify it there.
Now the trick: in your bitrise.yml
highlight these parameters as env vars (not required, but it makes your config way easier to maintain long term), and then define the env vars on bitrise.io, either as App Env Vars of Workflow env vars (depends on whether you want to use the same value for every build, or just for builds with a specific workflow).
This way you will have a generic build config in your repo, and the project specific parameters (e.g. the name/path of the project file or workspace file) on bitrise.io.
Alternatively you can use a “secrets” / “inventory” file too, and instead of bitrise run "${BITRISE_TRIGGERED_WORKFLOW_ID}"
you could pass in the “secrets/inventory” file path too: bitrise run "${BITRISE_TRIGGERED_WORKFLOW_ID}" --inventory ./app-specific-envs.yml
The format of the Secrets / Inventory env var file is:
envs:
- SECRET_ENV_ONE: first secret value
- SECRET_ENV_TWO: second secret value
More info about the secrets / inventory file: Managing Secrets locally - Bitrise Docs
The only issue with this solution is that right now the Bitrise CLI only supports one Secrets file per bitrise run
, so if you want to run the build locally you might have to define real secrets manually, or do an environment wrap, e.g. using the Bitrise CLI envman
util like: ~/.bitrise/tools/envman --path ./.bitrise.secrets.yml run bitrise run WORKFLOW-TO-RUN --inventory ./app-specific-envs.yml