Skip to content

Commit

Permalink
Merge commit 'a0b940589ec808e41b379b67286fe6d975ed621f' into python-3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
bebound committed Sep 13, 2023
2 parents ba4951a + a0b9405 commit f87722c
Show file tree
Hide file tree
Showing 448 changed files with 168,946 additions and 102,191 deletions.
67 changes: 67 additions & 0 deletions .github/policies/resourceManagement.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2816,6 +2816,48 @@ configuration:
- addLabel:
label: Auto-Assign
description: '[webapp] auto assign labels and users based on issue description.'
- if:
- payloadType: Issues
- or:
- titleContains:
pattern: 'az webapp connection'
isRegex: True
- bodyContains:
pattern: 'az webapp connection'
isRegex: True
- titleContains:
pattern: 'az functionapp connection'
isRegex: True
- bodyContains:
pattern: 'az functionapp connection'
isRegex: True
- titleContains:
pattern: 'az springapp connection'
isRegex: True
- bodyContains:
pattern: 'az springapp connection'
isRegex: True
- titleContains:
pattern: 'az containerapp connection'
isRegex: True
- bodyContains:
pattern: 'az containerapp connection'
isRegex: True
- or:
- isAction:
action: Opened
then:
- addLabel:
label: Service Connector
- addLabel:
label: CXP Attention
- addLabel:
label: Auto-Assign
- assignTo:
users:
- yungezz
- houk-ms
description: '[Service Connector] auto assign labels and users based on issue description.'
- if:
- payloadType: Issues
- or:
Expand Down Expand Up @@ -3551,6 +3593,7 @@ configuration:
- assignTo:
users:
- zhoxing-ms
- yanzhudd
- addLabel:
label: Auto-Assign
- requestReview:
Expand Down Expand Up @@ -5620,5 +5663,29 @@ configuration:
- addLabel:
label: CXP Attention
description: '[ARO] auto assign labels and users based on issue description.'
- if:
- payloadType: Pull_Request
- isAction:
action: Opened
- or:
- titleContains:
pattern: az aro
isRegex: True
- bodyContains:
pattern: az aro
isRegex: True
then:
- addLabel:
label: Auto-Assign
- addLabel:
label: ARO
- requestReview:
reviewer: kairu-ms
- requestReview:
reviewer: yonzhan
- assignTo:
users:
- kairu-ms
description: '[ARO] Auto assign labels and reviewers based on PR title/description.'
onFailure:
onSuccess:
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ RUN apk add --no-cache bash openssh ca-certificates jq curl openssl perl git zip
&& apk add --no-cache bash-completion \
&& update-ca-certificates

ARG JP_VERSION="0.1.3"
ARG JP_VERSION="0.2.1"

RUN curl -L https://github.com/jmespath/jp/releases/download/${JP_VERSION}/jp-linux-amd64 -o /usr/local/bin/jp \
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && curl -L https://github.com/jmespath/jp/releases/download/${JP_VERSION}/jp-linux-$arch -o /usr/local/bin/jp \
&& chmod +x /usr/local/bin/jp

WORKDIR azure-cli
Expand Down
52 changes: 6 additions & 46 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@ jobs:
TargetPath: 'build_scripts/windows/out/'
ArtifactName: msi-$(Platform)

- job: TestWindowsMSI
displayName: Test Windows MSI
- job: TestMsiInstallation
displayName: Test MSI Installation
strategy:
matrix:
x86:
Platform: x86
# x64:
# Platform: x64
x64:
Platform: x64

