Environment variables set in init script

Are environment variables set in an init script not persisted into the build phase?

I have an initialization script that relies on encrypted variables, available in the init phase, and needs to set additional variables, but those are not carried into the build phase. Is this expected?

  1. They should be available during the build. How do you set them?

  2. Saw the same behavior setting them in a couple different ways from PS (e.g. $env:test="test" and [Environment]::SetEnvironmentVariable("test","test" ) )

  3. That should work. Can you do a repro in a public repository with statements settings vars and using them?

  4. Interesting, it was helpful to get confirmation that it should work. I went back to another project and got it working there, so I think I missed something on the original project.
    I'll take a look and post an update...

  5. Perhaps I'm operating under a false assumption...

    I know encrypted variables are not available in the build phase in case of PRs, but is that also true for the init phase?

  6. Yes, secure variables are not available for the entire PR build.

    -Feodor

  7. Ok... that took me down a different path and I'll be triggering builds using the API, but keep getting a 500 when trying to trigger a PR build.

    I'm attaching the full Fiddler capture (with the token removed).

    There isn't a lot of information to troubleshoot this... are there any logs or additional details I can look at?

  8. Ah... adding the content-type to the request fixed the issue.

  9. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:06 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac