Skip to content

Conversation

@SethHollandsworth
Copy link
Contributor

refactoring policy generation code via -i

Previously the --input flags for acifragmentgen and acipolicygen used two different functions. This consolidates those and fixes a bug that excluded the option for scenario to be used for `acipolicygen.

This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

az confcom

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Copilot AI review requested due to automatic review settings June 5, 2025 20:24
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jun 5, 2025

️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the policy generation functions and updates container image references while addressing a bug with the scenario field. Key changes include:

  • Consolidation of input functions (replacing load_policy_from_str with load_policy_from_json_file/load_policy_from_json) and parameter type updates.
  • Updates of container image references to new azurelinux versions and associated adjustments in tests and examples.

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/confcom/setup.py Updated version from 1.2.4 to 1.2.5
src/confcom/samples/* Updated fragment JSON and image references
src/confcom/azext_confcom/tests/* Replaced load_policy_from_str with load_policy_from_json and updated image names and minimum_svn types
src/confcom/custom.py Changed input function call from load_policy_from_file to load_policy_from_json_file
src/confcom/azext_confcom/oras_proxy.py Updated parameter type for minimum_svn
src/confcom/azext_confcom/cose_proxy.py Updated generate_import_from_path’s minimum_svn parameter type
src/confcom/azext_confcom/README.md and HISTORY.rst Updated examples and version details
Comments suppressed due to low confidence (3)

src/confcom/custom.py:117

  • Replacing load_policy_from_file with load_policy_from_json_file improves consistency with other modules; please ensure all related documentation and downstream calls are updated accordingly.
container_group_policies = security_policy.load_policy_from_json_file(input_path, debug_mode=debug_mode, infrastructure_svn=infrastructure_svn, ...)

src/confcom/azext_confcom/oras_proxy.py:178

  • The parameter type for 'minimum_svn' has been updated from int to str across the codebase; please verify that downstream functions and integrations expect a string, and update documentation to reflect this change.
def generate_imports_from_image_name(image_name: str, minimum_svn: str) -> List[dict]:

src/confcom/azext_confcom/cose_proxy.py:146

  • Updating the 'minimum_svn' parameter type from int to str in this function is a significant design change; please verify that all consumers of this API are adjusted to handle the new type.
def generate_import_from_path(self, fragment_path: str, minimum_svn: str) -> str:

@yonzhan
Copy link
Collaborator

yonzhan commented Jun 5, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link

github-actions bot commented Jun 5, 2025

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@github-actions
Copy link

github-actions bot commented Jun 5, 2025

@yonzhan yonzhan requested a review from kairu-ms June 5, 2025 23:16
@yonzhan yonzhan requested a review from jsntcy June 5, 2025 23:16
@kairu-ms kairu-ms merged commit 79f6051 into Azure:main Jun 9, 2025
26 checks passed
@azclibot
Copy link
Collaborator

azclibot commented Jun 9, 2025

[Release] Update index.json for extension [ confcom ] : https://dev.azure.com/msazure/One/_build/results?buildId=126641555&view=results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants