Just "grep" what we're after

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2024-03-27 08:28:37 +00:00
parent b556845850
commit 62f13b32ec
2 changed files with 4 additions and 8 deletions

View file

@ -107,10 +107,8 @@ if ( [String]::IsNullOrEmpty($Version) ) {
$yaml = Get-Content -Path "$PROJECT_DIR\cicd\shared-gh-workflows-context.yml"
$dict_versions = @{}
$yaml | ForEach-Object {
$val1, $val2 = $_ -split ": "
$dict_versions[$val1] = $val2.Trim("""")
}
$dict_versions["python_version"]=($yaml | Select-String -Pattern "python_version: (.*)").matches.groups[1].Value.Trim("""")
$dict_versions["relenv_version"]=($yaml | Select-String -Pattern "relenv_version: (.*)").matches.groups[1].Value.Trim("""")
if ( [String]::IsNullOrEmpty($PythonVersion) ) {
$PythonVersion = $dict_versions["python_version"]

View file

@ -77,10 +77,8 @@ function Write-Result($result, $ForegroundColor="Green") {
$yaml = Get-Content -Path "$PROJECT_DIR\cicd\shared-gh-workflows-context.yml"
$dict_versions = @{}
$yaml | ForEach-Object {
$val1, $val2 = $_ -split ": "
$dict_versions[$val1] = $val2.Trim("""")
}
$dict_versions["python_version"]=($yaml | Select-String -Pattern "python_version: (.*)").matches.groups[1].Value.Trim("""")
$dict_versions["relenv_version"]=($yaml | Select-String -Pattern "relenv_version: (.*)").matches.groups[1].Value.Trim("""")
if ( [String]::IsNullOrEmpty($Version) ) {
$Version = $dict_versions["python_version"]