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
2 changes: 1 addition & 1 deletion eng/pipelines/templates/jobs/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
pwsh: true
workingDirectory: $(Build.SourcesDirectory)
filePath: eng/scripts/SetTestPipelineVersion.ps1
arguments: '-BuildNumber $(Build.BuildNumber)'
arguments: '-BuildID $(Build.BuildId)'

- pwsh: |
$toxenvvar = "whl,sdist"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ stages:
pwsh: true
workingDirectory: $(Build.SourcesDirectory)
filePath: eng/scripts/SetTestPipelineVersion.ps1
arguments: '-BuildID $(Build.BuildId)'
# TEMPORARILY DISABLING 11/16. Will re-enable after patch to common tooling.
# - ${{if ne(artifact.skipVerifyChangeLog, 'true')}}:
# - template: /eng/common/pipelines/templates/steps/verify-changelog.yml
Expand Down
2 changes: 1 addition & 1 deletion eng/pipelines/templates/steps/build-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ steps:
pwsh: true
workingDirectory: $(Build.SourcesDirectory)
filePath: eng/scripts/SetTestPipelineVersion.ps1
arguments: '-BuildNumber $(Build.BuildNumber)'
arguments: '-BuildID $(Build.BuildId)'

- script: |
echo "##vso[build.addbuildtag]Scheduled"
Expand Down
58 changes: 58 additions & 0 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,62 @@ function Get-python-GithubIoDocIndex() {
$tocContent = Get-TocMapping -metadata $metadata -artifacts $artifacts
# Generate yml/md toc files and build site.
GenerateDocfxTocContent -tocContent $tocContent -lang "Python"
}

# Updates a python CI configuration json.
# For "latest", the version attribute is cleared, as default behavior is to pull latest "non-preview".
# For "preview", we update to >= the target releasing package version.
function Update-python-CIConfig($pkgs, $ciRepo, $locationInDocRepo, $monikerId=$null){
$pkgJsonLoc = (Join-Path -Path $ciRepo -ChildPath $locationInDocRepo)

if (-not (Test-Path $pkgJsonLoc)) {
Write-Error "Unable to locate package json at location $pkgJsonLoc, exiting."
exit(1)
}

$allJson = Get-Content $pkgJsonLoc | ConvertFrom-Json
$visibleInCI = @{}

for ($i=0; $i -lt $allJson.packages.Length; $i++) {
$pkgDef = $allJson.packages[$i]

if ($pkgDef.package_info.name) {
$visibleInCI[$pkgDef.package_info.name] = $i
}
}

foreach ($releasingPkg in $pkgs) {
if ($visibleInCI.ContainsKey($releasingPkg.PackageId)) {
$packagesIndex = $visibleInCI[$releasingPkg.PackageId]
$existingPackageDef = $allJson.packages[$packagesIndex]

if ($releasingPkg.IsPrerelease) {
if (-not $existingPackageDef.package_info.version) {
$existingPackageDef.package_info | Add-Member -NotePropertyName version -NotePropertyValue ""
}

$existingPackageDef.package_info.version = ">=$($releasingPkg.PackageVersion)"
}
else {
if ($def.version) {
$def.PSObject.Properties.Remove('version')
}
}
}
else {
$newItem = New-Object PSObject -Property @{
package_info = New-Object PSObject -Property @{
prefer_source_distribution = "true"
install_type = "pypi"
name=$releasingPkg.PackageId
}
exclude_path = @("test*","example*","sample*","doc*")
}
$allJson.packages += $newItem
}
}

$jsonContent = $allJson | ConvertTo-Json -Depth 10 | % {$_ -replace "(?m) (?<=^(?: )*)", " " }

Set-Content -Path $pkgJsonLoc -Value $jsonContent
}
4 changes: 2 additions & 2 deletions eng/scripts/SetTestPipelineVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

param (
[Parameter(mandatory = $true)]
$BuildNumber
$BuildID
)

. "${PSScriptRoot}\..\common\scripts\common.ps1"
Expand All @@ -23,7 +23,7 @@ LogDebug "Last Published Version $($semVarsSorted[0])"

$newVersion = [AzureEngSemanticVersion]::ParsePythonVersionString($semVarsSorted[0])
$newVersion.PrereleaseLabel = "b"
$newVersion.PrereleaseNumber = $BuildNumber
$newVersion.PrereleaseNumber = $BuildID

LogDebug "Version to publish [ $($newVersion.ToString()) ]"

Expand Down