0
votes

Within Azure Devops I have a build pipeline which builds and publishes artifacts and a release pipeline which downloads those artifacts, defines some infrastructure configuration, and batch uploads the artifacts to a web container.

After the configuration definition I want to add a task to fetch the clientId of an AD registered app, dumps it into a json file and copies the file in the same folder as the build artifacts. The json has to be uploaded to the web container to provide runtime configuration for a spa app.

What I have tried:

  • generate a json in a release task and copy it into said folder
  • commit an empty json in the code, have it published as build artifact and update its content in a release task
  • use the file transform task which only seem to allow updating a key / value, not generating a new one

The contents of the folder which gets uploaded seem to be locked. Is that correct ? What can I do to achieve my goal ?

1

1 Answers

1
votes

Releases don't publish artifacts. Releases consume published artifacts. A release can be run multiple times for the same build. A release can have multiple environments. What you want to do would fall apart immediately in any of those scenarios.

What you should do is write a custom BASH or Powershell script (depending on your preferences and OS) that does exactly what you describe:

  • Generate an appropriate JSON file
  • Upload the JSON file to the "web container"

You haven't provided any details about what a "web container" is or what your deployment environment is (i.e. AWS, Azure, containers running in Kubernetes), so that's the most thorough answer that can be provided.