Skip to content

Commit

Permalink
Setup internal feeds in internal builds (#90637)
Browse files Browse the repository at this point in the history
* Setup internal feeds in internal builds

* Add 8 explicitly for now

* Fix condition on mono-wasm workloads
  • Loading branch information
hoyosjs committed Sep 13, 2023
1 parent 35b6357 commit 7f8da57
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 7 deletions.
8 changes: 4 additions & 4 deletions eng/common/SetupNugetSources.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file should be removed as part of this issue: https://github.com/dotnet/arcade/issues/4080
#
# What the script does is iterate over all package sources in the pointed NuGet.config and add a credential entry
# under <packageSourceCredentials> for each Maestro managed private feed. Two additional credential
# under <packageSourceCredentials> for each Maestro managed private feed. Two additional credential
# entries are also added for the two private static internal feeds: dotnet3-internal and dotnet3-internal-transport.
#
# This script needs to be called in every job that will restore packages and which the base repo has
Expand Down Expand Up @@ -37,7 +37,7 @@ Set-StrictMode -Version 2.0
# Add source entry to PackageSources
function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Username, $Password) {
$packageSource = $sources.SelectSingleNode("add[@key='$SourceName']")

if ($packageSource -eq $null)
{
$packageSource = $doc.CreateElement("add")
Expand All @@ -48,7 +48,7 @@ function AddPackageSource($sources, $SourceName, $SourceEndPoint, $creds, $Usern
else {
Write-Host "Package source $SourceName already present."
}

AddCredential -Creds $creds -Source $SourceName -Username $Username -Password $Password
}

Expand Down Expand Up @@ -89,7 +89,7 @@ function InsertMaestroPrivateFeedCredentials($Sources, $Creds, $Username, $Passw
$maestroPrivateSources = $Sources.SelectNodes("add[contains(@key,'darc-int')]")

Write-Host "Inserting credentials for $($maestroPrivateSources.Count) Maestro's private feeds."

ForEach ($PackageSource in $maestroPrivateSources) {
Write-Host "`tInserting credential for Maestro's feed:" $PackageSource.Key
AddCredential -Creds $creds -Source $PackageSource.Key -Username $Username -Password $Password
Expand Down
6 changes: 3 additions & 3 deletions eng/common/SetupNugetSources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be removed as part of this issue: https://github.com/dotnet/arcade/issues/4080
#
# What the script does is iterate over all package sources in the pointed NuGet.config and add a credential entry
# under <packageSourceCredentials> for each Maestro's managed private feed. Two additional credential
# under <packageSourceCredentials> for each Maestro's managed private feed. Two additional credential
# entries are also added for the two private static internal feeds: dotnet3-internal and dotnet3-internal-transport.
#
# This script needs to be called in every job that will restore packages and which the base repo has
Expand Down Expand Up @@ -68,7 +68,7 @@ if [ "$?" != "0" ]; then
sed -i.bak "s|$ConfigNodeHeader|$ConfigNodeHeader${NL}$PackageSourcesTemplate|" $ConfigFile
fi

# Ensure there is a <packageSourceCredentials>...</packageSourceCredentials> section.
# Ensure there is a <packageSourceCredentials>...</packageSourceCredentials> section.
grep -i "<packageSourceCredentials>" $ConfigFile
if [ "$?" != "0" ]; then
echo "Adding <packageSourceCredentials>...</packageSourceCredentials> section."
Expand Down Expand Up @@ -142,7 +142,7 @@ IFS=$PrevIFS

for FeedName in ${PackageSources[@]} ; do
# Check if there is no existing credential for this FeedName
grep -i "<$FeedName>" $ConfigFile
grep -i "<$FeedName>" $ConfigFile
if [ "$?" != "0" ]; then
echo "Adding credentials for $FeedName."

Expand Down
19 changes: 19 additions & 0 deletions eng/pipelines/common/global-build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
variables:
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- group: DotNet-HelixApi-Access
- group: AzureDevOps-Artifact-Feeds-Pats

- name: _osParameter
value: -os ${{ parameters.osGroup }}
Expand Down Expand Up @@ -182,6 +183,24 @@ jobs:
- ${{ if and(eq(parameters.isOfficialBuild, true), notin(parameters.osGroup, 'osx', 'maccatalyst', 'ios', 'iossimulator', 'tvos', 'tvossimulator')) }}:
- template: /eng/pipelines/common/restore-internal-tools.yml

- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- ${{ if and(ne(parameters.osGroup, 'windows'), ne(parameters.hostedOs, 'windows')) }}:
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- ${{ else }}:
- task: PowerShell@2
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)

- ${{ each monoCrossAOTTargetOS in parameters.monoCrossAOTTargetOS }}:
- task: DownloadPipelineArtifact@2
displayName: Download ${{monoCrossAOTTargetOS}} AOT offset files
Expand Down
18 changes: 18 additions & 0 deletions eng/pipelines/coreclr/templates/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,24 @@ jobs:
continueOnError: false
condition: and(succeeded(), in(variables['SignType'], 'real', 'test'))

- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- ${{ if ne(parameters.osGroup, 'windows') }}:
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- ${{ if eq(parameters.osGroup, 'windows') }}:
- task: PowerShell@2
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)

- ${{ if in(parameters.osGroup, 'osx', 'ios', 'tvos') }}:
- script: |
du -sh $(Build.SourcesDirectory)/*
Expand Down
19 changes: 19 additions & 0 deletions eng/pipelines/libraries/base-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
variables:
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- group: DotNet-HelixApi-Access
- group: AzureDevOps-Artifact-Feeds-Pats

- _buildScriptFileName: build

Expand Down Expand Up @@ -137,4 +138,22 @@ jobs:
artifactName: '$(_runtimeArtifactName)'
displayName: '$(runtimeFlavorName) build drop'

- ${{ if ne(variables['System.TeamProject'], 'public') }}:
- ${{ if ne(parameters.osGroup, 'windows') }}:
- task: Bash@3
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh
arguments: $(Build.SourcesDirectory)/NuGet.config $Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)
- ${{ if eq(parameters.osGroup, 'windows') }}:
- task: PowerShell@2
displayName: Setup Private Feeds Credentials
inputs:
filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.ps1
arguments: -ConfigFile $(Build.SourcesDirectory)/NuGet.config -Password $Env:Token
env:
Token: $(dn-bot-dnceng-artifact-feeds-rw)

- ${{ parameters.steps }}

0 comments on commit 7f8da57

Please sign in to comment.