Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b210aa7
[Quantum] Use Post Storage URI and SAS token like Quantum Python SDK …
warren-jones Mar 11, 2025
814f9ef
Update ProviderHub CLI Support for Comma Separated Values (#8461)
natzoz Mar 11, 2025
63e8781
Ran azdev mask (#8547)
warren-jones Mar 12, 2025
8e1899e
{dataprotection} Updated packaged vendored SDK azure_mgmt_preview_aks…
zubairabid Mar 12, 2025
fe0909b
[Release] Update index.json for extension [ dataprotection-1.5.6 ]
azclibot Mar 12, 2025
e1d64ea
{Application-insights} Add auth adaptor for track 1 sdk (#8551)
AllyW Mar 12, 2025
044d77b
[Release] Update index.json for extension [ application-insights-1.2.3 ]
azclibot Mar 12, 2025
fe01406
[Quantum] Quantum CLI Extension Release, Version 1.0.0b5 (#8549)
warren-jones Mar 13, 2025
5adfa72
[Release] Update index.json for extension [ quantum-1.0.0b5 ]
azclibot Mar 13, 2025
fb1f259
[load] CLI changes for the CICD improvements. (#8546)
mohitpavan Mar 13, 2025
52f27b1
[Release] Update index.json for extension [ load-1.7.0 ]
azclibot Mar 13, 2025
93532d4
{CI} Remove version import related code in setup.py (#8384)
cxznmhdcxz Mar 13, 2025
19f0169
[Release] Update index.json for extension [ swiftlet-0.1.0 ] [ logz-0…
azclibot Mar 13, 2025
0fa9b35
{CI} Remove deprecated logz and swiftlet extension entries from index…
wangzelin007 Mar 13, 2025
eb4bd47
{CI} Move find_extension_upgraded.py to azure-cli-extensions repo (#8…
wangzelin007 Mar 13, 2025
6d961f2
[Spring] Add migration command from Azure Spring Apps to Azure Contai…
ninpan-ms Mar 13, 2025
3fe444e
{CI} Update Azure Pipelines to use Ubuntu 22.04 pools (#8543)
wangzelin007 Mar 13, 2025
0134092
[Release] Update index.json for extension [ acrquery-1.0.1b2 ]
azclibot Mar 13, 2025
3dbe081
[Release] Update index.json for extension [ spring-1.27.0 ]
azclibot Mar 13, 2025
28e87a1
Merge branch 'main' of https://github.com/Azure/azure-cli-extensions …
Mar 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion .azure-pipelines/sync-alias.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ resources:
type: git
name: internal.wiki

variables:
- template: ${{ variables.Pipeline.Workspace }}/.azure-pipelines/templates/variables.yml

jobs:
- job: UpdateYaml
displayName: Update resourceManagement.yml
pool: pool-windows-2019
pool:
name: ${{ variables.windows_pool }}
uses:
repositories:
- ServiceContactList
Expand Down
4 changes: 2 additions & 2 deletions .azure-pipelines/templates/variables.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variables:
ubuntu_pool: 'pool-ubuntu-2004'
ubuntu_pool: 'pool-ubuntu-2204'
windows_pool: 'pool-windows-2019'
ubuntu_arm64_pool: 'ubuntu-arm64-2004-pool'
ubuntu_arm64_pool: 'pool-ubuntu-latest-arm64'
25 changes: 14 additions & 11 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ pr:
include:
- '*'

variables:
- template: ${{ variables.Pipeline.Workspace }}/.azure-pipelines/templates/variables.yml

jobs:
- job: CredScan
displayName: "Credential Scan"
pool:
name: 'pool-windows-2019'
name: ${{ variables.windows_pool }}
steps:
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@3
displayName: 'Run Credential Scanner'
Expand All @@ -34,7 +37,7 @@ jobs:
- job: PolicyCheck
displayName: "Policy Check"
pool:
name: 'pool-windows-2019'
name: ${{ variables.windows_pool }}
steps:
- task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@2
displayName: 'Run Policy Check'
Expand All @@ -51,7 +54,7 @@ jobs:
- job: CheckLicenseHeader
displayName: "Check License"
pool:
name: 'pool-ubuntu-2004'
name: ${{ variables.ubuntu_pool }}
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.12'
Expand All @@ -67,7 +70,7 @@ jobs:
- job: IndexVerify
displayName: "Verify Extensions Index"
pool:
name: 'pool-ubuntu-2004'
name: ${{ variables.ubuntu_pool }}
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.12'
Expand All @@ -84,7 +87,7 @@ jobs:
- job: SourceTests
displayName: "Integration Tests, Build Tests"
pool:
name: 'pool-ubuntu-2004'
name: ${{ variables.ubuntu_pool }}
strategy:
matrix:
Python39:
Expand Down Expand Up @@ -119,7 +122,7 @@ jobs:
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
continueOnError: true
pool:
name: 'pool-ubuntu-2004'
name: ${{ variables.ubuntu_pool }}
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.12'
Expand All @@ -143,7 +146,7 @@ jobs:
displayName: "azdev linter on Modified Extensions"
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
pool:
name: 'pool-ubuntu-2004'
name: ${{ variables.ubuntu_pool }}
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.12'
Expand All @@ -168,7 +171,7 @@ jobs:
displayName: "azdev scan ( High Confidence ) on Modified Extensions"
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
pool:
name: 'pool-ubuntu-2004'
name: ${{ variables.ubuntu_pool }}
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.11'
Expand Down Expand Up @@ -199,7 +202,7 @@ jobs:
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
continueOnError: true
pool:
name: 'pool-ubuntu-2004'
name: ${{ variables.ubuntu_pool }}
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.11'
Expand Down Expand Up @@ -228,7 +231,7 @@ jobs:
# displayName: "Verify Ref Docs"
# continueOnError: true
# pool:
# name: 'pool-ubuntu-2004'
# name: ${{ variables.ubuntu_pool }}
# steps:
# - task: UsePythonVersion@0
# displayName: 'Use Python 3.12'
Expand All @@ -245,7 +248,7 @@ jobs:
- job: CheckInit
displayName: "Check Init Files"
pool:
name: 'pool-ubuntu-2004'
name: ${{ variables.ubuntu_pool }}
steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.x'
Expand Down
141 changes: 141 additions & 0 deletions scripts/ci/find_extension_upgraded.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
import os
import sys
import json
from subprocess import check_output
from pkg_resources import parse_version

def separator_line():
print('-' * 100)

class AzdevExtensionHelper:
def __init__(self, extension_name):
self.name = extension_name

def _get_metadata_flags(self, setup_py_dir):
for root, _, files in os.walk(setup_py_dir):
if 'azext_metadata.json' in files:
metadata_path = os.path.join(root, 'azext_metadata.json')
with open(metadata_path, 'r') as f:
metadata = json.load(f)
is_experimental = metadata.get('azext.isExperimental', False)
is_preview = metadata.get('azext.isPreview', False)
return is_experimental, is_preview
return False, False

def _adjust_version_for_preview(self, version, setup_py_dir):
is_experimental, is_preview = self._get_metadata_flags(setup_py_dir)
if is_experimental or is_preview:
version_parts = version.split('.')
if all(part.isdigit() for part in version_parts):
version = f"{version}b1"
return version

def is_version_upgrade(self):
with open('src/index.json') as fd:
current_extensions = json.loads(fd.read()).get("extensions")

setup_py = f'src/{self.name}/setup.py'
if not os.path.isfile(setup_py):
print('no setup.py')
return False

setup_py_dir = os.path.dirname(setup_py)
cmd = f'{sys.executable} setup.py --name'
self.name = check_output(cmd, shell=True, cwd=setup_py_dir).decode('utf-8').strip()
self.name = self.name.replace('_', '-')

metadata = current_extensions.get(self.name, None)
if metadata is None: # for new added extension
return True

current_max_entry = max(metadata, key=lambda e: parse_version(e['metadata']['version']))
current_max_version = current_max_entry['metadata']['version']
current_max_version = self._adjust_version_for_preview(current_max_version, setup_py_dir)
print(f'current max version is {current_max_version}')

cmd = f'{sys.executable} setup.py --version'
modified_version = check_output(cmd, shell=True, cwd=setup_py_dir).decode('utf-8').strip()
print(f'modified version is {modified_version}')

if parse_version(current_max_version) > parse_version(modified_version):
err = f'version downgrade is not allowed in extension {setup_py}. [{current_max_version} -> {modified_version}]'
raise Exception(err)

if parse_version(current_max_version) == parse_version(modified_version):
return False

return True

def find_modified_files_against_master_branch():
"""
Deleted files don't count in diff
"""
cmd = 'git --no-pager diff --diff-filter=ACMRT --name-only HEAD~1 -- src/'
files = check_output(cmd.split()).decode('utf-8').split('\n')
separator_line()
print('modified files:')
for f in files:
print(f)
separator_line()
return [f for f in files if len(f) > 0]

def contain_extension_code(files):
with open('src/index.json', 'r') as fd:
current_extensions = json.loads(fd.read()).get("extensions")
current_extension_homes = set(f'src/{name}' for name in current_extensions)

for file in files:
if any([file.startswith(prefix) for prefix in current_extension_homes]):
return True

# for new added extensions or modules that src folder name does not match its wheel package name
for file in files:
if 'src/' in file and os.path.isfile(file) and os.path.isdir(os.path.dirname(file)):
new_extension_home = os.path.dirname(file)
new_extension_home = os.path.join(*new_extension_home.split('/')[:2])
if os.path.isfile(os.path.join(new_extension_home, 'setup.py')):
return True
return False

def main():
modified_files = find_modified_files_against_master_branch()
if 'src/index.json' in modified_files:
modified_files.remove('src/index.json')

# check setup.py
for f in modified_files:
if f.endswith('setup.py'):
break
else:
separator_line()
print('no setup.py is modified, no need to publish')
separator_line()
return

# check source code
if not contain_extension_code(modified_files):
separator_line()
print('no extension source code is modified, no need to publish')
separator_line()
return

extension_names = set()
for f in modified_files:
src, name, *_ = f.split('/')
if os.path.isdir(os.path.join(src, name)):
extension_names.add(name)

for name in extension_names:
azdev_extension = AzdevExtensionHelper(name)
if azdev_extension.is_version_upgrade() is False:
print(f'extension [{name}] is not upgrade, no need to help publish')
continue
with open('./upgrade_extensions.txt', 'a') as fd:
fd.write(name + '\n')

if __name__ == '__main__':
main()
4 changes: 0 additions & 4 deletions src/ad/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

# HISTORY.rst entry.
VERSION = '0.1.0'
try:
from azext_ad.manual.version import VERSION
except ImportError:
pass

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down
6 changes: 1 addition & 5 deletions src/alias/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
import re
from setuptools import setup, find_packages

# Inspired by https://github.com/Azure/azure-sdk-for-python/blob/master/azure-mgmt-cdn/setup.py#L45
extension_path = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(extension_path, 'azext_alias', 'version.py'), 'r') as version_file:
VERSION = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]',
version_file.read(), re.MULTILINE).group(1)
VERSION = '0.5.2'

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down
3 changes: 3 additions & 0 deletions src/application-insights/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

Release History
===============
1.2.3
++++++++++++++++++
* `az monitor app-insights events/metrics/query`: Fix error: Profile.get_login_credentials() got an unexpected keyword argument 'resource'

1.2.2
++++++++++++++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,37 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

class _Track1Credential: # pylint: disable=too-few-public-methods

def __init__(self, credential, resource):
"""Track 1 credential that can be fed into Track 1 SDK clients. Exposes signed_session protocol.
:param credential: Track 2 credential that exposes get_token protocol
:param resource: AAD resource
"""
self._credential = credential
self._resource = resource

def signed_session(self, session=None):
import requests
from azure.cli.core.auth.util import resource_to_scopes
session = session or requests.Session()
token = self._credential.get_token(*resource_to_scopes(self._resource))
header = "{} {}".format('Bearer', token.token)
session.headers['Authorization'] = header
return session


def applicationinsights_data_plane_client(cli_ctx, _, subscription=None):
"""Initialize Log Analytics data client for use with CLI."""
from .vendored_sdks.applicationinsights import ApplicationInsightsDataClient
from azure.cli.core._profile import Profile
profile = Profile(cli_ctx=cli_ctx)
cred, _, _ = profile.get_login_credentials(
resource=cli_ctx.cloud.endpoints.app_insights_resource_id,
subscription_id=subscription
)
# Note: temporarily adapt track2 auth to track1 by the guidance:
# https://github.com/Azure/azure-cli/pull/29631#issuecomment-2716799520
# need to be removed after migrated by codegen
cred, _, _ = profile.get_login_credentials(subscription_id=subscription)
return ApplicationInsightsDataClient(
cred,
_Track1Credential(cred, cli_ctx.cloud.endpoints.app_insights_resource_id),
base_url=f'{cli_ctx.cloud.endpoints.app_insights_resource_id}/v1'
)

Expand Down
Loading