You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Script checks if newly built mof files have differences to the mof files on the pull server. Necessary exeptions are in line 17 counting from the bottom.
param(
[Parameter(Mandatory=$false)]
[String]$PullServer=''
)
Write-Output"Testserver? $($UseTestServer)"$teamName=$env:TEAMWrite-Output"Detected team name: $($teamName)"$buildMofsPath= (Join-Path-Path $env:ci_project_dir-ChildPath "$($teamName)\BuildOutput\MOF")
$oldMofsPath="\\$($PullServer)\DscService\Configuration"$buildMofs=Get-ChildItem-Path $buildMofsPath-Filter '*.mof'-File
foreach($mofin$buildMofs)
{
$oldMof=Get-ChildItem-Path $oldMofsPath-Filter "$($mof.BaseName).mof"-File
if($oldMof.Count-eq0)
{
throw"Could not find mof file for $($mof.BaseName) in $($oldMofsPath)!"
}
elseif($oldMof.Count-ge2)
{
throw"Found 2 or more mof file for $($mof.BaseName) in $($oldMofsPath)!"
}
$mofContent=Get-Content-Path $mof.FullName$index=$mofContent.IndexOf("instance of OMI_ConfigurationDocument")
$lastLines=$mofContent.Length-$index$mofContent=$mofContent|Select-Object-Skip 6|Select-Object-SkipLast $lastLines#Skip first and last lines as they contain the build date but no config data$oldMofContent=Get-Content-Path $oldMof.FullName$oldIndex=$oldMofContent.IndexOf("instance of OMI_ConfigurationDocument")
$oldLastLines=$oldMofContent.Length-$oldIndex$oldMofContent=$oldMofContent|Select-Object-Skip 6|Select-Object-SkipLast $oldLastLines$res=Compare-Object-ReferenceObject $mofContent-DifferenceObject $oldMofContent
[string[]]$out=@()
#Filter out some config data that changes after every build although yml files are the sameforeach($rin$res.InputObject)
{ #Matches: Password, BuildDate&Time, Path to Dsc Modules (incl. runner path), StartTime of scheduled Task (varies based on build time), version, buildnumber, git commit idif(($r-match'^Password = ') -or ($r-match'^\s{4}\"\d{2}.\d{2}.\d{4}\s\d{2}:\d{2}:\d{2}\"$') -or ($r-match'^ SourceInfo = ') -or ($r-match'^ StartTime = \"\d{14}.\d{6}\+\d{3}\";$') -or ($r-match'^\s{4}\"\d{1,2}.\d{1,2}.\d{1,4}\"$') -or ($r-match'^\s{4}\"\d{1,4}\"$') -or ($r-match'^\s{4}\"\w{40}\"$'))
{
}else
{
$out+=$r
}
}
if($out.Count-ne0)
{
Write-Output"Differences in MOF files $($mof.BaseName) found (see below)! Deploy will be triggered..."$out|foreach-object {
Write-Output$_
}
$SKIPDEPLOY=$false#Deploy will be triggered
}# If no mof has differences, do nothing as default value for SKIPDEPLOY is "True"
}
if($SKIPDEPLOY-ne$false)
{
$SKIPDEPLOY=$trueWrite-Output"No differences in MOF files found. Skipping deploy..."
}
#$SKIPDEPLOY | Out-File -FilePath envVars.envAdd-Content-Path envVars.env -Value "SKIPDEPLOY=$($SKIPDEPLOY)"`
The text was updated successfully, but these errors were encountered:
Script checks if newly built mof files have differences to the mof files on the pull server. Necessary exeptions are in line 17 counting from the bottom.
The text was updated successfully, but these errors were encountered: