-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[confcom] Add containers from_image command #9505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
### Why Addresses - Azure#9222 ### How - [x] Update the code to restore the "attach to first image in input" behaviour - [x] Add two new commands: `fragment push` and `fragment attach` to allow the user to explicitly do one or the other (or both!) - [x] Add new tests which run a local docker registry, and test that the fragments are generated, signed, pushed and attached as expected (as well as the default behaviour) --- This checklist is used to make sure that common guidelines for a pull request are followed. ### Related command <!--- Please provide the related command with az {command} if you can, so that we can quickly route to the related person to review. ---> ### General Guidelines - [x] Have you run `azdev style <YOUR_EXT>` locally? (`pip install azdev` required) - [x] Have you run `python scripts/ci/test_index.py -q` locally? (`pip install wheel==0.30.0` required) - [x] My extension version conforms to the [Extension version schema](https://github.com/Azure/azure-cli/blob/release/doc/extensions/versioning_guidelines.md)
This reverts commit e8f7637.
Addresses - Azure#9222 - [x] Update the code to restore the "attach to first image in input" behaviour - [x] Add two new commands: `fragment push` and `fragment attach` to allow the user to explicitly do one or the other (or both!) - [x] Add new tests which run a local docker registry, and test that the fragments are generated, signed, pushed and attached as expected (as well as the default behaviour) --- This checklist is used to make sure that common guidelines for a pull request are followed. <!--- Please provide the related command with az {command} if you can, so that we can quickly route to the related person to review. ---> - [x] Have you run `azdev style <YOUR_EXT>` locally? (`pip install azdev` required) - [x] Have you run `python scripts/ci/test_index.py -q` locally? (`pip install wheel==0.30.0` required) - [x] My extension version conforms to the [Extension version schema](https://github.com/Azure/azure-cli/blob/release/doc/extensions/versioning_guidelines.md)
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| confcom containers | sub group confcom containers added |
|
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.
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 adds a new confcom containers from_image command that generates a partial container policy definition based on an input container image. The command inspects Docker images to extract configuration details (layers, environment variables, commands, working directory) and combines them with platform-specific mounts to produce a security policy container definition.
Key Changes:
- Adds new CLI command
az confcom containers from_imagewith image inspection capabilities - Implements image layer extraction using dmverity-vhd binary
- Creates comprehensive test suite with multiple sample Dockerfiles and expected outputs
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
setup.py |
Bumps extension version from 1.5.0 to 1.6.0 |
azext_confcom/lib/platform.py |
Defines platform-specific mounts (ACI) for container definitions |
azext_confcom/lib/images.py |
Implements image inspection logic to extract layers and configuration |
azext_confcom/lib/containers.py |
Generates container definitions by combining image data with platform mounts |
azext_confcom/command/containers_from_image.py |
Main command implementation that outputs JSON container definition |
azext_confcom/custom.py |
Registers the new command in the extension's custom commands |
azext_confcom/commands.py |
Adds command group registration for containers subcommands |
azext_confcom/_params.py |
Defines command parameters (image and platform) |
azext_confcom/_help.py |
Adds help documentation for the new command group and command |
azext_confcom/tests/latest/test_confcom_containers_from_image.py |
Comprehensive parametrized tests for the new command |
samples/images/*/Dockerfile |
Sample Dockerfiles for testing different scenarios |
samples/images/*/aci_container.inc.rego |
Expected container definition outputs for each sample |
linter_exclusions.yml |
Adds linter exclusion for positional parameter in new command |
|
[Release] Update index.json for extension [ confcom ] : https://dev.azure.com/msazure/One/_build/results?buildId=149572392&view=results |
Why
This command generates a partial container policy based on an input container image
How
--with-containers#9428 to merge for policy comparison)Testing
Since PRs in my fork won't run the full suite of tests, I create a draft PR onto main of the Azure repo to get test results:
This 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)