Update Env vars and use them in different workflows

#1

Hello,

I’ve one problem and i after some search i didn’t see if there is solution about it.

I have two workflow, one for get the project on git, and build the app for create APK and APK Debug. The second one, is for run UITest on the APK.
The second workflow have a script to get the APK and APK Debug. For get them, the script use Env Vars set in the “Env vars” section in Bitrise.

My problem is to update these Env Vars in the first workflow. This workflow after the build, get all the informations and try to update Env Vars with the script.

I try with the “envman” command: envman add --key AF_DOWNLOAD_DIR --value “$DOWNLOAD_DIR”
but he update the Env Var only for in the workflow, so when i run the second workflow, he don’t have the new values.

This is possible to update the “Env Vars” in the end of the first workflow, and use the update Env vars in the second workflow. There are not chain workflows.

Thanks

0 Likes

#2

Hello there, the problem here is that the two workflows are running on two separate virtual machines so even if you set up an env like this, the apk just does not exist on the second machine.
You will need to create the test apk-s usually assembleDebug assembleDebugAndridTest
and after that the UI test, but in the same workflow! so they are on the same machine :upside_down_face:

0 Likes

#3

Hello,

I get the APK and APK Debug in my second workflow with a script who need informations, and it work perfectly. So i have 2 workflows running on 2 separate virtual machines, and with the script the APK exist on the second workflow :wink:
Just these informations used by the script (build slug, apk path…) need to be refresh when a build (on the 1st workflow) is finish, to get the last APK build.

My question is just, how to update all the values on the “Env Var” across two workflows running in two separate virtual machines ?

0 Likes

#4

oh I think I get what you want :thinking:
https://api-docs.bitrise.io/ <- api reference

so I would use it like check your current build number, subtract one from it, and GET the previously started build’s slug with that, so you can get it’ build artifact as well

0 Likes