Skip to content

Commit

Permalink
Update versioning tools logic
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu committed Dec 5, 2020
1 parent 865f529 commit c66a656
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 14 deletions.
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
4 changes: 2 additions & 2 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ function GetExistingPackageVersions ($PackageName, $GroupId=$null) {
function SetPackageVersion ($PackageName, $Version, $ServiceName, $ReleaseDate) {
if($null -eq $ReleaseDate)
{
$ReleaseDate = Get-Date -Format "yyy-MM-dd"
$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 $ServiceName
python "$EngDir/versioning/version_set.py" --package-name $PackageName --new-version $Version --service $ServiceName --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)

2 changes: 1 addition & 1 deletion sdk/core/azure-core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Release History

## 2.0.0 (2020-12-03)
## 1.9.1 (Unreleased)


## 1.9.0 (2020-11-09)
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/azure-core/azure/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# regenerated.
# --------------------------------------------------------------------------

VERSION = "2.0.0"
VERSION = "1.9.1"

0 comments on commit c66a656

Please sign in to comment.