dependsOn: BuildWindowsMSI
condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'Manual', 'Schedule'))
Expand All @@ -257,47 +257,7 @@ jobs:
- task: PowerShell@2
displayName: Install and Load CLI
inputs:
targetType: inline
script: |
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
# Start another Powershell process as Admin and execute this script again
$arguments = "& '" +$myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
# Stop if the PowerShell is not run as Admin
Break
}
# The following are executed by elevated PowerShell
az --version
$InstallArgs = @(
"/i"
"`"$env:SYSTEM_ARTIFACTSDIRECTORY\msi\Microsoft Azure CLI.msi`""
"/q"
"/norestart"
"/l*v"
".\install_logs.txt"
)
$pre_installed_version=az version --query '\"azure-cli\"' -o tsv
$to_be_installed_version=Get-Content $(System.ArtifactsDirectory)/metadata/version
if ($pre_installed_version -eq $to_be_installed_version){
# See https://docs.microsoft.com/windows/win32/msi/reinstallmode about options of REINSTALLMODE
$reinstall_option="REINSTALL=ALL REINSTALLMODE=emus"
$InstallArgs += $reinstall_option
}
Start-Process "msiexec.exe" -ArgumentList $InstallArgs -Wait -NoNewWindow
$install_time=Measure-Command {Start-Process "msiexec.exe" -ArgumentList $InstallArgs -Wait -NoNewWindow} | select -expand TotalSeconds
$installed_version=az version --query '\"azure-cli\"' -o tsv
if ($installed_version -ne $to_be_installed_version){
echo "The MSI failed to install."
Exit 1
}
echo 'Install time(seconds):' $install_time
az --version
# Test bundled pip with extension installation
az extension add -n rdbms-connect
az self-test
Get-Content .\install_logs.txt
filePath: build_scripts\windows\scripts\test_msi_installation.ps1

- job: BuildDockerImage
displayName: Build Docker Image
Expand Down Expand Up @@ -1137,7 +1097,7 @@ jobs:
- VerifyWindowsRequirements
- VerifyVersions
- BuildWindowsMSI
- TestWindowsMSI
- TestMsiInstallation
- BuildDockerImage
- TestDockerImage
- BuildPythonWheel
Expand Down
76 changes: 76 additions & 0 deletions build_scripts/windows/scripts/test_msi_installation.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

Set-PSDebug -Trace 1

if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
# Start another Powershell process as Admin and execute this script again
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
# Stop if the PowerShell is not run as Admin
Break
}
# The following are executed by elevated PowerShell

# Deal with the pre-installed Azure CLI on the ADO agent
az --version

# Uninstall the pre-installed Azure CLI. We use wildcard, since product name can be:
# - Microsoft Azure CLI --deprecated
# - Microsoft Azure CLI (32-bit)
# - Microsoft Azure CLI (64-bit)
$cli_package = Get-Package -Provider Programs -IncludeWindowsInstaller -Name "Microsoft Azure CLI*"
$cli_package | Format-List
Uninstall-Package -Name $cli_package.Name

# Make sure it is uninstalled
Get-Package -Provider Programs -IncludeWindowsInstaller


# Install artifact MSI
$InstallArgs = @(
"/i"
"`"$env:SYSTEM_ARTIFACTSDIRECTORY\msi\Microsoft Azure CLI.msi`""
"/q"
"/norestart"
"/l*v"
".\install_logs.txt"
)
Write-Output "Calling: msiexec.exe $InstallArgs"
$install_time = Measure-Command {Start-Process "msiexec.exe" -ArgumentList $InstallArgs -Wait -NoNewWindow}

# Show installation log. Since the log is too big, we only print it when needed.
# Get-Content .\install_logs.txt

# Show installation time
Write-Output "Installation time (seconds): $($install_time.TotalSeconds)"

# Show package information
Get-Package -Provider Programs -IncludeWindowsInstaller -Name "Microsoft Azure CLI*" | Format-List

# We can't restart the current shell in CI to refresh PATH, so use absolute path.
# If we can find a way to refresh PATH in the same shell session, we can directly call az.
if ($env:PLATFORM -eq 'x64') {
$az_full_path = "C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin\az.cmd"
} else {
$az_full_path = "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd"
}

& $az_full_path --version

$installed_version=& $az_full_path version --query '\"azure-cli\"' -o tsv
Write-Output "Installed version: $installed_version"

$artifact_version=Get-Content $env:SYSTEM_ARTIFACTSDIRECTORY\metadata\version
Write-Output "Artifact version: $artifact_version"

if ($installed_version -ne $artifact_version){
Write-Output "The installed version doesn't match the artifact version."
Exit 1
}

# Test bundled pip with extension installation
& $az_full_path extension add -n account
& $az_full_path self-test
3 changes: 2 additions & 1 deletion scripts/ci/test_extensions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ output=$(az extension list-available --query [].name -otsv)
exit_code=0

