Search Unity

Feedback [Feedback] Change environment variables directly from Cloud Build

Discussion in 'Unity Build Automation' started by Trisibo, Feb 28, 2019.

  1. Trisibo

    Trisibo

    Joined:
    Nov 1, 2010
    Posts:
    245
    I know it's possible to change the environment variables on Cloud Build using the web API, but that requires storing the user's API key somewhere in the project to authenticate if building from Cloud Build. I'd like to be able to (permanently) modify an environment variable when building from Cloud Build without requiring the API key.
     
  2. victorw

    victorw

    Joined:
    Sep 14, 2016
    Posts:
    459
    You can set environment variables on the project level, which I think covers this use case (set environment once, have it always be set). Or are you trying to dynamically alter an environment variable as part of kicking off a build? I'm not sure I fully understand the request.
     
  3. Trisibo

    Trisibo

    Joined:
    Nov 1, 2010
    Posts:
    245
    I'm trying to alter the variable as part of the build, in this case basically the build number, but more generally having a build output something permanent that can be read from outside or from another Cloud Build build. I took a look at the artifacts API, but it's the same issue of needing the API key stored in the project.
     
  4. bkdroid13

    bkdroid13

    Joined:
    Jun 3, 2019
    Posts:
    7
  5. Trisibo

    Trisibo

    Joined:
    Nov 1, 2010
    Posts:
    245
    I think you misunderstood, the feedback is about changing the environment variables on Cloud Build from Cloud Build during a build, without needing the API key, not on the local machine.
     
  6. pierrepommiers699

    pierrepommiers699

    Joined:
    Mar 13, 2023
    Posts:
    1
    Hello Trisibo,

    I am facing a similar issue where I need to dynamically modify my environment variables through the cloud build UI. My preBuild process requires arguments to build in a different way. However, it seems challenging to provide an argument that change the type of build process we want to execute. Do you or anyone else have any advice on how to approach this?
     
  7. Trisibo

    Trisibo

    Joined:
    Nov 1, 2010
    Posts:
    245
    What I did for my needs was to create an app that would set the Cloud Build environment variables and then trigger a build, by using the Cloud Build API, instead of using the Cloud Build UI: https://build-api.cloud.unity3d.com/docs/1.0.0/index.html