Skip to content

Commit 7a8f59a

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into dev
2 parents 6094ba6 + e67cbb0 commit 7a8f59a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+7403
-2818
lines changed

.devcontainer/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM mcr.microsoft.com/devcontainers/python:3.12
2+
3+
# Copy binaries from the official
4+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
5+
6+
# Remove after production
7+
RUN pip install --no-cache-dir mcp

.devcontainer/devcontainer.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "Azure CLI Dev Container",
3+
"build": {
4+
"dockerfile": "Dockerfile"
5+
},
6+
"features": {
7+
"ghcr.io/devcontainers/features/github-cli:1": {}
8+
},
9+
"workspaceFolder": "/workspaces",
10+
"onCreateCommand": "uv venv .venv --seed",
11+
"postCreateCommand": "REPO_NAME=$(basename $GITHUB_REPOSITORY) && cat $REPO_NAME/.devcontainer/init.sh >> ~/.bashrc && mkdir .vscode && cp $REPO_NAME/.devcontainer/mcp.json .vscode/",
12+
"hostRequirements": {
13+
"cpus": 16,
14+
"memory": "64gb",
15+
"storage": "128gb"
16+
}
17+
}

.devcontainer/init.sh

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
source .venv/bin/activate
3+
4+
# Logout default account
5+
export GITHUB_TOKEN=
6+
7+
# Check `repo` scope exists or not
8+
if gh auth status -a 2>/dev/null | grep "Token scopes: " | grep -q "repo"; then
9+
echo "You now have access to GitHub."
10+
else
11+
gh auth login -p https -w
12+
fi
13+
14+
# Check `aaz-dev` is available or not
15+
if ! command -v aaz-dev &> /dev/null; then
16+
GREEN="\033[0;32m"
17+
YELLOW="\033[0;33m"
18+
NC="\033[0m" # no color
19+
20+
set_or_add_remote() {
21+
local REPO=$1
22+
local REMOTE=$2
23+
local DIR="/workspaces/$REPO"
24+
local OWNER=$([ "$REMOTE" = "origin" ] && echo "$GITHUB_USER" || echo "Azure")
25+
local URL="https://github.com/$OWNER/$REPO.git"
26+
27+
git -C "$DIR" remote get-url "$REMOTE" &>/dev/null || git -C "$DIR" remote add "$REMOTE" "$URL"
28+
git -C "$DIR" remote set-url "$REMOTE" "$URL"
29+
}
30+
31+
setup_repo() {
32+
local REPO=$1
33+
local DIR="/workspaces/$REPO"
34+
35+
echo
36+
gh repo fork "Azure/$REPO" --clone=false --default-branch-only
37+
38+
if [ -d "$DIR" ]; then
39+
set_or_add_remote "$REPO" origin
40+
set_or_add_remote "$REPO" upstream
41+
else
42+
git clone "https://github.com/$GITHUB_USER/$REPO.git" --single-branch --no-tags
43+
set_or_add_remote "$REPO" upstream
44+
45+
# Synchronize with upstream
46+
BRANCH=$(git -C "$DIR" remote show upstream | grep "HEAD branch" | awk '{print $NF}')
47+
git -C "$DIR" pull -r upstream "$BRANCH"
48+
fi
49+
}
50+
51+
SECONDS=0
52+
53+
echo
54+
uv pip install aaz-dev --link-mode=copy
55+
56+
# `azdev` repositories
57+
setup_repo "azure-cli"
58+
setup_repo "azure-cli-extensions"
59+
60+
azdev setup -c -r ./azure-cli-extensions
61+
62+
# `aaz-dev` repositories
63+
setup_repo "aaz"
64+
setup_repo "azure-rest-api-specs"
65+
66+
ELAPSED_TIME=$SECONDS
67+
68+
echo -e "\n${YELLOW}Elapsed time: $((ELAPSED_TIME / 60))m $((ELAPSED_TIME % 60))s.${NC}"
69+
echo -e "\n${GREEN}Finished setup! Please launch the codegen tool via:${NC}"
70+
echo -e "${GREEN}\$ aaz-dev run -c azure-cli -e azure-cli-extensions -s azure-rest-api-specs -a aaz${NC}\n"
71+
else
72+
echo -e "\nPlease launch the codegen tool via:"
73+
echo -e "$ aaz-dev run -c azure-cli -e azure-cli-extensions -s azure-rest-api-specs -a aaz\n"
74+
fi

.devcontainer/mcp.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"inputs": [
3+
{
4+
"type": "promptString",
5+
"id": "extension_or_module_name",
6+
"description": "The name of the Azure CLI extension or module to generate commands for."
7+
},
8+
{
9+
"type": "promptString",
10+
"id": "swagger_module_path",
11+
"description": "The file path to the Swagger module."
12+
},
13+
{
14+
"type": "promptString",
15+
"id": "resource_provider",
16+
"description": "The Azure resource provider for which to generate commands."
17+
},
18+
{
19+
"type": "promptString",
20+
"id": "swagger_tag",
21+
"description": "The Swagger tag to use for command generation."
22+
}
23+
],
24+
"servers": {
25+
"AAZ Flow": {
26+
"command": "python",
27+
"args": [
28+
"azure-cli/tools/aaz-flow/main.py"
29+
],
30+
"env": {
31+
"AAZ_PATH": "/workspaces/aaz",
32+
"CLI_PATH": "/workspaces/azure-cli",
33+
"CLI_EXTENSION_PATH": "/workspaces/azure-cli-extensions",
34+
"SWAGGER_PATH": "/workspaces/azure-rest-api-specs"
35+
}
36+
}
37+
}
38+
}

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/doc/ @jiasli @kairu-ms @jsntcy
1010
/tools/ @kairu-ms @jiasli @wangzelin007 @calvinhzy @bebound
11+
/tools/aaz-flow @a0x1ab @necusjz @yanzhudd
1112
/scripts/ @kairu-ms @jiasli @wangzelin007 @calvinhzy @bebound
1213
/scripts/live_test @kairu-ms @wangzelin007
1314
/src/azure-cli-testsdk/ @jsntcy @jiasli @kairu-ms @wangzelin007 @bebound

