David Perez
David Perez

Reputation: 488

How to set an environment variable in the middle of a build pipeline execution?

I have a project that uses create-react-app for creating my react app, and I'm using Azure DevOps to build the project and run tests, but there is a problem.

In order to run tests in a CI environment, you have to create an environment variable CI=true, but this has the effect that the build script fails if warnings are found (and my project have warnings).

So my idea is running the build script first, then set the variable, then run the tests, but I haven't found how to set the variable.

Upvotes: 2

Views: 2709

Answers (1)

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41795

Add a Powershell task in the middle of the build and set the variable there:

enter image description here

Upvotes: 3

Related Questions