Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .pipelines/PowerShell-Packages-Official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ parameters: # parameters are shown up in ADO UI in a build queue time
- name: OfficialBuild
type: boolean
default: false
- name: disableNetworkIsolation
type: boolean
default: false

name: pkgs-$(BUILD.SOURCEBRANCHNAME)-prod.${{ parameters.OfficialBuild }}-$(Build.BuildId)

Expand Down Expand Up @@ -66,6 +69,8 @@ variables:
- group: MSIXSigningProfile
- name: templateFile
value: ${{ iif ( parameters.OfficialBuild, 'v2/OneBranch.Official.CrossPlat.yml@onebranchTemplates', 'v2/OneBranch.NonOfficial.CrossPlat.yml@onebranchTemplates' ) }}
- name: disableNetworkIsolation
value: ${{ parameters.disableNetworkIsolation }}

resources:
pipelines:
Expand Down Expand Up @@ -96,6 +101,7 @@ extends:
Network: KS3
linuxEsrpSigning: true
incrementalSDLBinaryAnalysis: true
disableNetworkIsolation: ${{ variables.disableNetworkIsolation }}
globalSdl:
disableLegacyManifest: true
# disabled Armorty as we dont have any ARM templates to scan. It fails on some sample ARM templates.
Expand Down
19 changes: 19 additions & 0 deletions .pipelines/templates/install-dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
steps:
- pwsh: |
if (-not (Test-Path '$(RepoRoot)')) {
$psRoot = '$(Build.SourcesDirectory)/PowerShell'
Set-Location $psRoot -Verbose
}
$version = Get-Content ./global.json | ConvertFrom-Json | Select-Object -ExpandProperty sdk | Select-Object -ExpandProperty version
Write-Verbose -Verbose "Installing .NET SDK with version $version"
Import-Module ./build.psm1 -Force
Install-Dotnet -Version $version -Verbose
displayName: 'Install dotnet SDK'
workingDirectory: $(RepoRoot)
env:
ob_restore_phase: true
4 changes: 3 additions & 1 deletion .pipelines/templates/linux-package-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ jobs:
env:
ob_restore_phase: true # This ensures this done in restore phase to workaround signing issue

- template: /.pipelines/templates/install-dotnet.yml@self

- pwsh: |
$packageType = '$(PackageType)'
Write-Verbose -Verbose "packageType = $packageType"
Expand All @@ -103,7 +105,7 @@ jobs:
Import-Module "$repoRoot/build.psm1"
Import-Module "$repoRoot/tools/packaging"

Start-PSBootstrap -Scenario Package
Start-PSBootstrap -Scenario Both

$psOptionsPath = "$(Pipeline.Workspace)/CoOrdinatedBuildPipeline/${unsignedDrop}/psoptions/psoptions.json"

Expand Down
7 changes: 1 addition & 6 deletions .pipelines/templates/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,7 @@ jobs:
AnalyzeInPipeline: false
Language: csharp

- task: UseDotNet@2
inputs:
useGlobalJson: true
workingDirectory: $(PowerShellRoot)
env:
ob_restore_phase: true
- template: /.pipelines/templates/install-dotnet.yml@self

- pwsh: |
$runtime = $env:RUNTIME
Expand Down
8 changes: 2 additions & 6 deletions .pipelines/templates/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ jobs:
sudo chown $env:USER "$(Agent.TempDirectory)/PowerShell"
displayName: 'Create $(Agent.TempDirectory)/PowerShell'
- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: $(PowerShellRoot)
## We cross compile for arm64, so the arch is always x64
- template: /.pipelines/templates/install-dotnet.yml@self

- pwsh: |
Import-Module $(PowerShellRoot)/build.psm1 -Force
Expand Down
10 changes: 1 addition & 9 deletions .pipelines/templates/nupkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,7 @@ jobs:
parameters:
repoRoot: $(PowerShellRoot)

- task: NuGetToolInstaller@1
displayName: 'Install NuGet.exe'

- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: '$(PowerShellRoot)'
- template: /.pipelines/templates/install-dotnet.yml@self

- pwsh: |
Set-Location -Path '$(PowerShellRoot)'
Expand Down
7 changes: 1 addition & 6 deletions .pipelines/templates/release-validate-fxdpackages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@ jobs:
Get-ChildItem "$(Pipeline.Workspace)/PSPackagesOfficial/$artifactName" -Recurse
displayName: 'Capture Downloaded Artifacts'

- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: $(Build.SourcesDirectory)/PowerShell"
- template: /.pipelines/templates/install-dotnet.yml@self

- pwsh: |
$artifactName = '$(artifactName)'
Expand Down
7 changes: 1 addition & 6 deletions .pipelines/templates/release-validate-globaltools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,7 @@ jobs:
Get-ChildItem "$(Pipeline.Workspace)/PSPackagesOfficial/drop_nupkg_build_nupkg" -Recurse
displayName: 'Capture Downloaded Artifacts'

- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: $(REPOROOT)
- template: /.pipelines/templates/install-dotnet.yml@self

