Search code examples
azure-devopsazure-pipelinescreate-react-app

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.


Solution

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

    enter image description here