Skip to content

Commit e47b867

Browse files
dotnet-maestro[bot]baronfel
authored andcommitted
[master] Update dependencies from dotnet/arcade (#7013)
* Update dependencies from https://github.com/dotnet/arcade build 20190618.2 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19318.2 * Update dependencies from https://github.com/dotnet/arcade build 20190619.1 - Microsoft.DotNet.Arcade.Sdk - 1.0.0-beta.19319.1
1 parent 59d515c commit e47b867

File tree

9 files changed

+313
-16
lines changed

9 files changed

+313
-16
lines changed

eng/Version.Details.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<ProductDependencies>
44
</ProductDependencies>
55
<ToolsetDependencies>
6-
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19315.2">
6+
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19319.1">
77
<Uri>https://github.com/dotnet/arcade</Uri>
8-
<Sha>aa4285be7fab64e2b6e62e4d5688ea50931c407c</Sha>
8+
<Sha>209388b8a700bb99690ae7fbbabe7e55f1999a8f</Sha>
99
</Dependency>
1010
</ToolsetDependencies>
1111
</Dependencies>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@{
2+
IncludeRules=@('PSAvoidUsingCmdletAliases',
3+
'PSAvoidUsingWMICmdlet',
4+
'PSAvoidUsingPositionalParameters',
5+
'PSAvoidUsingInvokeExpression',
6+
'PSUseDeclaredVarsMoreThanAssignments',
7+
'PSUseCmdletCorrectly',
8+
'PSStandardDSCFunctionsInResource',
9+
'PSUseIdenticalMandatoryParametersForDSC',
10+
'PSUseIdenticalParametersForDSC')
11+
}
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
param(
2+
[Parameter(Mandatory=$true)][string] $Operation,
3+
[string] $AuthToken,
4+
[string] $CommitSha,
5+
[string] $RepoName,
6+
[switch] $IsFeedPrivate
7+
)
8+
9+
$ErrorActionPreference = "Stop"
10+
Set-StrictMode -Version 2.0
11+
12+
. $PSScriptRoot\tools.ps1
13+
14+
# Sets VSS_NUGET_EXTERNAL_FEED_ENDPOINTS based on the "darc-int-*" feeds defined in NuGet.config. This is needed
15+
# in build agents by CredProvider to authenticate the restore requests to internal feeds as specified in
16+
# https://github.com/microsoft/artifacts-credprovider/blob/0f53327cd12fd893d8627d7b08a2171bf5852a41/README.md#environment-variables. This should ONLY be called from identified
17+
# internal builds
18+
function SetupCredProvider {
19+
param(
20+
[string] $AuthToken
21+
)
22+
23+
# Install the Cred Provider NuGet plugin
24+
Write-Host "Setting up Cred Provider NuGet plugin in the agent..."
25+
Write-Host "Getting 'installcredprovider.ps1' from 'https://github.com/microsoft/artifacts-credprovider'..."
26+
27+
$url = 'https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.ps1'
28+
29+
Write-Host "Writing the contents of 'installcredprovider.ps1' locally..."
30+
Invoke-WebRequest $url -OutFile installcredprovider.ps1
31+
32+
Write-Host "Installing plugin..."
33+
.\installcredprovider.ps1 -Force
34+
35+
Write-Host "Deleting local copy of 'installcredprovider.ps1'..."
36+
Remove-Item .\installcredprovider.ps1
37+
38+
if (-Not("$env:USERPROFILE\.nuget\plugins\netcore")) {
39+
Write-Host "CredProvider plugin was not installed correctly!"
40+
ExitWithExitCode 1
41+
}
42+
else {
43+
Write-Host "CredProvider plugin was installed correctly!"
44+
}
45+
46+
# Then, we set the 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' environment variable to restore from the stable
47+
# feeds successfully
48+
49+
$nugetConfigPath = "$RepoRoot\NuGet.config"
50+
51+
if (-Not (Test-Path -Path $nugetConfigPath)) {
52+
Write-Host "NuGet.config file not found in repo's root!"
53+
ExitWithExitCode 1
54+
}
55+
56+
$endpoints = New-Object System.Collections.ArrayList
57+
$nugetConfigPackageSources = Select-Xml -Path $nugetConfigPath -XPath "//packageSources/add[contains(@key, 'darc-int-')]/@value" | foreach{$_.Node.Value}
58+
59+
if (($nugetConfigPackageSources | Measure-Object).Count -gt 0 ) {
60+
foreach ($stableRestoreResource in $nugetConfigPackageSources) {
61+
$trimmedResource = ([string]$stableRestoreResource).Trim()
62+
[void]$endpoints.Add(@{endpoint="$trimmedResource"; password="$AuthToken"})
63+
}
64+
}
65+
66+
if (($endpoints | Measure-Object).Count -gt 0) {
67+
# Create the JSON object. It should look like '{"endpointCredentials": [{"endpoint":"http://example.index.json", "username":"optional", "password":"accesstoken"}]}'
68+
$endpointCredentials = @{endpointCredentials=$endpoints} | ConvertTo-Json -Compress
69+
70+
# Create the environment variables the AzDo way
71+
Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data $endpointCredentials -Properties @{
72+
'variable' = 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS'
73+
'issecret' = 'false'
74+
}
75+
76+
# We don't want sessions cached since we will be updating the endpoints quite frequently
77+
Write-LoggingCommand -Area 'task' -Event 'setvariable' -Data 'False' -Properties @{
78+
'variable' = 'NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED'
79+
'issecret' = 'false'
80+
}
81+
}
82+
else
83+
{
84+
Write-Host "No internal endpoints found in NuGet.config"
85+
}
86+
}
87+
88+
#Workaround for https://github.com/microsoft/msbuild/issues/4430
89+
function InstallDotNetSdkAndRestoreArcade {
90+
$dotnetTempDir = "$RepoRoot\dotnet"
91+
$dotnetSdkVersion="2.1.507" # After experimentation we know this version works when restoring the SDK (compared to 3.0.*)
92+
$dotnet = "$dotnetTempDir\dotnet.exe"
93+
$restoreProjPath = "$PSScriptRoot\restore.proj"
94+
95+
Write-Host "Installing dotnet SDK version $dotnetSdkVersion to restore Arcade SDK..."
96+
InstallDotNetSdk "$dotnetTempDir" "$dotnetSdkVersion"
97+
98+
'<Project Sdk="Microsoft.DotNet.Arcade.Sdk"/>' | Out-File "$restoreProjPath"
99+
100+
& $dotnet restore $restoreProjPath
101+
102+
Write-Host "Arcade SDK restored!"
103+
104+
if (Test-Path -Path $restoreProjPath) {
105+
Remove-Item $restoreProjPath
106+
}
107+
108+
if (Test-Path -Path $dotnetTempDir) {
109+
Remove-Item $dotnetTempDir -Recurse
110+
}
111+
}
112+
113+
try {
114+
Push-Location $PSScriptRoot
115+
116+
if ($Operation -like "setup") {
117+
SetupCredProvider $AuthToken
118+
}
119+
elseif ($Operation -like "install-restore") {
120+
InstallDotNetSdkAndRestoreArcade
121+
}
122+
else {
123+
Write-Host "Unknown operation '$Operation'!"
124+
ExitWithExitCode 1
125+
}
126+
}
127+
catch {
128+
Write-Host $_
129+
Write-Host $_.Exception
130+
Write-Host $_.ScriptStackTrace
131+
ExitWithExitCode 1
132+
}
133+
finally {
134+
Pop-Location
135+
}
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# Sets VSS_NUGET_EXTERNAL_FEED_ENDPOINTS based on the "darc-int-*" feeds defined in NuGet.config. This is needed
6+
# in build agents by CredProvider to authenticate the restore requests to internal feeds as specified in
7+
# https://github.com/microsoft/artifacts-credprovider/blob/0f53327cd12fd893d8627d7b08a2171bf5852a41/README.md#environment-variables.
8+
# This should ONLY be called from identified internal builds
9+
function SetupCredProvider {
10+
local authToken=$1
11+
12+
# Install the Cred Provider NuGet plugin
13+
echo "Setting up Cred Provider NuGet plugin in the agent..."...
14+
echo "Getting 'installcredprovider.ps1' from 'https://github.com/microsoft/artifacts-credprovider'..."
15+
16+
local url="https://raw.githubusercontent.com/microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh"
17+
18+
echo "Writing the contents of 'installcredprovider.ps1' locally..."
19+
local installcredproviderPath="installcredprovider.sh"
20+
if command -v curl > /dev/null; then
21+
curl $url > "$installcredproviderPath"
22+
else
23+
wget -q -O "$installcredproviderPath" "$url"
24+
fi
25+
26+
echo "Installing plugin..."
27+
. "$installcredproviderPath"
28+
29+
echo "Deleting local copy of 'installcredprovider.sh'..."
30+
rm installcredprovider.sh
31+
32+
if [ ! -d "$HOME/.nuget/plugins" ]; then
33+
echo "CredProvider plugin was not installed correctly!"
34+
ExitWithExitCode 1
35+
else
36+
echo "CredProvider plugin was installed correctly!"
37+
fi
38+
39+
# Then, we set the 'VSS_NUGET_EXTERNAL_FEED_ENDPOINTS' environment variable to restore from the stable
40+
# feeds successfully
41+
42+
local nugetConfigPath="$repo_root/NuGet.config"
43+
44+
if [ ! "$nugetConfigPath" ]; then
45+
echo "NuGet.config file not found in repo's root!"
46+
ExitWithExitCode 1
47+
fi
48+
49+
local endpoints='['
50+
local nugetConfigPackageValues=`cat "$nugetConfigPath" | grep "key=\"darc-int-"`
51+
local pattern="value=\"(.*)\""
52+
53+
for value in $nugetConfigPackageValues
54+
do
55+
if [[ $value =~ $pattern ]]; then
56+
local endpoint="${BASH_REMATCH[1]}"
57+
endpoints+="{\"endpoint\": \"$endpoint\", \"password\": \"$authToken\"},"
58+
fi
59+
done
60+
61+
endpoints=${endpoints%?}
62+
endpoints+=']'
63+
64+
if [ ${#endpoints} -gt 2 ]; then
65+
# Create the JSON object. It should look like '{"endpointCredentials": [{"endpoint":"http://example.index.json", "username":"optional", "password":"accesstoken"}]}'
66+
local endpointCredentials="{\"endpointCredentials\": "$endpoints"}"
67+
68+
echo "##vso[task.setvariable variable=VSS_NUGET_EXTERNAL_FEED_ENDPOINTS]$endpointCredentials"
69+
echo "##vso[task.setvariable variable=NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED]False"
70+
else
71+
echo "No internal endpoints found in NuGet.config"
72+
fi
73+
}
74+
75+
# Workaround for https://github.com/microsoft/msbuild/issues/4430
76+
function InstallDotNetSdkAndRestoreArcade {
77+
local dotnetTempDir="$repo_root/dotnet"
78+
local dotnetSdkVersion="2.1.507" # After experimentation we know this version works when restoring the SDK (compared to 3.0.*)
79+
local restoreProjPath="$repo_root/eng/common/restore.proj"
80+
81+
echo "Installing dotnet SDK version $dotnetSdkVersion to restore Arcade SDK..."
82+
echo "<Project Sdk=\"Microsoft.DotNet.Arcade.Sdk\"/>" > "$restoreProjPath"
83+
84+
InstallDotNetSdk "$dotnetTempDir" "$dotnetSdkVersion"
85+
86+
local res=`$dotnetTempDir/dotnet restore $restoreProjPath`
87+
echo "Arcade SDK restored!"
88+
89+
# Cleanup
90+
if [ "$restoreProjPath" ]; then
91+
rm "$restoreProjPath"
92+
fi
93+
94+
if [ "$dotnetTempDir" ]; then
95+
rm -r $dotnetTempDir
96+
fi
97+
}
98+
99+
source="${BASH_SOURCE[0]}"
100+
operation=''
101+
authToken=''
102+
repoName=''
103+
104+
while [[ $# > 0 ]]; do
105+
opt="$(echo "$1" | awk '{print tolower($0)}')"
106+
case "$opt" in
107+
--operation)
108+
operation=$2
109+
shift
110+
;;
111+
--authtoken)
112+
authToken=$2
113+
shift
114+
;;
115+
*)
116+
echo "Invalid argument: $1"
117+
usage
118+
exit 1
119+
;;
120+
esac
121+
122+
shift
123+
done
124+
125+
while [[ -h "$source" ]]; do
126+
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
127+
source="$(readlink "$source")"
128+
# if $source was a relative symlink, we need to resolve it relative to the path where the
129+
# symlink file was located
130+
[[ $source != /* ]] && source="$scriptroot/$source"
131+
done
132+
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
133+
134+
. "$scriptroot/tools.sh"
135+
136+
if [ "$operation" = "setup" ]; then
137+
SetupCredProvider $authToken
138+
elif [ "$operation" = "install-restore" ]; then
139+
InstallDotNetSdkAndRestoreArcade
140+
else
141+
echo "Unknown operation '$operation'!"
142+
fi

eng/common/templates/job/publish-build-assets.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ jobs:
5757
/p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com
5858
/p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }}
5959
/p:Configuration=$(_BuildConfig)
60-
/v:detailed
6160
condition: ${{ parameters.condition }}
6261
continueOnError: ${{ parameters.continueOnError }}
6362
- task: powershell@2

eng/common/templates/post-build/channels/public-dev-release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ stages:
138138
inputs:
139139
targetType: inline
140140
script: |
141-
darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken)
142-
continueOnError: true
141+
darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com/ --password $(MaestroAccessToken) --latest-location
143142
144143
- template: ../promote-build.yml
145144
parameters:

eng/common/templates/post-build/channels/public-validation-release.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ stages:
8484
inputs:
8585
targetType: inline
8686
script: |
87-
darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com --password $(MaestroAccessToken)
88-
continueOnError: true
87+
darc gather-drop --non-shipping --continue-on-error --id $(BARBuildId) --output-dir $(Agent.BuildDirectory)/Temp/Drop/ --bar-uri https://maestro-prod.westus2.cloudapp.azure.com --password $(MaestroAccessToken) --latest-location
8988
9089
- template: ../promote-build.yml
9190
parameters:

eng/common/templates/post-build/setup-maestro-vars.yml

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,23 @@ jobs:
1616
inputs:
1717
targetType: inline
1818
script: |
19-
. "$(Build.SourcesDirectory)/eng/common/tools.ps1"
20-
21-
$BarId = Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/BARBuildId.txt"
22-
Write-PipelineSetVariable -Name 'BARBuildId' -Value $BarId
23-
24-
$Channels = ""
25-
Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/Channels.txt" | ForEach-Object { $Channels += "$_ ," }
26-
Write-PipelineSetVariable -Name 'InitialChannels' -Value "$Channels"
19+
# This is needed to make Write-PipelineSetVariable works in this context
20+
if ($env:BUILD_BUILDNUMBER -ne "" -and $env:BUILD_BUILDNUMBER -ne $null) {
21+
$ci = $true
22+
23+
. "$(Build.SourcesDirectory)/eng/common/tools.ps1"
24+
25+
$BarId = Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/BARBuildId.txt"
26+
Write-PipelineSetVariable -Name 'BARBuildId' -Value $BarId
27+
28+
Write-Host "Asked Write-PipelineSetVariable to create BARBuildId with value '$BarId'"
29+
30+
$Channels = ""
31+
Get-Content "$(Build.StagingDirectory)/ReleaseConfigs/Channels.txt" | ForEach-Object { $Channels += "$_ ," }
32+
Write-PipelineSetVariable -Name 'InitialChannels' -Value "$Channels"
33+
34+
Write-Host "Asked Write-PipelineSetVariable to create InitialChannels with value '$Channels'"
35+
}
36+
else {
37+
Write-Host "This step can only be run in an Azure DevOps CI environment."
38+
}

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
},
1212
"msbuild-sdks": {
13-
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19315.2",
13+
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19319.1",
1414
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
1515
}
1616
}

0 commit comments

Comments
 (0)