azure-pipelines.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,7 @@ jobs:
226226
227227
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
228228
displayName: 'SBOM'
229-
condition: eq(variables['Build.Reason'], 'BatchedCI')
230-
continueOnError: true
229+
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/release')
231230
inputs:
232231
BuildDropPath: 'build_scripts/windows/out/'
233232

@@ -272,8 +271,7 @@ jobs:
272271
273272
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
274273
displayName: 'SBOM'
275-
condition: eq(variables['Build.Reason'], 'BatchedCI')
276-
continueOnError: true
274+
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/release')
277275
inputs:
278276
BuildDropPath: 'build_scripts/windows/out/'
279277

@@ -374,8 +372,7 @@ jobs:
374372
375373
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
376374
displayName: 'SBOM'
377-
condition: eq(variables['Build.Reason'], 'BatchedCI')
378-
continueOnError: true
375+
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/release')
379376
inputs:
380377
BuildDropPath: $(Build.ArtifactStagingDirectory)
381378
DockerImagesToScan: 'clibuild$BUILD_BUILDNUMBER:latest'
@@ -457,8 +454,7 @@ jobs:
457454
458455
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
459456
displayName: 'SBOM'
460-
condition: eq(variables['Build.Reason'], 'BatchedCI')
461-
continueOnError: true
457+
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/release')
462458
inputs:
463459
BuildDropPath: $(Build.ArtifactStagingDirectory)
464460

@@ -629,8 +625,7 @@ jobs:
629625
630626
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
631627
displayName: 'SBOM'
632-
condition: eq(variables['Build.Reason'], 'BatchedCI')
633-
continueOnError: true
628+
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/release')
634629
inputs:
635630
BuildDropPath: $(Build.ArtifactStagingDirectory)
636631

@@ -742,8 +737,7 @@ jobs:
742737

743738
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
744739
displayName: 'SBOM'
745-
condition: eq(variables['Build.Reason'], 'BatchedCI')
746-
continueOnError: true
740+
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/release')
747741
inputs:
748742
BuildDropPath: $(Build.ArtifactStagingDirectory)
749743

@@ -840,8 +834,7 @@ jobs:
840834
filePath: scripts/release/rpm/pipeline.sh
841835
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
842836
displayName: 'SBOM'
843-
condition: eq(variables['Build.Reason'], 'BatchedCI')
844-
continueOnError: true
837+
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/release')
845838
inputs:
846839
BuildDropPath: $(Build.ArtifactStagingDirectory)
847840
- task: PublishPipelineArtifact@0
@@ -969,8 +962,7 @@ jobs:
969962

970963
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
971964
displayName: 'SBOM'
972-
condition: eq(variables['Build.Reason'], 'BatchedCI')
973-
continueOnError: true
965+
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/release')
974966
inputs:
975967
BuildDropPath: $(Build.ArtifactStagingDirectory)
976968

eastus2.json

Whitespace-only changes.

src/azure-cli-core/azure/cli/core/commands/arm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ def assign_identity(cli_ctx, getter, setter, identity_role=None, identity_scope=
787787
parameters=parameters)
788788
break
789789
except HttpResponseError as ex:
790-
if 'role assignment already exists' in ex.message:
790+
if ex.error.code == 'RoleAssignmentExists':
791791
logger.info('Role assignment already exists')
792792
break
793793
if retry_time < retry_times and ' does not exist in the directory ' in ex.message:

src/azure-cli/azure/cli/command_modules/acs/_params.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@
259259
]
260260

261261
# azure container storage
262+
container_storage_versions = [
263+
"1",
264+
"2"
265+
]
266+
262267
storage_pool_types = [
263268
CONST_STORAGE_POOL_TYPE_AZURE_DISK,
264269
CONST_STORAGE_POOL_TYPE_EPHEMERAL_DISK,
@@ -516,6 +521,7 @@ def load_arguments(self, _):
516521
)
517522
c.argument(
518523
"container_storage_version",
524+
arg_type=get_enum_type(container_storage_versions),
519525
help="set azure container storage version, the latest version will be installed by default",
520526
)
521527
c.argument(
@@ -724,6 +730,7 @@ def load_arguments(self, _):
724730
)
725731
c.argument(
726732
"container_storage_version",
733+
arg_type=get_enum_type(container_storage_versions),
727734
help="set azure container storage version, the latest version will be installed by default",
728735
)
729736
c.argument(

src/azure-cli/azure/cli/command_modules/acs/_roleassignments.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def add_role_assignment(cmd, role, service_principal_msi_id, is_service_principa
118118
)
119119
break
120120
except HttpResponseError as ex:
121-
if isinstance(ex, ResourceExistsError) or "The role assignment already exists." in ex.message:
121+
if isinstance(ex, ResourceExistsError) or ex.error.code == 'RoleAssignmentExists':
122122
break
123123
logger.info(ex.message)
124124
except Exception as ex: # pylint: disable=broad-except

0 commit comments

Comments
 (0)