qetza / replacetokens-task

Azure Pipelines task to replace tokens in files with variables.
MIT License
11 stars 2 forks source link

Testing replacement token test on simple yaml file with MS agent #45

Open soundd2 opened 1 month ago

soundd2 commented 1 month ago

I have done Testing “replacement token” test on simple yaml file with MS agent. which is YAML below: I have used MS agent

all tasks succeeded but not sure why it is not replaced and showing as test02 it is in last task which “print after file replace”

YAML file:

Starter pipeline

Start with a minimal pipeline that you can customize to build and deploy your code.

Add steps that build, run tests, deploy, and more:

https://aka.ms/yaml

trigger:

pool: vmImage: ubuntu-latest

parameters:

stages:

File from code where it has to replace:

image

Logs:

logs_1346.zip

Please suugest

qetza commented 1 month ago

Hi @soundd2, Based on your screenshot you are using the syntax {{ ... }} to mark your token in your file. This is not the default pattern of the task. You have 2 options:

  1. keep you current syntax and configure the task to use this pattern:
    - task: replacetokens@6
    inputs:
      root: '$(System.DefaultWorkingDirectory)'
      sources: 'appsettings.json'
      tokenPattern: doublebraces
  2. use the default task pattern in you file:
    <?xml version="1.0" encoding="UTF-8"?>
    <TestSettings name="#{ TestSettings_Name }#">
    //...
    </TestSettings>
soundd2 commented 1 month ago

Thank you , it worked