@@ -5,6 +5,7 @@ parameters:
55 powershellExecutable : pwsh
66 buildDirectory : ' .'
77 useAzAuth : false
8+ DSCVersion : ' 3.2.0-rc.1'
89
910jobs :
1011- job : ${{ parameters.jobName }}
9596 displayName : ' Setup Azure Artifacts Credential Provider secret'
9697 condition : eq(${{ parameters.useAzAuth }}, false)
9798
99+ - pwsh : |
100+ $version = '${{ parameters.DSCVersion }}'
101+ $packageName = "DSC-$version"
102+ $ext = 'tar.gz'
103+ $executableName = 'dsc'
104+ $executableExt = if ($IsWindows) { '.exe' } else { '' }
105+
106+ $uri = if ($IsWindows) {
107+ $ext = 'zip'
108+ "https://github.com/PowerShell/DSC/releases/download/v$version/DSC-$version-x86_64-pc-windows-msvc.zip"
109+ } elseif ($IsLinux) {
110+ "https://github.com/PowerShell/DSC/releases/download/v$version/DSC-$version-x86_64-linux.tar.gz"
111+ }
112+ elseif ($IsMacOS) {
113+ "https://github.com/PowerShell/DSC/releases/download/v$version/DSC-$version-x86_64-apple-darwin.tar.gz"
114+
115+ }
116+ else {
117+ throw "Unsupported OS platform"
118+ }
119+
120+ $destPath = Join-Path -Path $env:AGENT_TEMPDIRECTORY -ChildPath "$packageName.$ext"
121+
122+ Write-Verbose -Verbose "Downloading DSC v3 from $uri to $destPath"
123+
124+ Invoke-WebRequest -Uri $uri -OutFile $destPath
125+
126+ if ($IsWindows) {
127+ Expand-Archive -Path $destPath -DestinationPath $env:AGENT_TEMPDIRECTORY -Force -Verbose
128+ }
129+ else {
130+ tar -xzf $destPath -C $env:AGENT_TEMPDIRECTORY
131+ }
132+
133+ $executableFileName = $executableName + $executableExt
134+
135+ $executable = Get-ChildItem -Path $env:AGENT_TEMPDIRECTORY -File -Recurse -Verbose | Where-Object { $_.Name -eq $executableFileName } | Select-Object -First 1
136+
137+ if (-not $executable) {
138+ throw "Could not find dsc executable in the downloaded package"
139+ }
140+
141+ $dscRoot = Split-Path -Path $executable.FullName -Parent
142+
143+ $vstsCommandString = "vso[task.setvariable variable=DSC_ROOT]$dscRoot"
144+ Write-Host "sending " + $vstsCommandString
145+ Write-Host "##$vstsCommandString"
146+
147+ displayName: 'Install latest DSC v3'
148+
98149 - pwsh : |
99150 Get-ChildItem -Path env: | Out-String -width 9999 -Stream | Write-Verbose -Verbose
100151 displayName: Capture environment
0 commit comments