Skip to content

Commit

Permalink
Fix legacy template parameter passing (#355)
Browse files Browse the repository at this point in the history
* all scalars should be converted to string like for templatecontext of job/stage
  • Loading branch information
ChristopherHX authored Jun 15, 2024
1 parent 9f3d6a1 commit 7a27981
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Sdk/AzurePipelines/AzureDevops.cs
Original file line number Diff line number Diff line change
Expand Up @@ -706,11 +706,11 @@ public static async Task<MappingToken> ReadTemplate(Runner.Server.Azure.Devops.C
var paramname = (kv.Key as StringToken)?.Value;
if (cparameters?.TryGetValue(paramname, out var value) == true)
{
parametersData[paramname] = value.ToContextData();
parametersData[paramname] = ConvertAllScalarsToString(value).ToContextData();
}
else
{
parametersData[paramname] = kv.Value.ToContextData();
parametersData[paramname] = ConvertAllScalarsToString(kv.Value).ToContextData();
}
}
}
Expand Down Expand Up @@ -776,7 +776,7 @@ public static async Task<MappingToken> ReadTemplate(Runner.Server.Azure.Devops.C
templateContext.Errors.Check();
if(!strictParametersCheck && cparameters != null) {
foreach(var param in cparameters) {
parametersData[param.Key] = param.Value.ToContextData();
parametersData[param.Key] = ConvertAllScalarsToString(param.Value).ToContextData();
}
}

Expand Down
8 changes: 8 additions & 0 deletions src/azure-pipelines-vscode-ext/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
### v0.0.16
- fix steps.*.continueOnError / allowed boolean values
- make condition stricter
- no longer accept `$[ ]` for conditions
- check step conditions
- fix invalid parameter passing to legacy templates using a parameter mapping or omit it
- all scalars should be strings like for job/stage templateContext

### v0.0.15
- fix variable templates using expressions in it's parameters
- fix empty dependsOn e.g. empty string is not a missing dependency
Expand Down
2 changes: 1 addition & 1 deletion src/azure-pipelines-vscode-ext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"Programming Languages"
],
"icon": "pipeline-rocket.png",
"version": "0.0.15",
"version": "0.0.16",
"publisher": "christopherhx",
"repository": "https://github.com/ChristopherHX/runner.server",
"engines": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
parameters:
# 1es specific parameters
is1ESPipeline: ''

jobs:
- job:
steps:
- ${{ if eq(parameters.is1ESPipeline, '') }}:
- 'Illegal entry point, is1ESPipeline is not defined. Repository yaml should not directly reference templates in core-templates folder.': error
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
jobs:
- template: /job.yml
parameters:
is1ESPipeline: false

steps:
- bash: exit 0

0 comments on commit 7a27981

Please sign in to comment.