forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add internal build support (dotnet/core-setup#8279)
Add NuGetAuthenticate task. Create proxy build scripts that include pre-build auth plugin install. Add workaround to avoid running test restore against authenticated feed. Pass the NuGet auth env vars set by the AzDO build step into the Docker container. Add configurability for internal publish. Commit migrated from dotnet/core-setup@a896b3e
- Loading branch information
Showing
12 changed files
with
238 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# Installs the NuGet Credential Provider, then calls ../build.sh with all arguments. This creates a | ||
# build context that can restore from authenticated sources. This script is intended for use by the | ||
# official Microsoft build inside a Docker container. | ||
|
||
source="${BASH_SOURCE[0]}" | ||
|
||
# resolve $SOURCE until the file is no longer a symlink | ||
while [[ -h $source ]]; do | ||
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" | ||
source="$(readlink "$source")" | ||
|
||
# if $source was a relative symlink, we need to resolve it relative to the path where the | ||
# symlink file was located | ||
[[ $source != /* ]] && source="$scriptroot/$source" | ||
done | ||
|
||
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" | ||
|
||
. "$scriptroot/install-nuget-credprovider.sh" | ||
|
||
"$scriptroot/../build.sh" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# Installs the NuGet Credential Provider, then calls common/msbuild.sh with all arguments. This | ||
# creates a build context that can restore from authenticated sources. This script is intended for | ||
# use by the official Microsoft build inside a Docker container. | ||
|
||
source="${BASH_SOURCE[0]}" | ||
|
||
# resolve $SOURCE until the file is no longer a symlink | ||
while [[ -h $source ]]; do | ||
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" | ||
source="$(readlink "$source")" | ||
|
||
# if $source was a relative symlink, we need to resolve it relative to the path where the | ||
# symlink file was located | ||
[[ $source != /* ]] && source="$scriptroot/$source" | ||
done | ||
|
||
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" | ||
|
||
. "$scriptroot/install-nuget-credprovider.sh" | ||
|
||
"$scriptroot/common/msbuild.sh" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# This script installs the NuGet Credential Provider. | ||
|
||
# Install curl if necessary. Dependency exists inside downloaded script. | ||
if command -v curl > /dev/null; then | ||
echo "curl found." | ||
else | ||
echo "curl not found, trying to install..." | ||
( | ||
set +e | ||
set -x | ||
apt update && apt install -y curl | ||
apk update && apk upgrade && apk add curl | ||
exit 0 | ||
) | ||
fi | ||
|
||
# Install. Ported from https://gist.github.com/shubham90/ad85f2546a72caa20d57bce03ec3890f | ||
install_credprovider() { | ||
# Download the provider and install. | ||
cred_provider_url='https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh' | ||
curl "$cred_provider_url" -s -S -L | bash | ||
|
||
# Environment variable to enable session token cache. More on this here: https://github.com/Microsoft/artifacts-credprovider#help | ||
export NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED=true | ||
} | ||
|
||
install_credprovider | ||
|
||
# Additional setup to try to avoid flakiness: https://github.com/dotnet/arcade/issues/3932 | ||
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0 | ||
export NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS=20 | ||
export NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS=20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,23 +25,76 @@ jobs: | |
# Only get the secret variable groups if the def has the official name. Reduce dev build def risk. | ||
- ${{ if eq(variables['Build.DefinitionName'], 'dotnet-core-setup') }}: | ||
# Used for publishing individual leg assets to azure blob storage | ||
- group: DotNet-DotNetCli-Storage | ||
- ${{ if eq(parameters.dependency.channel.public, 'true') }}: | ||
- group: DotNet-DotNetCli-Storage | ||
- ${{ if ne(parameters.dependency.channel.public, 'true') }}: | ||
- group: DotNet-MSRC-Storage | ||
# Used for dotnet/versions update | ||
- group: DotNet-Versions-Publish | ||
|
||
# Blob storage publish (installers and checksums) | ||
- name: _DefaultContainerName | ||
value: dotnet | ||
- name: _DefaultChecksumsContainerName | ||
value: dotnet | ||
|
||
- ${{ if eq(parameters.dependency.channel.public, 'true') }}: | ||
- name: _DefaultAzureAccountName | ||
value: dotnetcli | ||
- name: _DefaultAzureAccessToken | ||
value: $(dotnetcli-storage-key) | ||
- name: _DefaultChecksumAzureAccountName | ||
value: dotnetclichecksums | ||
- name: _DefaultChecksumAzureAccessToken | ||
value: $(dotnetclichecksums-storage-key) | ||
# dotnet/versions update | ||
- name: _GitHubUser | ||
value: $[ coalesce(variables.GitHubUser, 'dotnet-build-bot') ] | ||
- name: _GitHubEmail | ||
value: $[ coalesce(variables.GitHubEmail, '[email protected]') ] | ||
- name: _GitHubAuthToken | ||
value: $[ coalesce(variables.GitHubAuthToken, '$(AccessToken-dotnet-build-bot-public-repo)') ] | ||
- name: _VersionsRepoOwner | ||
value: $[ coalesce(variables.VersionsRepoOwner, 'dotnet') ] | ||
- name: _VersionsRepo | ||
value: $[ coalesce(variables.VersionsRepo, 'versions') ] | ||
- name: _DotNetVersionsArgs | ||
value: >- | ||
/p:GitHubUser=$(_GitHubUser) | ||
/p:GitHubEmail=$(_GitHubEmail) | ||
/p:GitHubAuthToken=$(_GitHubAuthToken) | ||
/p:VersionsRepoOwner=$(_VersionsRepoOwner) | ||
/p:VersionsRepo=$(_VersionsRepo) | ||
/p:VersionsRepoPath=build-info/dotnet/core-setup/$(FullBranchName) | ||
- ${{ if ne(parameters.dependency.channel.public, 'true') }}: | ||
- name: _DefaultAzureAccountName | ||
value: dotnetclimsrc | ||
- name: _DefaultAzureAccessToken | ||
value: $(dotnetclimsrc-access-key) | ||
- name: _DefaultChecksumAzureAccountName | ||
value: dotnetclimsrc | ||
- name: _DefaultChecksumsContainerName | ||
value: dotnet-checksums | ||
- name: _DefaultChecksumAzureAccessToken | ||
value: $(dotnetclimsrc-access-key) | ||
# dotnet/versions update (disabled) | ||
- name: _DotNetVersionsArgs | ||
value: '' | ||
|
||
# Blob storage publish (installers and checksums) | ||
- name: _AzureAccountName | ||
value: $[ coalesce(variables.AzureAccountName, 'dotnetcli') ] | ||
value: $[ coalesce(variables.AzureAccountName, '$(_DefaultAzureAccountName)') ] | ||
- name: _ContainerName | ||
value: $[ coalesce(variables.ContainerName, 'dotnet') ] | ||
value: $[ coalesce(variables.ContainerName, '$(_DefaultContainerName)') ] | ||
- name: _AzureAccessToken | ||
value: $[ coalesce(variables.AzureAccessToken, '$(dotnetcli-storage-key)') ] | ||
value: $[ coalesce(variables.AzureAccessToken, '$(_DefaultAzureAccessToken)') ] | ||
- name: _ChecksumAzureAccountName | ||
value: $[ coalesce(variables.ChecksumAzureAccountName, 'dotnetclichecksums') ] | ||
value: $[ coalesce(variables.ChecksumAzureAccountName, '$(_DefaultChecksumAzureAccountName)') ] | ||
- name: _ChecksumContainerName | ||
value: $[ coalesce(variables.ChecksumContainerName, 'dotnet') ] | ||
value: $[ coalesce(variables.ChecksumContainerName, '$(_DefaultChecksumsContainerName)') ] | ||
- name: _ChecksumAzureAccessToken | ||
value: $[ coalesce(variables.ChecksumAzureAccessToken, '$(dotnetclichecksums-storage-key)') ] | ||
value: $[ coalesce(variables.ChecksumAzureAccessToken, '$(_DefaultChecksumAzureAccessToken)') ] | ||
|
||
- name: _CommonPublishArgs | ||
value: >- | ||
/p:AzureAccountName=$(_AzureAccountName) | ||
|
@@ -51,28 +104,11 @@ jobs: | |
/p:ChecksumContainerName=$(_ChecksumContainerName) | ||
/p:ChecksumAzureAccessToken=$(_ChecksumAzureAccessToken) | ||
# dotnet/versions update | ||
- name: _GitHubUser | ||
value: $[ coalesce(variables.GitHubUser, 'dotnet-build-bot') ] | ||
- name: _GitHubEmail | ||
value: $[ coalesce(variables.GitHubEmail, '[email protected]') ] | ||
- name: _GitHubAuthToken | ||
value: $[ coalesce(variables.GitHubAuthToken, '$(AccessToken-dotnet-build-bot-public-repo)') ] | ||
- name: _VersionsRepoOwner | ||
value: $[ coalesce(variables.VersionsRepoOwner, 'dotnet') ] | ||
- name: _VersionsRepo | ||
value: $[ coalesce(variables.VersionsRepo, 'versions') ] | ||
- name: _DotNetVersionsArgs | ||
value: >- | ||
/p:GitHubUser=$(_GitHubUser) | ||
/p:GitHubEmail=$(_GitHubEmail) | ||
/p:GitHubAuthToken=$(_GitHubAuthToken) | ||
/p:VersionsRepoOwner=$(_VersionsRepoOwner) | ||
/p:VersionsRepo=$(_VersionsRepo) | ||
/p:VersionsRepoPath=build-info/dotnet/core-setup/$(FullBranchName) | ||
steps: | ||
|
||
- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: | ||
- task: NuGetAuthenticate@0 | ||
|
||
- task: DownloadBuildArtifacts@0 | ||
displayName: Download Artifacts | ||
inputs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.