[confcom] Add a --with-containers flag to policy and fragment gen#9409
[confcom] Add a --with-containers flag to policy and fragment gen#9409kairu-ms merged 13 commits intoAzure:mainfrom
--with-containers flag to policy and fragment gen#9409Conversation
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| confcom acifragmentgen | cmd confcom acifragmentgen added parameter container_definitions |
||
| confcom acipolicygen | cmd confcom acipolicygen added parameter container_definitions |
|
Hi @DomAyre, |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
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). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
|
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for specifying container definitions directly via a new --with-containers parameter, enabling policy generation without requiring ARM templates, YAML files, or image names as input sources.
Key changes:
- Introduces dataclass-based policy structure definitions in a new
lib/policy.pymodule - Extends policy generation commands to accept container definitions as JSON strings
- Updates source validation logic to recognize container definitions as a valid input type
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/policy.py | New module defining dataclass structures for Container, Policy, Fragment, and related configuration objects |
| security_policy.py | Adds container_definitions parameter and serializes them into the policy output |
| custom.py | Updates acipolicygen_confcom and acifragmentgen_confcom to handle container_definitions input |
| _validators.py | Extends source validation to include container_definitions as a valid input option |
| _params.py | Adds --with-containers argument definition to both acipolicygen and acifragmentgen commands |
| .gitignore | Excludes the lib/ directory from being ignored |
|
[Release] Update index.json for extension [ confcom ] : https://dev.azure.com/msazure/One/_build/results?buildId=143411526&view=results |
Why
We currently have a custom input json format to describe containers to be permitted in a policy. This can be used by acipolicygen and acifragmentgen.
This json is basically the same as the final container definition in the policy except it's arbitrarily different, e.g. "env_rules" vs "environmentVariables".
Therefore it would make more sense to just be able to supply the container definition directly. In future PRs we will provide tools to generate these from inputs such as arm_templates.
How
--with-containersto acipolicygen and acifragmentgenThis checklist is used to make sure that common guidelines for a pull request are followed.
Related command
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)