Closed DomBurf closed 2 months ago
Hi @DomBurf,
The tokenPattern
input was added to "replace" tokenPrefix
and tokenSuffix
for common values.
Here is a table with the correspondance: | tokenPrefix | tokenSuffix | tokenPattern | Comments |
---|---|---|---|---|
#{ |
}# |
default |
you can remove tokenPrefix and tokenSuffix inputs |
|
$( |
) |
azpipelines |
you can remove tokenPrefix and tokenSuffix inputs |
|
{{ |
}} |
doublebraces |
you can remove tokenPrefix and tokenSuffix inputs |
|
__ |
__ |
rm |
only for v5, you can remove tokenPrefix and tokenSuffix inputs |
|
__ |
__ |
doubleunderscores |
only for v6, you can remove tokenPrefix and tokenSuffix inputs |
|
#{ |
} |
octopus |
you can remove tokenPrefix and tokenSuffix inputs |
|
${{ |
}} |
githubactions |
only for v6, you can remove tokenPrefix and tokenSuffix inputs |
|
other | other | custom |
keep tokenPrefix and tokenSuffix inputs |
@qetza thanks for the response I am running into an issue as well. Below is how we had the task
# Replace secret token
- task: replacetokens@3
inputs:
targetFiles: '$(TEMPLATE_FILE)'
keepToken: false
tokenPrefix: '#{'
tokenSuffix: '}#'
displayName: 'Replace secret token'
Would my new version look like this
** # Replace secret token
Hi @tdotcdot88, I've just added 2 pinned discussions to explain how to migrate:
In you case the correct syntax would be:
- task: replacetokens@6
inputs:
sources: '$(TEMPLATE_FILE)' # make sure your path uses slashes and not backslashes
missingVarAction: none # this the default value so you can omit the input
missingVarLog: warn # this the default value so you can omit the input
tokenPattern: default # this the default value so you can omit the input
displayName: 'Replace secret token'
I am looking to upgrade from v3 to v5 or v6
I see that there is a new mandatory property called tokenPattern. We currently use this Task for .json, .tfvars, *.properties etc files.
I use the Task inside a Task Group that is consumed by multiple file types across different pipelines (.NET, Terraform etc)
I'm not sure what to enter for this new property. Any advice?