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
18 changes: 17 additions & 1 deletion .pipelines/DSC-Official-PMC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ variables:
value: 'onebranch.azurecr.io/linux/ubuntu-2204:latest'
- name: RepoRoot
value: '$(Build.SourcesDirectory)/DSC'
- group: DSC-packages.microsoft.com
- name: SigningProfile
value: $(pgp_linux_cert_id)

resources:
repositories:
Expand Down Expand Up @@ -114,6 +117,13 @@ extends:
Copy-Item ./bin/*.deb "$(ob_outputDirectory)"
displayName: 'Build x86_64-unknown-linux-musl'
condition: succeeded()
- task: onebranch.pipeline.signing@1
displayName: Sign deb and rpm packages
inputs:
command: 'sign'
signing_profile: '$(SigningProfile)'
files_to_sign: '**/*.rpm;**/*.deb'
search_root: '$(ob_outputDirectory)'

- job: BuildLinuxArm64Musl
dependsOn: SetPackageVersion
Expand Down Expand Up @@ -165,6 +175,13 @@ extends:
Copy-Item ./bin/*.deb "$(ob_outputDirectory)"
displayName: 'Build aarch64-unknown-linux-musl'
condition: succeeded()
- task: onebranch.pipeline.signing@1
displayName: Sign deb and rpm packages
inputs:
command: 'sign'
signing_profile: '$(SigningProfile)'
files_to_sign: '**/*.rpm;**/*.deb'
search_root: '$(ob_outputDirectory)'

- stage: PrepPackagesForEv2PMC
displayName: Publish Linux Packages to packages.microsoft.com
Expand Down Expand Up @@ -195,7 +212,6 @@ extends:
value: $(RepoRoot)/.config/suppress.json
- name: ob_sdl_tsa_configFile
value: $(RepoRoot)/.config/tsaoptions.json
- group: 'DSC-packages.microsoft.com'
steps:
- checkout: self
lfs: false
Expand Down
40 changes: 31 additions & 9 deletions .pipelines/EV2Specs/ServiceGroupRoot/Shell/Run/Run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#>

$env:NO_COLOR = 1
$env:TERM = 'dumb'
$PSStyle.OutputRendering = 'PlainText'

function Get-MappedRepositoryIds {
param(
Expand Down Expand Up @@ -102,12 +104,14 @@ function Get-PackageObjects {
$pkgRepo = $pkg.RepoId | Select-Object -First 1
$pkgDistribution = $pkg.Distribution | Select-Object -First 1

$pkgName = $pkg.PackageFormat.Replace('PACKAGE_NAME', $PackageName).Replace('RELEASE_VERSION', $ReleaseVersion)

if ($pkgName.EndsWith('.rpm')) {
$pkgName = $pkgName.Replace($ReleaseVersion, $ReleaseVersion.Replace('-', '_'))
$pkgReleaseVersion = $ReleaseVersion
if ($pkg.PackageFormat.EndsWith('.rpm')) {
# RPM requires no dashes in the version string, so replace any dashes with tildes
$pkgReleaseVersion = $pkgReleaseVersion.Replace('-', '~')
}

$pkgName = $pkg.PackageFormat.Replace('PACKAGE_NAME', $PackageName).Replace('RELEASE_VERSION', $pkgReleaseVersion)

$packagePath = "$script:dscPackagesFolder/$pkgName"
if (-not (Test-Path -Path $packagePath)) {
throw "Package path $packagePath does not exist"
Expand Down Expand Up @@ -149,6 +153,9 @@ function Publish-PackageToPMC {
$packageType = $extension -replace '^\.'

$packageListJson = pmc --config $ConfigPath package $packageType list --file $packagePath
if ($LASTEXITCODE -ne 0) {
throw "pmc package $packageType list failed with exit code $LASTEXITCODE; --config '$ConfigPath' package $packageType list --file '$packagePath'"
}
$list = $packageListJson | ConvertFrom-Json

$packageId = @()
Expand All @@ -160,8 +167,11 @@ function Publish-PackageToPMC {
$uploadResult = $null
try {
$uploadResult = pmc --config $ConfigPath package upload $packagePath --type $packageType
if ($LASTEXITCODE -ne 0) {
throw "pmc package upload failed with exit code $LASTEXITCODE; --config '$ConfigPath' package upload '$packagePath' --type '$packageType'"
}
} catch {
$errorMessages.Add("Uploading package $($finalPackage.PackageName) to $pkgRepo failed. See errors above for details.")
$errorMessages.Add("Uploading package $($finalPackage.PackageName) to $pkgRepo failed: $($_.Exception.Message)")
continue
}

Expand All @@ -178,13 +188,19 @@ function Publish-PackageToPMC {
try {
if ($packageType -eq 'rpm') {
$rawUpdateResponse = pmc --config $ConfigPath repo package update $pkgRepo --add-packages $packageId
if ($LASTEXITCODE -ne 0) {
throw "pmc repo package update failed with exit code $LASTEXITCODE; --config '$ConfigPath' repo package update '$pkgRepo' --add-packages '$packageId'"
}
} elseif ($packageType -eq 'deb') {
$rawUpdateResponse = pmc --config $ConfigPath repo package update $pkgRepo $distribution --add-packages $packageId
if ($LASTEXITCODE -ne 0) {
throw "pmc repo package update failed with exit code $LASTEXITCODE; --config '$ConfigPath' repo package update '$pkgRepo' '$distribution' --add-packages '$packageId'"
}
} else {
throw "Unsupported package type: $packageType"
}
} catch {
$errorMessages.Add("Update for package $($finalPackage.PackageName) to $pkgRepo failed. See errors above for details.")
$errorMessages.Add("Update for package $($finalPackage.PackageName) to $pkgRepo failed: $($_.Exception.Message)")
continue
}

Expand All @@ -198,8 +214,11 @@ function Publish-PackageToPMC {
$rawPublishResponse = $null
try {
$rawPublishResponse = pmc --config $ConfigPath repo publish $pkgRepo
if ($LASTEXITCODE -ne 0) {
throw "pmc repo publish failed with exit code $LASTEXITCODE; --config '$ConfigPath' repo publish '$pkgRepo'"
}
} catch {
$errorMessages.Add("Final publish for package $($finalPackage.PackageName) to $pkgRepo failed. See errors above for details.")
$errorMessages.Add("Final publish for package $($finalPackage.PackageName) to $pkgRepo failed: $($_.Exception.Message)")
continue
}

Expand Down Expand Up @@ -277,13 +296,16 @@ try {
$skipPublish = $metadataContent.SkipPublish

$channel = if ($releaseVersion.Contains('-')) { 'preview' } else { 'stable' }
$packageName = $channel -eq 'preview' ? 'dsc-preview' : 'dsc'
$packageName = 'dsc'

Write-Verbose "Release version: $releaseVersion, Channel: $channel" -Verbose

# Get PMC repository list
Write-Verbose "Getting PMC repository list" -Verbose
$rawResponse = pmc --config $configPath repo list --limit 800
if ($LASTEXITCODE -ne 0) {
throw "pmc repo list failed with exit code $LASTEXITCODE; --config '$configPath' repo list --limit 800"
}
$response = $rawResponse | ConvertFrom-Json
Write-Verbose "PMC repo list: limit=$($response.limit), count=$($response.count)" -Verbose
$repoList = $response.results
Expand All @@ -297,7 +319,7 @@ try {
Write-Verbose "SkipPublish: $skipPublish" -Verbose
Publish-PackageToPMC -PackageObject $packageObjects -ConfigPath $configPath -SkipPublish $skipPublish
} catch {
Write-Error -ErrorAction Stop $_.Exception.Message
Write-Error (Get-Error | Out-String)
return 1
}
Comment thread
SteveL-MSFT marked this conversation as resolved.

Expand Down
8 changes: 4 additions & 4 deletions tools/packages.microsoft.com/mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@
"distribution": [
"stable"
],
"PackageFormat": "PACKAGE_NAME_RELEASE_VERSION-1_x86_64.rpm"
"PackageFormat": "PACKAGE_NAME-RELEASE_VERSION-1.x86_64.rpm"
},
{
"url": "microsoft-rhel9.0-prod",
"distribution": [
"stable"
],
"PackageFormat": "PACKAGE_NAME_RELEASE_VERSION-1_x86_64.rpm"
"PackageFormat": "PACKAGE_NAME-RELEASE_VERSION-1.x86_64.rpm"
},
{
"url": "microsoft-rhel8.0-prod",
"distribution": [
"stable"
],
"PackageFormat": "PACKAGE_NAME_RELEASE_VERSION-1_aarch64.rpm"
"PackageFormat": "PACKAGE_NAME-RELEASE_VERSION-1.aarch64.rpm"
},
{
"url": "microsoft-rhel9.0-prod",
"distribution": [
"stable"
],
"PackageFormat": "PACKAGE_NAME_RELEASE_VERSION-1_aarch64.rpm"
"PackageFormat": "PACKAGE_NAME-RELEASE_VERSION-1.aarch64.rpm"
},
{
"url": "microsoft-debian-bullseye-prod",
Expand Down
Loading