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

Fixes for azurepipeline extend variable support #230

Merged
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
1 change: 1 addition & 0 deletions .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ jobs:
gharun --event azpipelines -C testworkflows/azpipelines/relative-and-absolute-paths -W testworkflows/azpipelines/relative-and-absolute-paths/pipeline.yml
gharun --event azpipelines -C testworkflows/azpipelines/null-each-loop -W testworkflows/azpipelines/null-each-loop/pipeline.yml
gharun --event azpipelines -C testworkflows/azpipelines/cross-repo-relative-paths/repo1 -W testworkflows/azpipelines/cross-repo-relative-paths/repo1/pipeline.yml --local-repository central/shared@main=testworkflows/azpipelines/cross-repo-relative-paths/repo2
gharun --event azpipelines -C testworkflows/azpipelines/extend-variables -W testworkflows/azpipelines/extend-variables/pipeline.yml
- name: Windows Container Change Firewall Settings
if: contains(matrix.os, 'windows') && !job.container
run: |
Expand Down
10 changes: 7 additions & 3 deletions src/Sdk/AzurePipelines/Pipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,12 @@ public Pipeline Parse(Runner.Server.Azure.Devops.Context context, TemplateToken
}
}
if(parent.Variables != null) {
foreach(var cr in parent.Variables) {
Variables[cr.Key] = cr.Value;
if (Variables == null) {
Variables = parent.Variables;
variablesMetaData = parent.variablesMetaData;
} else {
// emulate the error message provided by Azure Pipelines
throw new NotSupportedException("__built-in-schema.yml (Line: 40, Col:11): 'variables' is already defined");
}
}
}
Expand Down Expand Up @@ -208,4 +212,4 @@ public DictionaryContextData ToContextData() {
return pipeline;
}
}
}
}
6 changes: 6 additions & 0 deletions testworkflows/azpipelines/extend-variables/base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# not supported:
#variables:
# provided: value

steps:
- script: exit 0
5 changes: 5 additions & 0 deletions testworkflows/azpipelines/extend-variables/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
variables:
pipeline: value

extends:
template: base.yml