# azure-cli-ml: https://github.com/Azure/azure-cli-extensions/issues/826
ignore_list='azure-cli-ml fzf arcappliance arcdata connectedk8s'
# Disable k8s-extension temporarily: https://github.com/Azure/azure-cli-extensions/pull/6702
ignore_list='azure-cli-ml fzf arcappliance arcdata connectedk8s k8s-extension'

for ext in $output; do
echo
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/debian/test_deb_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
root_dir = '/opt/az/lib/python3.10/site-packages/azure/cli/command_modules'
mod_list = [mod for mod in sorted(os.listdir(root_dir)) if os.path.isdir(os.path.join(root_dir, mod)) and mod != '__pycache__']

pytest_base_cmd = '/opt/az/bin/python3 -m pytest -x -v --forked -p no:warnings --log-level=WARN'
pytest_base_cmd = '/opt/az/bin/python3 -m pytest -v --forked -p no:warnings --log-level=WARN'
pytest_parallel_cmd = '{} -n auto'.format(pytest_base_cmd)
serial_test_modules = ['botservice', 'network', 'cloud', 'appservice', 'iot', 'resource']

Expand Down
19 changes: 11 additions & 8 deletions scripts/release/homebrew/docker/formula_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,23 @@
import bisect
import argparse

TEMPLATE_FILE_NAME='formula_template.txt'
CLI_VERSION=os.environ['CLI_VERSION']
HOMEBREW_UPSTREAM_URL=os.environ['HOMEBREW_UPSTREAM_URL']
HOMEBREW_FORMULAR_LATEST="https://raw.githubusercontent.com/Homebrew/homebrew-core/c882489d4cb39ca004387f0c5ef1a767046c68d6/Formula/azure-cli.rb"
TEMPLATE_FILE_NAME = 'formula_template.txt'
CLI_VERSION = os.environ['CLI_VERSION']
HOMEBREW_UPSTREAM_URL = os.environ['HOMEBREW_UPSTREAM_URL']
HOMEBREW_FORMULAR_LATEST = "https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/a/azure-cli.rb"


def main():
print('Generate formula for Azure CLI homebrew release.')

parser = argparse.ArgumentParser(prog='formula_generator.py')
parser.set_defaults(func=generate_formula)
parser.add_argument('-b', dest='build_method', choices=['update_existing', 'use_template'], help='The build method, default is update_existing, the other option is use_template.')
parser.add_argument('-b', dest='build_method', choices=['update_existing', 'use_template'],
help='The build method, default is update_existing, the other option is use_template.')
args = parser.parse_args()
args.func(**vars(args))


def generate_formula(build_method: str, **_):
content = ''
if build_method is None or build_method == 'update_existing':
Expand Down Expand Up @@ -82,7 +84,8 @@ def collect_resources() -> str:

def collect_resources_dict() -> dict:
nodes = make_graph('azure-cli')
filtered_nodes = {nodes[node_name]['name']: nodes[node_name] for node_name in sorted(nodes) if resource_filter(node_name)}
filtered_nodes = {nodes[node_name]['name']: nodes[node_name] for node_name in sorted(nodes) if
resource_filter(node_name)}
return filtered_nodes


Expand Down Expand Up @@ -148,7 +151,7 @@ def update_formula() -> str:
node_index_dict[pack] = idx
elif pack is not None:
if line.startswith(" url"):
#update the url of package
# update the url of package
if pack in nodes.keys():
url_match = re.search(r'url "(.*)"', line)
if url_match is not None and nodes[pack]['url'] != url_match.group(1):
Expand All @@ -157,7 +160,7 @@ def update_formula() -> str:
else:
packs_to_remove.add(pack)
elif line.startswith(" sha256"):
#update the sha256 of package
# update the sha256 of package
if pack in nodes.keys():
lines[idx] = re.sub('sha256 ".*"', 'sha256 "{}"'.format(nodes[pack]['checksum']), line, 1)
del nodes[pack]
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/homebrew/test_homebrew_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
root_dir = '{}/lib/{}/site-packages/azure/cli/command_modules'.format(az_base, python_version)
mod_list = [mod for mod in sorted(os.listdir(root_dir)) if os.path.isdir(os.path.join(root_dir, mod)) and mod != '__pycache__']

