-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
powershell-yaml wraps YamlDotNet, but hasn't been updated in a while. the mechanism it uses for ConvertFrom-Yaml uses Parser which throws duplicate key exceptions. Deserialize does not throw duplicate key exceptions. Given it's common to have duplication in gitlab CI yaml, allowing overlap/merging is better than throwing
- Loading branch information
1 parent
66d078d
commit 7679106
Showing
5 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Adapted from | ||
# https://github.com/cloudbase/powershell-yaml/blob/master/Load-Assemblies.ps1 | ||
|
||
$Here = Split-Path -Parent $MyInvocation.MyCommand.Path | ||
|
||
function Initialize-Assembly { | ||
$LibDir = Join-Path $Here "lib" | ||
|
||
return [Reflection.Assembly]::LoadFrom($(Join-Path $libDir "YamlDotNet.dll")) | ||
} | ||
|
||
function Initialize-Assemblies { | ||
$RequiredTypes = @( | ||
"Parser", "MergingParser", "YamlStream", | ||
"YamlMappingNode", "YamlSequenceNode", | ||
"YamlScalarNode", "ChainedEventEmitter", | ||
"Serializer", "Deserializer", "SerializerBuilder", | ||
"StaticTypeResolver" | ||
) | ||
|
||
$YamlDotNet = [System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object Location -Match "YamlDotNet.dll" | ||
if (!$YamlDotNet) { | ||
return Initialize-Assembly | ||
} | ||
|
||
foreach ($i in $RequiredTypes){ | ||
if ($i -notin $YamlDotNet.DefinedTypes.Name) { | ||
throw "YamlDotNet is loaded but missing required types ($i). Older version installed on system?" | ||
} | ||
} | ||
} | ||
|
||
Initialize-Assemblies | Out-Null |
Binary file not shown.