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
3 changes: 2 additions & 1 deletion eng/pipelines/templates/stages/archetype-python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ parameters:
Artifacts: []
TestPipeline: false
ArtifactName: 'not-specified'
ServiceDirectory: 'not-specified'
DependsOn: Build
DocArtifact: 'documentation'
DevFeedName: 'public/azure-sdk-for-python'
Expand Down Expand Up @@ -227,7 +228,7 @@ stages:
displayName: Increment package version
inputs:
scriptPath: 'eng/versioning/version_increment.py'
arguments: '--package-name ${{ artifact.name }}'
arguments: '--package-name ${{ artifact.name }} --service ${{ parameters.ServiceDirectory }}'
- template: /eng/common/pipelines/templates/steps/create-pull-request.yml
parameters:
RepoName: azure-sdk-for-python
Expand Down
22 changes: 18 additions & 4 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ function Get-python-PackageInfoFromRepo ($pkgPath, $serviceDirectory, $pkgName)
}

# Returns the pypi publish status of a package id and version.
function IsPythonPackageVersionPublished($pkgId, $pkgVersion) {
function IsPythonPackageVersionPublished($pkgId, $pkgVersion)
{
try
{
$existingVersion = (Invoke-RestMethod -MaximumRetryCount 3 -RetryIntervalSec 10 -Method "Get" -uri "https://pypi.org/pypi/$pkgId/$pkgVersion/json").info.version
Expand All @@ -48,7 +49,8 @@ function IsPythonPackageVersionPublished($pkgId, $pkgVersion) {
}

# Parse out package publishing information given a python sdist of ZIP format.
function Get-python-PackageInfoFromPackageFile ($pkg, $workingDirectory) {
function Get-python-PackageInfoFromPackageFile ($pkg, $workingDirectory)
{
$pkg.Basename -match $SDIST_PACKAGE_REGEX | Out-Null

$pkgId = $matches["package"]
Expand Down Expand Up @@ -109,7 +111,8 @@ function Publish-python-GithubIODocs ($DocLocation, $PublicArtifactLocation)
}
}

function Get-python-GithubIoDocIndex() {
function Get-python-GithubIoDocIndex()
{
# Update the main.js and docfx.json language content
UpdateDocIndexFiles -appTitleLang Python
# Fetch out all package metadata from csv file.
Expand All @@ -125,7 +128,8 @@ function Get-python-GithubIoDocIndex() {
# 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){
function Update-python-CIConfig($pkgs, $ciRepo, $locationInDocRepo, $monikerId=$null)
{
$pkgJsonLoc = (Join-Path -Path $ciRepo -ChildPath $locationInDocRepo)

if (-not (Test-Path $pkgJsonLoc)) {
Expand Down Expand Up @@ -205,3 +209,13 @@ function Find-python-Artifacts-For-Apireview($artifactDir, $artifactName)
}
return $packages
}

function SetPackageVersion ($PackageName, $Version, $ServiceDirectory, $ReleaseDate, $BuildType=$null, $GroupId=$null)
{
if($null -eq $ReleaseDate)
{
$ReleaseDate = Get-Date -Format "yyyy-MM-dd"
}
pip install -r "$EngDir/versioning/requirements.txt" -q -I
python "$EngDir/versioning/version_set.py" --package-name $PackageName --new-version $Version --service $ServiceDirectory --release-date $ReleaseDate
}
4 changes: 2 additions & 2 deletions eng/versioning/version_increment.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def increment_version(old_version):
'Examples: All = "azure-*", Single = "azure-keyvault", Targeted Multiple = "azure-keyvault,azure-mgmt-resource"'
),
)
parser.add_argument('--service', help='name of the service for which to set the dev build id (e.g. keyvault)')
parser.add_argument('--service', required=True, help='name of the service for which to set the dev build id (e.g. keyvault)')
args = parser.parse_args()

package_name = args.package_name.replace('_', '-')
Expand All @@ -56,4 +56,4 @@ def increment_version(old_version):

set_version_py(target_package[0], new_version)
set_dev_classifier(target_package[0], new_version)
update_change_log(target_package[0], new_version, True, False)
update_change_log(target_package[0], new_version, args.service, args.package_name, True, False)
5 changes: 3 additions & 2 deletions eng/versioning/version_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

parser.add_argument('--package-name', required=True, help='name of package (accetps both formats: azure-service-package and azure_service_pacage)')
parser.add_argument('--new-version', required=True, help='new package version')
parser.add_argument('--service', help='name of the service for which to set the dev build id (e.g. keyvault)')
parser.add_argument('--service', required=True, help='name of the service for which to set the dev build id (e.g. keyvault)')
parser.add_argument('--release-date', help='date in the format "yyyy-MM-dd"')
parser.add_argument(
dest="glob_string",
nargs="?",
Expand Down Expand Up @@ -37,4 +38,4 @@

set_version_py(target_package[0], new_version)
set_dev_classifier(target_package[0], new_version)
update_change_log(target_package[0], new_version, False, True)
update_change_log(target_package[0], new_version, args.service, args.package_name, False, True, args.release_date)
18 changes: 13 additions & 5 deletions eng/versioning/version_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import logging
from packaging.version import parse

from datetime import date
from setup_parser import parse_setup

root_dir = path.abspath(path.join(path.abspath(__file__), "..", "..", ".."))
Expand Down Expand Up @@ -130,21 +131,28 @@ def set_dev_classifier(setup_py_location, version):

setup_py_file.write(replaced_setup_contents)

def update_change_log(setup_py_location, version, is_unreleased, replace_version):
script = os.path.join(root_dir, "eng", "common", "Update-Change-Log.ps1")
def update_change_log(setup_py_location, version, service, package, is_unreleased, replace_version, release_date=None):
script = os.path.join(root_dir, "eng", "common", "scripts", "Update-ChangeLog.ps1")
pkg_root = os.path.abspath(os.path.join(setup_py_location, ".."))

commands = [
"pwsh",
script,
"--Version",
version,
"--ChangeLogPath",
pkg_root,
"--ServiceDirectory",
service,
"--PackageName",
package,
"--Unreleased",
str(is_unreleased),
"--ReplaceVersion",
"--ReplaceLatestEntry",
str(replace_version)
]
if release_date is not None:
commands.append("--ReleaseDate")
commands.append(release_date)

# Run script to update change log
run_check_call(commands, pkg_root)