Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Install Script to enable Self-Contained Download #540

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
54 changes: 54 additions & 0 deletions build/validate-install-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ jobs:
repo: self
scriptInputs: '-InstallNet8'
expectedCredentialProviderVersion: 'Microsoft.Net8.NuGet.CredentialProvider'
steps:
- template: validate-install-script-powershell.yml@self
parameters:
repo: self
scriptInputs: '-InstallNet8 -RuntimeIdentifier win-x64'
expectedCredentialProviderVersion: 'Microsoft.Net8.win-x64.NuGet.CredentialProvider'
- job: WindowsInstallNetfxDefault
pool:
vmImage: windows-latest
Expand Down Expand Up @@ -55,4 +61,52 @@ jobs:
export USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER=false
export USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER=true
expectedCredentialProviderVersion: 'Microsoft.Net8.NuGet.CredentialProvider'
- job: LinuxInstallNet8linux-x64
pool:
vmImage: ubuntu-latest
steps:
- template: validate-install-script-bash.yml@self
parameters:
repo: self
scriptEnvVariables: |
export USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER=false
export USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER=true
export ARTIFACTS_CREDENTIAL_PROVIDER_RID=linux-x64
expectedCredentialProviderVersion: 'Microsoft.Net8.linux-x64.NuGet.CredentialProvider'
- job: LinuxInstallNet8linux-arm64
pool:
vmImage: ubuntu-latest
steps:
- template: validate-install-script-bash.yml@self
parameters:
repo: self
scriptEnvVariables: |
export USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER=false
export USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER=true
export ARTIFACTS_CREDENTIAL_PROVIDER_RID=linux-arm64
expectedCredentialProviderVersion: 'Microsoft.Net8.linux-arm64.NuGet.CredentialProvider'
- job: LinuxInstallNet8osx-arm64
pool:
vmImage: ubuntu-latest
steps:
- template: validate-install-script-bash.yml@self
parameters:
repo: self
scriptEnvVariables: |
export USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER=false
export USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER=true
export ARTIFACTS_CREDENTIAL_PROVIDER_RID=osx-arm64
expectedCredentialProviderVersion: 'Microsoft.Net8.osx-arm64.NuGet.CredentialProvider'
- job: LinuxInstallNet8osx-x64
pool:
vmImage: ubuntu-latest
steps:
- template: validate-install-script-bash.yml@self
parameters:
repo: self
scriptEnvVariables: |
export USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER=false
export USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER=true
export ARTIFACTS_CREDENTIAL_PROVIDER_RID=osx-x64
expectedCredentialProviderVersion: 'Microsoft.Net8.osx-x64.NuGet.CredentialProvider'

11 changes: 9 additions & 2 deletions helpers/installcredprovider.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ param(
# install the .NET 6 cred provider instead of NetCore3.1
[switch]$InstallNet6 = $true,
# install the .NET 8 cred provider instead of NetCore3.1
[switch]$InstallNet8
[switch]$InstallNet8,
# install the self-contained cred provider for the specified RuntimeIdentifier .
[string]$RuntimeIdentifier
)

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

$releaseRidPart = ""
if (![string]::IsNullOrEmpty($RuntimeIdentifier )) {
$releaseRIdPart = $RuntimeIdentifier + "."
}

$zipFile = "Microsoft.NetCore3.NuGet.CredentialProvider.zip"
if ($Version.StartsWith("0.")) {
# versions lower than 1.0.0 installed NetCore2 zip
Expand All @@ -112,7 +119,7 @@ if ($InstallNet6 -eq $True) {
$zipFile = "Microsoft.Net6.NuGet.CredentialProvider.zip"
}
if ($InstallNet8 -eq $True) {
$zipFile = "Microsoft.Net8.NuGet.CredentialProvider.zip"
$zipFile = "Microsoft.Net8.${releaseRidPart}NuGet.CredentialProvider.zip"
}
if ($AddNetfx -eq $True) {
$zipFile = "Microsoft.NuGet.CredentialProvider.zip"
Expand Down
11 changes: 9 additions & 2 deletions helpers/installcredprovider.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ if [ -z ${USE_NET6_ARTIFACTS_CREDENTIAL_PROVIDER} ] || [ ${USE_NET6_ARTIFACTS_CR
esac
# Don't attempt to install .NET 8 without a set variable.
elif [ ! -z ${USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER} ] && [ ${USE_NET8_ARTIFACTS_CREDENTIAL_PROVIDER} != "false" ]; then
FILE="Microsoft.Net8.NuGet.CredentialProvider.tar.gz"
# Self-contained versions are available in latest versions of the .NET 8 credprovider.
# To install a release with a specific runtime version set the `ARTIFACTS_CREDENTIAL_PROVIDER_RID` enviornment variable.
# Otherwise default to the full zip file.
RID=""
if [ ! -z ${ARTIFACTS_CREDENTIAL_PROVIDER_RID} ]; then
RID=".${ARTIFACTS_CREDENTIAL_PROVIDER_RID}"
fi
FILE="Microsoft.Net8$RID.NuGet.CredentialProvider.tar.gz"

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

echo "INFO: credential provider netcore plugin extracted to $HOME/.nuget/"
echo "INFO: credential provider netcore plugin extracted to $HOME/.nuget/"