Skip to content

Commit 2382cd4

Browse files
Update Install Script to enable Self-Contained Download (#540)
Update install scripts to enable Self-Contained Download --------- Co-authored-by: John Schmeichel <[email protected]>
1 parent 32391f7 commit 2382cd4

File tree

3 files changed

+75
-4
lines changed

3 files changed

+75
-4
lines changed

build/validate-install-script.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ jobs:
1717
repo: self
1818
scriptInputs: '-InstallNet8'
1919
expectedCredentialProviderVersion: 'Microsoft.Net8.NuGet.CredentialProvider'
20+
- job: WindowsInstallNet8winx64
21+
pool:
22+
vmImage: windows-latest
23+
steps:
24+
- template: validate-install-script-powershell.yml@self
25+
parameters:
26+
repo: self
27+
scriptInputs: '-InstallNet8 -RuntimeIdentifier win-x64'
28+
expectedCredentialProviderVersion: 'Microsoft.Net8.win-x64.NuGet.CredentialProvider'
2029
- job: WindowsInstallNetfxDefault
2130
pool:
2231
vmImage: windows-latest
@@ -55,4 +64,52 @@ jobs:
5564
export USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER=false
5665
export USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER=true
5766
expectedCredentialProviderVersion: 'Microsoft.Net8.NuGet.CredentialProvider'
67+
- job: LinuxInstallNet8linuxx64
68+
pool:
69+
vmImage: ubuntu-latest
70+
steps:
71+
- template: validate-install-script-bash.yml@self
72+
parameters:
73+
repo: self
74+
scriptEnvVariables: |
75+
export USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER=false
76+
export USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER=true
77+
export ARTIFACTS_CREDENTIAL_PROVIDER_RID=linux-x64
78+
expectedCredentialProviderVersion: 'Microsoft.Net8.linux-x64.NuGet.CredentialProvider'
79+
- job: LinuxInstallNet8linuxarm64
80+
pool:
81+
vmImage: ubuntu-latest
82+
steps:
83+
- template: validate-install-script-bash.yml@self
84+
parameters:
85+
repo: self
86+
scriptEnvVariables: |
87+
export USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER=false
88+
export USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER=true
89+
export ARTIFACTS_CREDENTIAL_PROVIDER_RID=linux-arm64
90+
expectedCredentialProviderVersion: 'Microsoft.Net8.linux-arm64.NuGet.CredentialProvider'
91+
- job: LinuxInstallNet8osxarm64
92+
pool:
93+
vmImage: ubuntu-latest
94+
steps:
95+
- template: validate-install-script-bash.yml@self
96+
parameters:
97+
repo: self
98+
scriptEnvVariables: |
99+
export USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER=false
100+
export USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER=true
101+
export ARTIFACTS_CREDENTIAL_PROVIDER_RID=osx-arm64
102+
expectedCredentialProviderVersion: 'Microsoft.Net8.osx-arm64.NuGet.CredentialProvider'
103+
- job: LinuxInstallNet8osxx64
104+
pool:
105+
vmImage: ubuntu-latest
106+
steps:
107+
- template: validate-install-script-bash.yml@self
108+
parameters:
109+
repo: self
110+
scriptEnvVariables: |
111+
export USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER=false
112+
export USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER=true
113+
export ARTIFACTS_CREDENTIAL_PROVIDER_RID=osx-x64
114+
expectedCredentialProviderVersion: 'Microsoft.Net8.osx-x64.NuGet.CredentialProvider'
58115

helpers/installcredprovider.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ param(
1717
# install the .NET 6 cred provider instead of NetCore3.1
1818
[switch]$InstallNet6 = $true,
1919
# install the .NET 8 cred provider instead of NetCore3.1
20-
[switch]$InstallNet8
20+
[switch]$InstallNet8,
21+
# install the self-contained cred provider for the specified RuntimeIdentifier .
22+
[string]$RuntimeIdentifier
2123
)
2224

2325
$script:ErrorActionPreference='Stop'
@@ -103,6 +105,11 @@ if (!$releaseId) {
103105
$releaseUrl = [System.IO.Path]::Combine($releaseUrlBase, $releaseId)
104106
$releaseUrl = $releaseUrl.Replace("\","/")
105107

108+
$releaseRidPart = ""
109+
if (![string]::IsNullOrEmpty($RuntimeIdentifier)) {
110+
$releaseRIdPart = $RuntimeIdentifier + "."
111+
}
112+
106113
$zipFile = "Microsoft.NetCore3.NuGet.CredentialProvider.zip"
107114
if ($Version.StartsWith("0.")) {
108115
# versions lower than 1.0.0 installed NetCore2 zip
@@ -112,7 +119,7 @@ if ($InstallNet6 -eq $True) {
112119
$zipFile = "Microsoft.Net6.NuGet.CredentialProvider.zip"
113120
}
114121
if ($InstallNet8 -eq $True) {
115-
$zipFile = "Microsoft.Net8.NuGet.CredentialProvider.zip"
122+
$zipFile = "Microsoft.Net8.${releaseRidPart}NuGet.CredentialProvider.zip"
116123
}
117124
if ($AddNetfx -eq $True) {
118125
$zipFile = "Microsoft.NuGet.CredentialProvider.zip"

helpers/installcredprovider.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ if [ -z ${USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER} ] || [ ${USE_NET6_ARTIFACTS_CR
2424
esac
2525
# Don't attempt to install .NET 8 without a set variable.
2626
elif [ ! -z ${USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER} ] && [ ${USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER} != "false" ]; then
27-
FILE="Microsoft.Net8.NuGet.CredentialProvider.tar.gz"
27+
# Self-contained versions are available in latest versions of the .NET 8 credprovider.
28+
# To install a release with a specific runtime version set the `ARTIFACTS_CREDENTIAL_PROVIDER_RID` enviornment variable.
29+
# Otherwise default to the full zip file.
30+
RID=""
31+
if [ ! -z ${ARTIFACTS_CREDENTIAL_PROVIDER_RID} ]; then
32+
RID=".${ARTIFACTS_CREDENTIAL_PROVIDER_RID}"
33+
fi
34+
FILE="Microsoft.Net8$RID.NuGet.CredentialProvider.tar.gz"
2835

2936
# throw if version starts < 1.3.0. (net8 not supported)
3037
case ${AZURE_ARTIFACTS_CREDENTIAL_PROVIDER_VERSION} in
@@ -68,4 +75,4 @@ if ! curl -H "Accept: application/octet-stream" \
6875
exit 1
6976
fi
7077

71-
echo "INFO: credential provider netcore plugin extracted to $HOME/.nuget/"
78+
echo "INFO: credential provider netcore plugin extracted to $HOME/.nuget/"

0 commit comments

Comments
 (0)