pytest_base_cmd = 'PYTHONPATH={}/lib/{}/site-packages python -m pytest -x -v --forked -p no:warnings --log-level=WARN'.format(az_base, python_version)
pytest_base_cmd = 'PYTHONPATH={}/lib/{}/site-packages python -m pytest -v --forked -p no:warnings --log-level=WARN'.format(az_base, python_version)
pytest_parallel_cmd = '{} -n auto'.format(pytest_base_cmd)

for mod_name in mod_list:
Expand Down
2 changes: 1 addition & 1 deletion scripts/release/rpm/test_rpm_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
root_dir = f'/usr/lib64/az/lib/{python_version}/site-packages/azure/cli/command_modules'
mod_list = [mod for mod in sorted(os.listdir(root_dir)) if os.path.isdir(os.path.join(root_dir, mod)) and mod != '__pycache__']

pytest_base_cmd = f'PYTHONPATH=/usr/lib64/az/lib/{python_version}/site-packages python -m pytest -x -v --forked -p no:warnings --log-level=WARN'
pytest_base_cmd = f'PYTHONPATH=/usr/lib64/az/lib/{python_version}/site-packages python -m pytest -v --forked -p no:warnings --log-level=WARN'
pytest_parallel_cmd = '{} -n auto'.format(pytest_base_cmd)
serial_test_modules = ['botservice', 'network', 'cloud', 'appservice', 'iot', 'resource']

Expand Down
4 changes: 4 additions & 0 deletions src/azure-cli-core/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Release History
===============

2.52.0
++++++
* `aaz`: Support `configured_default` for `AAZBaseArg` (#27205)

2.51.0
++++++
* `aaz`: Add `--max-items` and `--next-token` for pagination (#26710)
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# --------------------------------------------------------------------------------------------
# pylint: disable=line-too-long

__version__ = "2.51.0"
__version__ = "2.52.0"

import os
import sys
Expand Down
4 changes: 1 addition & 3 deletions src/azure-cli-core/azure/cli/core/profiles/_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ class ResourceType(Enum): # pylint: disable=too-few-public-methods
MGMT_BOTSERVICE = ('azure.mgmt.botservice', None)
MGMT_CDN = ('azure.mgmt.cdn', None)
MGMT_COGNITIVESERVICES = ('azure.mgmt.cognitiveservices', None)
MGMT_CONSUMPTION = ('azure.mgmt.consumption', None)
MGMT_CONTAINERINSTANCE = ('azure.mgmt.containerinstance', None)
MGMT_COSMOSDB = ('azure.mgmt.cosmosdb', None)
MGMT_DATALAKE_ANALYTICS = ('azure.cli.command_modules.dla.vendored_sdks.azure_mgmt_datalake_analytics', None)
Expand All @@ -110,7 +109,6 @@ class ResourceType(Enum): # pylint: disable=too-few-public-methods
MGMT_POLICYINSIGHTS = ('azure.mgmt.policyinsights', None)
MGMT_RDBMS = ('azure.mgmt.rdbms', None)
MGMT_REDIS = ('azure.mgmt.redis', None)
MGMT_RELAY = ('azure.mgmt.relay', None)
MGMT_SEARCH = ('azure.mgmt.search', None)
MGMT_SERVICEFABRIC = ('azure.mgmt.servicefabric', None)
MGMT_SIGNALR = ('azure.mgmt.signalr', None)
Expand Down Expand Up @@ -190,7 +188,7 @@ def default_api_version(self):
ResourceType.MGMT_KEYVAULT: '2023-02-01',
ResourceType.MGMT_AUTHORIZATION: SDKProfile('2022-04-01', {
'classic_administrators': '2015-06-01',
'role_definitions': '2022-04-01',
'role_definitions': '2022-05-01-preview',
'provider_operations_metadata': '2018-01-01-preview'
}),
ResourceType.MGMT_CONTAINERREGISTRY: SDKProfile('2022-02-01-preview', {
Expand Down
Loading

0 comments on commit f87722c

Please sign in to comment.