qetza / replacetokens-task

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

sources input files in version 6.0.5 #29

Closed alexandreBeaulieu94 closed 4 months ago

alexandreBeaulieu94 commented 4 months ago

Hello,

I wanted to migrate from v5 -> v6 and I found that some sources files were missing in my new version with the same pattern.

In v5, if I use replace with targetFiles: "*/.tfvars", all those files are found with the pattern: image

In v6, if I use sources: "*/.tfvars", only those files are found: image

qetza commented 4 months ago

Hi @alexandreBeaulieu94, That's an unintentional side effect of changing the library for glob pattern to fast-glob; by default fast-glob excludes files and directories starting with a dot (.) if not explicitly added to the pattern.

I'm going to fix this but in the meantime a workaround would be to explicitly include .pipelines in your sources:

- task: replacetokens@6
  inputs:
    sources: '**/*.tfvars;.pipelines/**/*.tfvars'
alexandreBeaulieu94 commented 4 months ago

@qetza thanks you for the answer😄

mikefactorial commented 4 months ago

I experienced a similar issue with case sensitivity in the sources that wasn't there previously when upgrading from v3 to v6.

I have several json files in a directory that all start with either customDeploymentSettings or deploymentSettings.

Previously the following would pick up all of them in v3

targetFiles: '**\*deploymentSettings*.json'

In v6 the following misses the customDeploymentSettings.json files presumably because it's case sensitive

sources: '**\*deploymentSettings*.json'

Easy enough to fix but others may run into it and I didn't see anything in the breaking changes about it.

Thanks for the awesome tool and for continuing to maintain it! Obviously, the AzDO team just decided to punt on this capability since you've solved it so nicely 👍

qetza commented 4 months ago

Hi @mikefactorial, Thanks for reporting this unseen breaking change also introduced with the new glob library which by default is case-sensitive.

I will add to the next version a new input to enable/disable case sensitive sources with value disable by default to have the previous behavior but in the meantime you can change your sources to **\*[dD]eploymentSettings*.json.

qetza commented 4 months ago

Hi @alexandreBeaulieu94, @mikefactorial, I released a new version of v6 task which fixes your issues: