Skip to content
34 changes: 17 additions & 17 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -3090,7 +3090,12 @@ function New-DotnetSdkContainerFxdPackage {
[CmdletBinding(SupportsShouldProcess = $true)]
param(
[Parameter(Mandatory)] $FxdPackagePath,
[Parameter(Mandatory)] $ReleaseTag

[ValidatePattern("^v\d+\.\d+\.\d+(-\w+(\.\d+)?)?$")]
[ValidateNotNullOrEmpty()]
[Parameter(Mandatory)] $ReleaseTag,
Comment thread
adityapatwardhan marked this conversation as resolved.

[Parameter(Mandatory)] $DestinationPath
)

$Version = $ReleaseTag -Replace '^v'
Expand All @@ -3109,9 +3114,10 @@ function New-DotnetSdkContainerFxdPackage {
Write-Log "fxdPackagePath: $FxdPackagePath"

$packageName = "powershell-$Version-$packageNamePlatform-fxd-dotnetsdk$packageNameExtension"
$destinationPackageFullName = Join-Path $DestinationPath $packageName

## Get fxdependent package path
$fxdPackage = (Get-ChildItem $FxdPackagePath -Recurse -Filter $basePackagePattern).FullName
$fxdPackage = Get-ChildItem $FxdPackagePath -Recurse -Filter $basePackagePattern.FullName | Select-Object -First 1 -ExpandProperty FullName

Write-Log "Fxd Package Path: $fxdPackage"

Expand Down Expand Up @@ -3152,10 +3158,14 @@ function New-DotnetSdkContainerFxdPackage {

Write-Verbose -Verbose "Compressing"

if (-not (Test-Path $DestinationPath)) {
$null = New-Item -ItemType Directory -Path $DestinationPath
}

if ($Environment.IsWindows) {
Compress-Archive -Path "$FxdPackagePath/fxdreduced/*" -Destination $FxdPackagePath/$packageName
Compress-Archive -Path "$FxdPackagePath/fxdreduced/*" -Destination $destinationPackageFullName -Force
} else {
Start-NativeExecution { tar -czf "$FxdPackagePath/$packageName" . }
Start-NativeExecution { tar -czf "$destinationPackageFullName" . }
}

Write-Log "Compressing complete"
Expand All @@ -3166,19 +3176,9 @@ function New-DotnetSdkContainerFxdPackage {
}
}

if (Test-Path "$FxdPackagePath/$packageName") {
$containerName = if ($Environment.IsWindows)
{
"signedResults"
}
else
{
"release"
}

Write-Host "##vso[artifact.upload containerfolder=$containerName;artifactname=$containerName]$FxdPackagePath/$packageName"

if (Test-Path $destinationPackageFullName) {
Write-Host "##vso[artifact.upload containerfolder=release;artifactname=release]$destinationPackageFullName"
} else {
Write-Log "Package not found: $FxdPackagePath/$packageName"
Write-Log "Package not found: $destinationPackageFullName"
}
}
14 changes: 14 additions & 0 deletions tools/releaseBuild/azureDevOps/releaseBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ jobs:
parameters:
buildName: alpine

- template: templates/dotnetsdk-fxdependent.yml
parameters:
parentJobs:
- build_fxdependent
poolName: Hosted Ubuntu 1604
buildName: Linux

- template: templates/mac.yml

- template: templates/windows-build.yml
Expand All @@ -58,6 +65,13 @@ jobs:
parameters:
Architecture: fxdependent

- template: templates/dotnetsdk-fxdependent.yml
parameters:
parentJobs:
- WinPackageSigningJob
poolName: Package ES CodeHub Lab E
buildName: Windows

- template: templates/windows-component-governance.yml

- template: templates/windows-package-signing.yml
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
parameters:
parentJobs: []
poolName: Hosted Ubuntu 1604
buildName: Linux-x64

jobs:
- job: dotnetfxd_${{ parameters.buildName }}
displayName: Create fxdependent package dotnet sdk - ${{ parameters.buildName }}
dependsOn:
${{ parameters.parentJobs }}
condition: succeeded()
pool: ${{ parameters.poolName }}
steps:

- powershell: |
tools/releaseBuild/setReleaseTag.ps1 -ReleaseTag $(ReleaseTagVar) -Variable "ReleaseTagVar"
displayName: 'Run setReleaseTag.ps1'

- task: DownloadBuildArtifacts@0
displayName: 'Download Artifacts'
inputs:
downloadType: specific
itemPattern: |
**/*.tar.gz
**/*.zip
downloadPath: '$(System.ArtifactsDirectory)/finished'

- powershell: |
Import-Module $(Build.SourcesDirectory)/build.psm1 -Force
Import-Module $(Build.SourcesDirectory)/tools/packaging -Force
New-DotnetSdkContainerFxdPackage -FxdPackagePath "$(System.ArtifactsDirectory)/finished" -ReleaseTag $(ReleaseTagVar) -DestinationPath "$(System.ArtifactsDirectory)/finished/release"
displayName: 'Create fxdependent package for dotnet sdk docker image'

- powershell: |
$azureVersion = '$(ReleaseTagVar)'.ToLowerInvariant() -replace '\.', '-'
$vstsCommandString = "vso[task.setvariable variable=AzureVersion]$azureVersion-internal"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
displayName: 'Set Version for Blob Storage'

- job:
displayName: Upload fxdependent package dotnet sdk - ${{ parameters.buildName }}
dependsOn: dotnetfxd_${{ parameters.buildName }}
condition: succeeded()
pool: Package ES CodeHub Lab E
steps:

- powershell: |
tools/releaseBuild/setReleaseTag.ps1 -ReleaseTag $(ReleaseTagVar) -Variable "ReleaseTagVar"
displayName: 'Run setReleaseTag.ps1'

- powershell: |
$azureVersion = '$(ReleaseTagVar)'.ToLowerInvariant() -replace '\.', '-'
$vstsCommandString = "vso[task.setvariable variable=AzureVersion]$azureVersion-internal"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
displayName: 'Set Version for Blob Storage'

- task: DownloadBuildArtifacts@0
displayName: 'Download FxDependent dotnet sdx artifacts'
inputs:
downloadType: specific
itemPattern: |
**/*fxd-dotnetsdk.zip
**/*fxd-dotnetsdk.tar.gz
downloadPath: '$(System.ArtifactsDirectory)'
condition: succeeded()

- powershell: |
Get-ChildItem '$(System.ArtifactsDirectory)\release'
displayName: Capture list of downloaded artifacts

- task: AzureFileCopy@1
displayName: 'Upload to azure'
inputs:
SourcePath: '$(System.ArtifactsDirectory)\release'
azureSubscription: '$(AzureFileCopySubscription)'
Destination: AzureBlob
storage: '$(StorageAccount)'
ContainerName: '$(AzureVersion)'