- pwsh: |
$repoRoot = "$(Build.SourcesDirectory)/PowerShell"
Expand Down
7 changes: 1 addition & 6 deletions .pipelines/templates/release-validate-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ jobs:
Get-ChildItem "$(Pipeline.Workspace)/PSPackagesOfficial/drop_nupkg_build_nupkg" -Recurse
displayName: 'Capture Downloaded Artifacts'

- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: $(REPOROOT)
- template: /.pipelines/templates/install-dotnet.yml@self

- pwsh: |
$repoRoot = "$(Build.SourcesDirectory)"
Expand Down
28 changes: 11 additions & 17 deletions .pipelines/templates/testartifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,16 @@ jobs:
env:
ob_restore_phase: true

- template: /.pipelines/templates/SetVersionVariables.yml@self
parameters:
ReleaseTagVar: $(ReleaseTagVar)

- template: /.pipelines/templates/insert-nuget-config-azfeed.yml@self
parameters:
repoRoot: $(Build.SourcesDirectory)/PowerShell
repoRoot: $(RepoRoot)
ob_restore_phase: true

- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: $(Build.SourcesDirectory)/PowerShell"
env:
ob_restore_phase: true
- template: /.pipelines/templates/install-dotnet.yml@self

- pwsh: |
New-Item -Path '$(ob_outputDirectory)' -ItemType Directory -Force
Expand Down Expand Up @@ -93,19 +90,16 @@ jobs:
env:
ob_restore_phase: true

- template: /.pipelines/templates/SetVersionVariables.yml@self
parameters:
ReleaseTagVar: $(ReleaseTagVar)

- template: /.pipelines/templates/insert-nuget-config-azfeed.yml@self
parameters:
repoRoot: $(Build.SourcesDirectory)/PowerShell
ob_restore_phase: true

- task: UseDotNet@2
displayName: 'Use .NET Core sdk'
inputs:
useGlobalJson: true
packageType: 'sdk'
workingDirectory: $(Build.SourcesDirectory)/PowerShell"
env:
ob_restore_phase: true
- template: /.pipelines/templates/install-dotnet.yml@self

- pwsh: |
New-Item -Path '$(ob_outputDirectory)' -ItemType Directory -Force
Expand Down
11 changes: 5 additions & 6 deletions .pipelines/templates/windows-hosted-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,7 @@ jobs:
AnalyzeInPipeline: false
Language: csharp

- task: UseDotNet@2
inputs:
useGlobalJson: true
workingDirectory: $(PowerShellRoot)
env:
ob_restore_phase: true
- template: /.pipelines/templates/install-dotnet.yml@self

- pwsh: |
$runtime = switch ($env:Architecture)
Expand Down Expand Up @@ -144,6 +139,7 @@ jobs:
}

Import-Module -Name $(PowerShellRoot)/build.psm1 -Force
Find-Dotnet

## Build global tool
Write-Verbose -Message "Building PowerShell global tool for Windows.x64" -Verbose
Expand Down Expand Up @@ -239,6 +235,9 @@ jobs:
After that, we repack using Compress-Archive and rename it back to a nupkg.
#>

Import-Module -Name $(PowerShellRoot)/build.psm1 -Force
Find-Dotnet

$packagingStrings = Import-PowerShellDataFile "$(PowerShellRoot)\tools\packaging\packaging.strings.psd1"

$outputPath = Join-Path '$(ob_outputDirectory)' 'globaltool'
Expand Down
11 changes: 4 additions & 7 deletions .pipelines/templates/windows-package-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,7 @@ jobs:
env:
ob_restore_phase: true # This ensures this done in restore phase to workaround signing issue

- task: UseDotNet@2
inputs:
useGlobalJson: true
workingDirectory: $(REPOROOT)
env:
ob_restore_phase: true
- template: /.pipelines/templates/install-dotnet.yml@self

- pwsh: |
$msixUrl = '$(makeappUrl)'
Expand Down Expand Up @@ -112,7 +107,9 @@ jobs:
Import-Module "$repoRoot\build.psm1"
Import-Module "$repoRoot\tools\packaging"

Start-PSBootstrap -Scenario Package
Start-PSBootstrap -Scenario Both

Find-Dotnet

$signedFilesPath, $psoptionsFilePath = if ($env:RUNTIME -eq 'minsize') {
"$(Pipeline.Workspace)\CoOrdinatedBuildPipeline\drop_windows_build_windows_x64_${runtime}\$signedFolder"
Expand Down
5 changes: 2 additions & 3 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2092,8 +2092,8 @@ function Install-Dotnet {
# Note that when it is null, Invoke-Expression (but not &) must be used to interpolate properly
$sudo = if (!$NoSudo) { "sudo" }

# $installObtainUrl = "https://dot.net/v1"
$installObtainUrl = "https://dotnet.microsoft.com/download/dotnet/scripts/v1"
$installObtainUrl = "https://builds.dotnet.microsoft.com/dotnet/scripts/v1"
#$installObtainUrl = "https://dotnet.microsoft.com/download/dotnet/scripts/v1"
$uninstallObtainUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain"

# Install for Linux and OS X
Expand Down Expand Up @@ -2184,7 +2184,6 @@ function Install-Dotnet {
$installArgs += @{ SkipNonVersionedFiles = $true }

$installArgs | Out-String | Write-Verbose -Verbose

& ./$installScript @installArgs
}
else {
Expand Down