Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make variable names case-insensitive #10

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 5.0.1
Task 6.0.1
- Fix missing default variables due to case-sensitivity ([#8](https://github.com/qetza/replacetokens-task/issues/8)).

## 5.0.0
Task 6.0.0
- **Breaking changes**: the task was completely rewritten to use the npm package [@qetza/replacetokens](https://www.npmjs.com/package/@qetza/replacetokens) and be more similar with the new [ReplaceTokens GitHub Actions](https://github.com/marketplace/actions/replacetokens):
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ The task was completely rewritten to use the npm package [@qetza/replacetokens](
# Optional. Default: false
addBOM: ''

# A YAML formatted string containing additional variable values.
# A YAML formatted string containing additional variable values (keys are case-insensitive).
# YAML can be:
# - an object: properties will be parsed as key/value pairs
# - a string starting with '@': value is parsed as multiple glob patterns separated
Expand All @@ -91,11 +91,12 @@ The task was completely rewritten to use the npm package [@qetza/replacetokens](
# Example:
# - '@**/*.json;**/*.yml;!**/local/*'
# - '$COMPUTER_VARS'
# -
# var1: '${{ parameters.var1 }}'
# - var1: '${{ parameters.var1 }}'
#
# will add all variables from '.json' and '.yml' files except under 'local' directory,
# from the environment variable 'COMPUTER_VARS' and the inline variable 'var1'
# will add all variables from:
# - '.json' and '.yml' files except under 'local' directory,
# - the environment variable 'COMPUTER_VARS'
# - the inline variable 'var1'
#
# Optional.
additionalVariables: ''
Expand Down
3 changes: 3 additions & 0 deletions tasks/ReplaceTokensV6/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 6.0.1
- Fix missing default variables due to case-sensitivity ([#8](https://github.com/qetza/replacetokens-task/issues/8)).

## 6.0.0
- **Breaking changes**: the task was completely rewritten to use the npm package [@qetza/replacetokens](https://www.npmjs.com/package/@qetza/replacetokens) and be more similar with the new [ReplaceTokens GitHub Actions](https://github.com/marketplace/actions/replacetokens):
- support only node 16
Expand Down
11 changes: 6 additions & 5 deletions tasks/ReplaceTokensV6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ The task was completely rewritten to use the npm package [@qetza/replacetokens](
# Optional. Default: false
addBOM: ''

# A YAML formatted string containing additional variable values.
# A YAML formatted string containing additional variable values (keys are case-insensitive).
# YAML can be:
# - an object: properties will be parsed as key/value pairs
# - a string starting with '@': value is parsed as multiple glob patterns separated
Expand All @@ -91,11 +91,12 @@ The task was completely rewritten to use the npm package [@qetza/replacetokens](
# Example:
# - '@**/*.json;**/*.yml;!**/local/*'
# - '$COMPUTER_VARS'
# -
# var1: '${{ parameters.var1 }}'
# - var1: '${{ parameters.var1 }}'
#
# will add all variables from '.json' and '.yml' files except under 'local' directory,
# from the environment variable 'COMPUTER_VARS' and the inline variable 'var1'
# will add all variables from:
# - '.json' and '.yml' files except under 'local' directory,
# - the environment variable 'COMPUTER_VARS'
# - the inline variable 'var1'
#
# Optional.
additionalVariables: ''
Expand Down
12 changes: 6 additions & 6 deletions tasks/ReplaceTokensV6/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tasks/ReplaceTokensV6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@opentelemetry/api": "^1.8.0",
"@opentelemetry/sdk-trace-base": "^1.22.0",
"@opentelemetry/semantic-conventions": "^1.22.0",
"@qetza/replacetokens": "^1.2.0",
"@qetza/replacetokens": "^1.3.0",
"axios": "^1.6.7",
"azure-pipelines-task-lib": "^4.1.0",
"fast-glob": "^3.3.2",
Expand Down
2 changes: 1 addition & 1 deletion tasks/ReplaceTokensV6/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"version": {
"Major": 6,
"Minor": 0,
"Patch": 0
"Patch": 1
},
"releaseNotes": "breaking changes, see [changelog](https://github.com/qetza/replacetokens-task/blob/master/tasks/ReplaceTokensV6/CHANGELOG.md)",
"instanceNameFormat": "Replace tokens",
Expand Down
13 changes: 6 additions & 7 deletions tasks/ReplaceTokensV6/tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe('ReplaceTokens v6 L0 suite', function () {
tr.succeeded.should.be.true;

tr.stdout.should.include('sources: ["**/*.json","**/*.xml","**/*.yml"]');
tr.stdout.should.include('variables: {"var_secret":"secret","var_yml2":"secret","var_var":"var","var_yaml2":"var"}');
tr.stdout.should.include('variables: {"VAR_SECRET":"secret","VAR_YML2":"secret","VAR_VAR":"var","VAR_YAML2":"var"}');
tr.stdout.should.include(
'options: {"addBOM":false,"encoding":"auto","escape":{"type":"auto"},"missing":{"action":"none","default":"","log":"warn"},"recursive":false,"separator":".","token":{"pattern":"default"},"transforms":{"enabled":false,"prefix":"(","suffix":")"}}'
);
Expand Down Expand Up @@ -327,7 +327,7 @@ describe('ReplaceTokens v6 L0 suite', function () {
tr.stdout.should.include(`##vso[task.debug]loading variables from file '${path.join(data, 'vars.yml').replace(/\\/g, '/')}'`);
tr.stdout.should.include(`##vso[task.debug]loading variables from file '${path.join(data, 'vars.yaml').replace(/\\/g, '/')}'`);

tr.stdout.should.include('variables: {"var_json":"file","var_yaml1":"file","var_yaml2":"file","var_yml1":"file","var_yml2":"file"}');
tr.stdout.should.include('variables: {"VAR_JSON":"file","VAR_YAML1":"file","VAR_YAML2":"file","VAR_YML1":"file","VAR_YML2":"file"}');
}, tr);
});

Expand All @@ -347,7 +347,7 @@ describe('ReplaceTokens v6 L0 suite', function () {
runValidations(() => {
tr.stdout.should.include("##vso[task.debug]loading variables from environment variable '__VARS__'");

tr.stdout.should.include('variables: {"var1":"value1","var2":"value2"}');
tr.stdout.should.include('variables: {"VAR1":"value1","VAR2":"value2"}');
}, tr);
});

Expand All @@ -367,7 +367,7 @@ describe('ReplaceTokens v6 L0 suite', function () {

// assert
runValidations(() => {
tr.stdout.should.include('variables: {"var1":"value1","var2":"value2"}');
tr.stdout.should.include('variables: {"VAR1":"value1","VAR2":"value2"}');
}, tr);
});

Expand All @@ -388,8 +388,7 @@ describe('ReplaceTokens v6 L0 suite', function () {
process.env['__additionalVariables__'] = `
- '@**/_data/vars.*;!**/*.xml'
- '$__VARS__'
-
var2: inline
- var2: inline
var_yml2: inline
`;

Expand All @@ -400,7 +399,7 @@ describe('ReplaceTokens v6 L0 suite', function () {
// assert
runValidations(() => {
tr.stdout.should.include(
'variables: {"var_secret":"secret","var_yml2":"inline","var_var":"var","var_yaml2":"file","var_json":"file","var_yaml1":"file","var_yml1":"file","var1":"env","var2":"inline"}'
'variables: {"VAR_SECRET":"secret","VAR_YML2":"inline","VAR_VAR":"var","VAR_YAML2":"file","VAR_JSON":"file","VAR_YAML1":"file","VAR_YML1":"file","VAR1":"env","VAR2":"inline"}'
);
}, tr);
} finally {
Expand Down
2 changes: 1 addition & 1 deletion vss-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifestVersion": 1,
"id": "replacetokens",
"name": "Replace Tokens",
"version": "5.0.0",
"version": "5.0.1",
"public": true,
"publisher": "qetza",
"targets": [
Expand Down