Search code examples
xmlazure-devopssitecoreconfigtds

Global TDS config change


We have a Sitecore based C# project setup in Azure DevOps. In the project there is a TdsGlobal.config file that date how far back to get the TDS changes. This should be dynamically changed during the deployment only to get the previous 3 weeks of TDS packages.

<IncludeItemsChangedAfter>2019-04-01</IncludeItemsChangedAfter>   

The above field in TdsGlobal.Config needs to be changed after each Production deployment. Any suggestions how to achieve to this!


Solution

  • Global TDS config change

    If you only update IncludeItemsChangedAfter field in TdsGlobal.Config during the Production deployment instead of updating this field in the repo, you could use the task Replace Tokens to update the key's values:

    <IncludeItemsChangedAfter>#{TDSChangesDate}#</IncludeItemsChangedAfter>   
    

    If you need to update the change in the repo, there are two ways to achieve this.

    One is using the REST API Pushes - Create to update the TdsGlobal.Config file:

    Check this thread for some more detailed steps.

    Another is use powershell scripts to update the file and git command line to submit the the change into the repo:

    • Add a command line task clone the repo.

      git config --global user.email "xxx@xyz.com"
      git config --global user.name "Admin"
      
      git clone <repo> <directory>  //The repo should be https://<PAT>@dev.azure.com/<OrganizationName>/xxxxx/_git/xxx
      
    • Add powershell or any other task to update the file TdsGlobal.Config.
    • Add another command line task to submit the changes to the repo:

      git commit -m "Update package date"
      
      git push -u origin master
      

    Check this thread for some more details.

    Hope this helps.