-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[ContainerRegistry] Add 'acrcssc' extension for public preview #8530
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
Merged
Merged
Changes from all commits
Commits
Show all changes
204 commits
Select commit
Hold shift + click to select a range
d9e88db
add code for cssc
pwalecha cdb363c
# Correct the Delete repository method - it is only deleting Tag
pwalecha b1f89dc
update new yamls
pwalecha a898153
add support for streaming logging as well
pwalecha 5a0ce0d
add support for logging
pwalecha 7b86532
add support for streamed logs only giving acr-cli logs
pwalecha 5c783c9
Delete old files
pwalecha 968fafd
fix dry run
pwalecha d7538ba
remove redundant files
pwalecha add2048
simplify print code
pwalecha 71680a3
add user confirmation before deletion
cegraybl dbd5113
Merge branch 'users/puwalech/acrcssc' of https://github.com/pwalecha/…
cegraybl be52009
allow update to be done on cadence or config (or both)
cegraybl 1848240
fix:
pwalecha 8a72e2d
merge latest
pwalecha 94403bb
remove redundant code
pwalecha 69788e2
add template file paths to the extension build
cegraybl 8919cb8
Merge branch 'users/puwalech/acrcssc' of https://github.com/pwalecha/…
cegraybl 2bfad35
fix minor bugs:
pwalecha e04fd35
fix update issue
pwalecha 63cd2f9
update from warning to print
pwalecha 13b1373
fix:
pwalecha 84fc89e
fix minor issues, supress stderror from acr login
cegraybl d9360b3
add logging for better experience
pwalecha 01667f2
Merge branch 'users/puwalech/acrcssc' of https://github.com/pwalecha/…
pwalecha f535211
remove redundant line
pwalecha f0e71c3
fix minor bugs:
pwalecha d48e9d7
update yaml for trigger task to 0.11, update filter parameter for dryrun
cegraybl ffa4998
fix acr-cli version and env variable for dryrun yaml
cegraybl e87f0ec
fix alot of style checks, some pylint issues
cegraybl f96a295
fix linter issue with missing help
cegraybl 6dcbbbd
use download logs for dry_run
pwalecha 90147ea
Merge branch 'users/puwalech/acrcssc_v2' of https://github.com/pwalec…
pwalecha 081dda3
Fix temporary directory creation
pwalecha 12e5bc4
add more unit test cases
pwalecha b1b8603
add a sample scenario test
pwalecha 5d9834a
fix minor verbiage issues
pwalecha abb0683
fix issue where the 'supply-chain' section is not marked as 'preview'…
cegraybl cea7d4f
use the Task client to get values for OS & platform from the centrali…
cegraybl a028585
fix another handful of lint and style issues
cegraybl 6570d07
add a scenario test.
pwalecha 4537b3e
Merge branch 'users/puwalech/acrcssc_v2' of https://github.com/pwalec…
pwalecha 946ab51
fix pylint issues
pwalecha 51b795b
update task yaml files, update version to use latest cssc acr-cli image
cegraybl 22d0d4d
fix per review comments:
pwalecha ad12541
merge latest
pwalecha 7cefb1b
update to initial version
pwalecha 32fb023
update to the same initial version
pwalecha b5b2f86
fix the build issues
pwalecha 1d81086
Fix style issue
pwalecha 4bbc6b5
comment failing test case
pwalecha ef073ad
fix the style issue
pwalecha 0080d77
fix breaking unit test cases
pwalecha 49df558
fix the dry-run yaml
pwalecha b7c1cde
fix 28610631, improve output message to list a specific cli command t…
cegraybl 537eac6
fix 28610548: create with dry run will now check if the workflow alre…
cegraybl caea45f
add timeout for 60 minutes
pwalecha 38e1a8e
fix 28610649, re-running workflow delete after a failed deletion shou…
cegraybl 507d8be
standardize string replacement in the extension
cegraybl f1e4209
Multiple bug fixes in yamls related to patch failing with repos havin…
b2706a4
Changes to skip patching if image has eosl=true and fixed some other …
d422e09
Merge branch 'users/puwalech/acrcssc_v2' of https://github.com/pwalec…
pwalecha 8d51d2a
fix breaking test case
pwalecha f664af9
Remove help for dry-run
pwalecha d93502f
fix style issues
pwalecha f1adf73
fix linter and style issues
pwalecha f1aa1b0
increase copatimeout to 30 m
pwalecha d553231
Update help for cadence.
pwalecha 641705d
Update recommendation message to reflect max value of cadence
pwalecha 2b107e2
Merge pull request #1 from pwalecha/users/puwalech/acrcssc_v2
cegraybl faaa49a
adding another echo in scan yaml with standard output for list comman…
4f7f1ab
feat(phase 1.5): WI 29146137 (#3)
cegraybl f700cf1
Added implementation for incremental patch tags
837dd80
Fixed the task yaml to default to floating tag convention when tag co…
529454b
Removed extra line
e93501a
Removed extra white spaces
d1784b5
Skip checking the new patch tag to be greate than 999 when value is p…
63ece18
Removed old comment
910afb3
Update output to include both found and not found repos and tags
9384ced
Add extended scope commands to base CSSC extension (#4)
cegraybl 2e62ddc
bump extension version to 1.1.0, reflect changes in configuration and…
cegraybl 97525cc
fix the return values for 'list' command, allows output to be transfo…
cegraybl 0e2c3cf
Merge pull request #1 from cegraybl/cssc_v2
cegraybl 108e612
Merge pull request #2 from cegraybl/cssc_v3
cegraybl 2b93e84
improve reading for validation error
cegraybl 1f1aeb8
fix typo on constant name
cegraybl 7dcfd21
Updated cssc image versions containing the changed default behavior f…
9e412ae
fix(doc): update help text to indicate change in config defaults, bum…
cegraybl 20913fd
Multiple db support added for trivy + fixed a bug with default tag co…
3e0d634
bump extension version ot indicate change
cegraybl abf9a8d
Merge branch 'cegraybl/cssc_phase_1.5' of https://github.com/AzureCR/…
cegraybl 1f6ae0e
fix bug 30839968, 'show' command does not filter non-cssc tasks befor…
cegraybl e16ef40
add a nextOccurrence field to the task trigger task, calculated on cl…
cegraybl ede46dc
fix issue during 'list' with status filtering
cegraybl 2363454
fix data type issue when filtering via status, fixes 30942760
cegraybl 7fc946f
Merge branch 'cegraybl/cssc_phase_1.5' of https://github.com/AzureCR/…
cegraybl 70ef5b1
rename key skipped_patch_reason to patch_skipped_reason
cegraybl fd15160
split the task state 'canceled' from 'failed', so it is its own posib…
cegraybl 32b2760
Added retries for dependency calls
10ea0d5
Merge pull request #7 from AzureCR/cegraybl/cssc_31038071
cegraybl 4358214
Added timeout in copa patch
13480c3
Added a missing slash
4bf877f
Merge pull request #9 from AzureCR/ruchi/BugFixForTrivyIntermittentIs…
Ruchii-27 a7b0007
Merge pull request #6 from AzureCR/cegraybl/cssc_30943055
cegraybl 006ca61
Adding a max limit of 100 images allowed for continuous patching
b808ee4
Merge pull request #10 from AzureCR/ruchi/LimitMaxConcurrentScans
Ruchii-27 7432f7d
add initial support for patch and scan errors
cegraybl 1f28380
Removed unwanted vuln upload step and list output file step, also mov…
a43de4b
A few more cleanups and updates to make the message consistent
be4f1ba
Removed comments and increased retry delay
d4be7b8
retrieve multiple line of unique errors
cegraybl 5a17af6
sort error messages to make the output depeterministic
cegraybl 06f2789
add comments and rename structure for clarity
cegraybl 6e07dbb
making "and patch" optional to ensure both old and new logs continue …
d13a7f5
Merge pull request #11 from AzureCR/ruchi/CleanUpPatchTask
Ruchii-27 5672f53
Trigger Task updated to perform scans in batches of 10
e872fac
retrieve task run via runId when not found on original list of retrie…
cegraybl a6f6f3e
Merge pull request #12 from AzureCR/cegraybl/cssc_31196178_error_reason
cegraybl 746318c
add unittests for schedule converters, fix some corner cases
cegraybl 951d5ba
fix the mock for the 'get_logs' unit test, work still pending
cegraybl af48958
Merge pull request #14 from AzureCR/ruchi/BatchSchedulingScanTasks
Ruchii-27 4ed84ad
Updated the error message as per the PRD
aa71ff9
minor update to error message
8279bcb
fix a set of style and lint issues
cegraybl 4c49e89
fix remaining style issues
cegraybl 777c4bb
Merge pull request #15 from AzureCR/ruchi/UpdateErrorMessage
Ruchii-27 382bebd
Updated cssc image version to enable WF to use latest copa and trivy …
093ce3b
Merge pull request #16 from AzureCR/ruchi/UpdateCsscImgVersion
Ruchii-27 29b8462
saving changes, tests not done yet
cegraybl 9c9ff52
save more changes, most of the test cases work now
cegraybl 790d91b
add more variations to 'test_from_taskrun'
cegraybl 8ccc275
fix asserts for test_generate_logs
cegraybl 009888c
save work for unit tests
cegraybl 7eeebb5
add an option to update all tasks yamls throught an ARM redeploy
cegraybl d6cb7e6
switch the feature to silently check and redeploy the tasks if the de…
cegraybl 2919af7
remove incorrect parameter from deployment's LongRunningOperation
cegraybl da4b689
address review comments
cegraybl 3657b4e
Update src/acrcssc/azext_acrcssc/helper/_taskoperations.py
cegraybl 6078314
move extension entry tests to future PR
cegraybl daf93b2
address issues found by copilot
cegraybl 3c4a383
remove information from compare log
cegraybl be2b3c0
Added retries for intermittent auth issues observed from ARM during a…
4a2e72e
Refreshing credentials on retries to handle intermittent authz issues…
71de8b8
Merge pull request #22 from AzureCR/AddRetriesForARMIssue
Ruchii-27 af00989
cssc image update to use source policy
07151fe
Merge pull request #23 from AzureCR/SourcePolicyPoc
Ruchii-27 7b7a949
Changes to pull buildkit from cached image in buildhost instead of do…
c2e5160
Merge pull request #24 from AzureCR/PullBuildkitFromMCR
Ruchii-27 cf8d3c2
change update/override task behavior away from ARM deployment to use …
cegraybl 4d05050
update _update* functions signature, use LongRunningOperation for cli…
cegraybl d15e270
remove decieving debug message
cegraybl 30c1ba4
Merge pull request #21 from AzureCR/cegraybl/cssc_30926545_unittest
cegraybl d19a752
add an option to update all tasks yamls throught an ARM redeploy
cegraybl 1587015
switch the feature to silently check and redeploy the tasks if the de…
cegraybl 59cd4c3
remove incorrect parameter from deployment's LongRunningOperation
cegraybl 2eebe33
address review comments
cegraybl f9a1b11
Update src/acrcssc/azext_acrcssc/helper/_taskoperations.py
cegraybl 4ac41e6
change update/override task behavior away from ARM deployment to use …
cegraybl 71c2456
update _update* functions signature, use LongRunningOperation for cli…
cegraybl 526a0c9
remove decieving debug message
cegraybl 4a05db4
Merge branch 'feature/cssc_ext' into cegraybl/cssc_31231619_update_ta…
cegraybl a0a213a
add fix for bug 31646863
cegraybl 7f2a44e
Merge branch 'cegraybl/cssc_31231619_update_task_yaml' of https://git…
cegraybl b29e2ff
Merge pull request #13 from AzureCR/cegraybl/cssc_31231619_update_tas…
cegraybl 7054886
add initial check up for image limit using dryrun task
cegraybl 6659821
fix log message, remove post fix log from dry-run execution
cegraybl bcf4508
remove dryrun statements from error when image limit is reached, atte…
cegraybl 5fc0eb4
change log error to exception, remove duplicate call
cegraybl f7247cb
add additional check for temp file management
cegraybl dff903a
address review comments
cegraybl 03eb29c
add additional error checking when modifying the logger level
cegraybl 3c83455
Add log message when retrieving configuration from registry
cegraybl d5e1639
fix issues with configuration handling, make image limit check to ru…
cegraybl af6f182
remove dots from validation message, spinner already includes them
cegraybl dbfb3fd
resolve comment on possible using acr_archive_utils_logger_level befo…
cegraybl dafed5b
remove debug comment
cegraybl b9814a5
Merge pull request #20 from AzureCR/cegraybl/cssc_31229526_image_limi…
cegraybl 9f20733
remove LongRunningOperation wrapper around task update to avoid polle…
cegraybl e68da31
Merge pull request #26 from AzureCR/cegraybl/cssc_31670277_remove_lon…
cegraybl 9294174
added validation for tag-convention allowed values
8035585
Moved version validation check to schema validation and fixed the tag…
a007578
Taking copilots suggestion for exact match
37788cc
Merge pull request #28 from AzureCR/ruchi/FixCLIBugForTagConvention
Ruchii-27 49e9d97
When no matching images are found, inform the user instead of continu…
44cc40d
Merge pull request #30 from AzureCR/ruchi/FixCLIBugWhen0MatchingImages
Ruchii-27 db2361c
test(cssc): 30926545 add Scenario test for extension, fix style issue…
cegraybl 6686d6f
fix(cssc): 31695069 Enhanced repositories schema validation + added t…
Ruchii-27 62d9c4b
fix(cssc): 31694510, 31694600 Check for existence of cssc tasks befor…
Ruchii-27 bbba72c
fix(cssc): 31694592 Added validations to ensure dry run and run immed…
Ruchii-27 355404a
fix(cssc): 31731403 Allow generate_logs poller to timeout (#36)
cegraybl ec542cd
feat(cssc): 31807191 change role assignment for CSSC tasks to 'Contai…
cegraybl d4ce22d
fix(cssc): 31670352 add check for empty token for authentication (1/n…
cegraybl 0c8b937
fix(cssc): 31646926 fix 'list' command filtering by '--run-status' (#40)
cegraybl 6563fe1
fix(cssc): 31670352 Upgrade oras-py package to use new auth flow 2/n …
cegraybl 9bfaab1
fix(cssc): 31250186 address all comments in public repo PR (redo comm…
cegraybl 692e008
fix(cssc): 32041020 32044747 push oci artifact before deploying task …
cegraybl 337b453
fix(cssc): 31250186 address partial comments in public repo PR 202504…
cegraybl b5a9184
fix(cssc): 31250186 address partial comments in public repo PR 202504…
cegraybl 248c8fc
fix(cssc): 31250186 remove secrets from recording (#49)
cegraybl 369c0d5
fix(cssc): 31250186 fix pipeline issues (#51)
cegraybl 5796394
fix(cssc): 31250186 fix help text (#52)
cegraybl cfb8ecb
fix(cssc): 31250186 remove the explicit 'required=False' under _param…
cegraybl 277bba4
fix(cssc): 31250186 fix call to list_scan_status after function sign…
cegraybl f5612d4
fix(cssc): 31250186 address comments on versioning #8690 (#56)
cegraybl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| .. :changelog: | ||
|
|
||
| Release History | ||
| =============== | ||
|
|
||
| 1.0.0b1 | ||
| ++++++ | ||
| * Release for Public Preview | ||
| * Added `list`and `cancel-run` commands for workflows | ||
| * `list` command provide output on the scan and patch status of the registry | ||
| * `cancel-run` command allows to canceling all running scan and patch tasks | ||
|
|
||
|
|
||
| 0.1.0b1 | ||
| ++++++ | ||
| * Initial release for Private Preview |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| Microsoft Azure CLI 'acrcssc' Extension | ||
| ========================================== | ||
|
|
||
| Azure Container Registry - Container Secure Supply Chain (Continuous Patching) | ||
| ========================================== | ||
|
|
||
| Overview | ||
| ======== | ||
| The `acrcssc` extension for Azure CLI provides continuous patching capabilities for Azure Container Registry (ACR). This extension helps automate the process of scanning and patching container images to ensure they are up-to-date with the latest security patches. Scans your configured list of images for vulnerabilities (CVEs) using Trivy and patch them using Copacetic. | ||
|
|
||
| Preview Limitations | ||
| =================== | ||
| Continuous Patching is currently in preview. The following limitations apply: | ||
|
|
||
| - Windows-based container images aren’t supported | ||
| - Only "OS-level" vulnerabilities will be patched. This includes packages in the image managed by a package manager such as “apt” and “yum”. Vulnerabilities at the “application level” are unable to be patched, such as compiled languages like Go, Python, NodeJS | ||
| - Patching is only supported in Public regions, not in Sovereign regions | ||
| - CSSC patching is not supported for registries or in regions where Tasks are unavailable. | ||
|
|
||
| Features | ||
| ======== | ||
| - **Continuous Patching Workflow**: Automates the process of scanning and patching container images. | ||
| - **Task Management**: Create, update, delete, show, and cancel continuous patch tasks in the registry. | ||
| - **Dry Run Mode**: Validate the configuration without making any changes. | ||
| - **Immediate Run**: Trigger the patching workflow immediately. | ||
| - **Run Status**: Monitor the status of the scanning and patching tasks. | ||
|
|
||
| Commands | ||
| ======== | ||
| - `az acr supply-chain workflow create`: Create a continuous patch task in the registry. | ||
| - `az acr supply-chain workflow update`: Update an existing continuous patch task. | ||
| - `az acr supply-chain workflow delete`: Delete a continuous patch task. | ||
| - `az acr supply-chain workflow list`: List all continuous patch tasks in the registry. | ||
| - `az acr supply-chain workflow show`: Show details of a specific continuous patch task. | ||
| - `az acr supply-chain workflow cancel-run`: Cancel all running scan and patch tasks. | ||
|
|
||
| Usage | ||
| ===== | ||
| 1. **Create a Continuous Patch Task**: | ||
| ```sh | ||
| az acr supply-chain workflow create --resource-group <resource-group> --registry <registry-name> --type continuouspatchv1 --schedule <schedule> --config <config-file> | ||
| ``` | ||
|
|
||
| 1. **Update a Continuous Patch Task**: | ||
| ```sh | ||
| az acr supply-chain workflow update --resource-group <resource-group> --registry <registry-name> --type continuouspatchv1 --schedule <schedule> --config <config-file> | ||
| ``` | ||
|
|
||
| 1. **Update with dryrun to test configuration changes**: | ||
| ```sh | ||
| az acr supply-chain workflow update --resource-group <resource-group> --registry <registry-name> --type continuouspatchv1 --config <config-file> --dryrun | ||
| ``` | ||
|
|
||
| 1. **Delete a Continuous Patch Task**: | ||
| ```sh | ||
| az acr supply-chain workflow delete --resource-group <resource-group> --registry <registry-name> --type continuouspatchv1 | ||
| ``` | ||
|
|
||
| 1. **List Continuous Patch Tasks**: | ||
| ```sh | ||
| az acr supply-chain workflow list --resource-group <resource-group> --registry <registry-name> --type continuouspatchv1 --run-status <status> | ||
| ``` | ||
|
|
||
| 1. **Show a Continuous Patch Task**: | ||
| ```sh | ||
| az acr supply-chain workflow show --resource-group <resource-group> --registry <registry-name> --type continuouspatchv1 | ||
| ``` | ||
|
|
||
| 1. **Cancel all Scan and Patch Running Tasks**: | ||
| ```sh | ||
| az acr supply-chain workflow cancel-run --resource-group <resource-group> --registry <registry-name> --type continuouspatchv1 | ||
| ``` | ||
|
|
||
| Configuration | ||
| ============= | ||
| The configuration file for the continuous patch task should define the repositories to be scanned and patched, the schedule for the task, and any other relevant settings. | ||
|
|
||
| Example Configuration: | ||
|
|
||
| ```JSON | ||
| { | ||
| "repositories": [ | ||
| { | ||
| "repository": "alpine", | ||
| "tags": ["tag1", "tag2"], | ||
| "enabled": true | ||
| }, | ||
| { | ||
| "repository": "python", | ||
| "tags": ["*"], | ||
| "enabled": false | ||
| } | ||
| ], | ||
| "version": "v1", | ||
| "tag-convention": "floating" | ||
| } | ||
| ``` | ||
|
|
||
| Tag Convention | ||
| ============== | ||
| The `tag-convention` property in the configuration file determines how the tags for patched images are managed. It can have the following values: | ||
|
|
||
| - **incremental**: This is the default behavior. It increases the patch version of the tag. For example, if the original tag is `1.0`, the patched tags will be `1.0-1`, `1.0-2`, etc. | ||
| - **floating**: This reuses the tag postfix `patched` for patching. For example, if the original tag is `1.0`, the patched tag will be `1.0-patched`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| from azure.cli.core import AzCommandsLoader | ||
|
|
||
| from azext_acrcssc._help import helps # pylint: disable=unused-import | ||
|
|
||
|
|
||
| class AcrcsscCommandsLoader(AzCommandsLoader): | ||
|
|
||
| def __init__(self, cli_ctx=None): | ||
| from azure.cli.core.commands import CliCommandType | ||
| from azext_acrcssc._client_factory import cf_acr | ||
| acrcssc_custom = CliCommandType( | ||
| operations_tmpl='azext_acrcssc.custom#{}', | ||
| client_factory=cf_acr) | ||
| super(AcrcsscCommandsLoader, self).__init__(cli_ctx=cli_ctx, | ||
| custom_command_type=acrcssc_custom) | ||
|
|
||
| def load_command_table(self, args): | ||
| from azext_acrcssc.commands import load_command_table | ||
| load_command_table(self, args) | ||
| return self.command_table | ||
|
|
||
| def load_arguments(self, command): | ||
| from azext_acrcssc._params import load_arguments | ||
| load_arguments(self, command) | ||
|
|
||
|
|
||
| COMMAND_LOADER_CLS = AcrcsscCommandsLoader |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| from azure.cli.core.commands.client_factory import get_mgmt_service_client | ||
| from azure.cli.core.profiles import ResourceType | ||
| from azure.mgmt.containerregistry import ContainerRegistryManagementClient | ||
| from .helper._constants import ( | ||
| ACR_API_VERSION_2023_01_01_PREVIEW, | ||
| ACR_API_VERSION_2019_06_01_PREVIEW | ||
| ) | ||
|
|
||
| from azure.mgmt.authorization import AuthorizationManagementClient | ||
|
|
||
|
|
||
| def cf_acr(cli_ctx, *_) -> ContainerRegistryManagementClient: | ||
| return get_mgmt_service_client(cli_ctx, | ||
| ResourceType.MGMT_CONTAINERREGISTRY, | ||
| api_version=ACR_API_VERSION_2023_01_01_PREVIEW) | ||
|
|
||
|
|
||
| def cf_acr_registries(cli_ctx, *_) -> ContainerRegistryManagementClient: | ||
| return get_mgmt_service_client(cli_ctx, | ||
| ResourceType.MGMT_CONTAINERREGISTRY, | ||
| api_version=ACR_API_VERSION_2023_01_01_PREVIEW).registries | ||
|
|
||
|
|
||
| def cf_acr_tasks(cli_ctx, *_): | ||
| return get_mgmt_service_client(cli_ctx, | ||
| ResourceType.MGMT_CONTAINERREGISTRY, | ||
| api_version=ACR_API_VERSION_2019_06_01_PREVIEW).tasks | ||
|
|
||
|
|
||
| def cf_acr_registries_tasks(cli_ctx, *_): | ||
| return get_mgmt_service_client(cli_ctx, | ||
| ResourceType.MGMT_CONTAINERREGISTRY, | ||
| api_version=ACR_API_VERSION_2019_06_01_PREVIEW).registries | ||
|
|
||
|
|
||
| def cf_acr_taskruns(cli_ctx, *_): | ||
| return get_mgmt_service_client(cli_ctx, | ||
| ResourceType.MGMT_CONTAINERREGISTRY, | ||
| api_version=ACR_API_VERSION_2019_06_01_PREVIEW).task_runs | ||
|
|
||
|
|
||
| def cf_acr_runs(cli_ctx, *_): | ||
| return get_mgmt_service_client(cli_ctx, | ||
| ResourceType.MGMT_CONTAINERREGISTRY, | ||
| api_version=ACR_API_VERSION_2019_06_01_PREVIEW).runs | ||
|
|
||
|
|
||
| def cf_resources(cli_ctx, subscription_id=None): | ||
| return get_mgmt_service_client(cli_ctx, | ||
| ResourceType.MGMT_RESOURCE_RESOURCES, | ||
| subscription_id=subscription_id) | ||
|
|
||
|
|
||
| def cf_authorization(cli_ctx, subscription_id=None) -> AuthorizationManagementClient: | ||
| return get_mgmt_service_client(cli_ctx, | ||
| ResourceType.MGMT_AUTHORIZATION, | ||
| subscription_id=subscription_id, api_version="2022-04-01") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # coding=utf-8 | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
|
|
||
| from knack.help_files import helps # pylint: disable=unused-import | ||
|
|
||
| helps['acr supply-chain'] = """ | ||
| type: group | ||
| short-summary: Commands to manage acr supply chain resources. | ||
| """ | ||
|
|
||
| helps['acr supply-chain workflow'] = """ | ||
| type: group | ||
| short-summary: Commands to manage acr supply chain workflows. | ||
| """ | ||
|
|
||
| helps['acr supply-chain workflow create'] = """ | ||
| type: command | ||
| short-summary: Create acr supply chain workflow. | ||
| examples: | ||
| - name: Create acr supply chain workflow | ||
| text: az acr supply-chain workflow create -r $MyRegistry -g $MyResourceGroup \ | ||
| --type continuouspatchv1 --schedule 1d --config path-to-config-file | ||
| """ | ||
| helps['acr supply-chain workflow update'] = """ | ||
| type: command | ||
| short-summary: Update acr supply chain workflow. | ||
| examples: | ||
| - name: Update acr supply chain workflow | ||
| text: az acr supply-chain workflow update -r $MyRegistry -g $MyResourceGroup --type \ | ||
| continuouspatchv1 --schedule 1d --config path-to-config-file | ||
| """ | ||
|
|
||
| helps['acr supply-chain workflow show'] = """ | ||
| type: command | ||
| short-summary: Show acr supply chain workflow tasks. | ||
| examples: | ||
| - name: Show all acr supply chain workflow | ||
| text: az acr supply-chain workflow show -r $MyRegistry -g $MyResourceGroup --type continuouspatchv1 | ||
| """ | ||
|
|
||
| helps['acr supply-chain workflow delete'] = """ | ||
| type: command | ||
| short-summary: Delete acr supply chain workflow. | ||
| examples: | ||
| - name: Delete acr supply chain workflow and associated configuration files | ||
| text: az acr supply-chain workflow delete -r $MyRegistry -g $MyResourceGroup --type continuouspatchv1 | ||
| """ | ||
|
|
||
| helps['acr supply-chain workflow cancel-run'] = """ | ||
| type: command | ||
| short-summary: Cancel currently running supply chain workflow. | ||
| examples: | ||
| - name: Cancel currently running acr supply chain workflow scans/patch | ||
| text: az acr supply-chain workflow cancel-run -r $MyRegistry -g $MyResourceGroup --type continuouspatchv1 | ||
| """ | ||
|
|
||
| helps['acr supply-chain workflow list'] = """ | ||
| type: command | ||
| short-summary: List status of acr supply chain workflow images. | ||
| examples: | ||
| - name: List all acr supply chain workflow images based on the status provided | ||
| text: az acr supply-chain workflow list -r $MyRegistry -g $MyResourceGroup --type continuouspatchv1 --run-status Failed | ||
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # -------------------------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
| # -------------------------------------------------------------------------------------------- | ||
| # pylint: disable=line-too-long | ||
| from azure.cli.command_modules.acr._constants import REGISTRY_RESOURCE_TYPE | ||
| from azure.cli.command_modules.acr._validators import validate_registry_name | ||
| from azure.cli.core import AzCommandsLoader | ||
| from azure.cli.core.commands.parameters import ( | ||
| get_resource_name_completion_list, | ||
| get_three_state_flag, get_enum_type, | ||
| resource_group_name_type | ||
| ) | ||
| from .helper._constants import CONTINUOUSPATCH_SCHEDULE_MAX_DAYS | ||
|
|
||
|
|
||
| def load_arguments(self: AzCommandsLoader, _): | ||
| from .helper._constants import CSSCTaskTypes | ||
| from .helper._workflow_status import WorkflowTaskState | ||
|
|
||
| with self.argument_context("acr supply-chain workflow") as c: | ||
| c.argument('resource_group', arg_type=resource_group_name_type, completer=get_resource_name_completion_list(REGISTRY_RESOURCE_TYPE)) | ||
| c.argument('registry_name', options_list=['--registry', '-r'], help='The name of the container registry. It should be specified in lower case. You can configure the default registry name using `az configure --defaults acr=<registry name>`', completer=get_resource_name_completion_list(REGISTRY_RESOURCE_TYPE), configured_default='acr', validator=validate_registry_name) | ||
| c.argument("workflow_type", arg_type=get_enum_type(CSSCTaskTypes), options_list=['--type', '-t'], help="Type of workflow task.", required=True) | ||
|
|
||
| with self.argument_context("acr supply-chain workflow create") as c: | ||
| c.argument("config", help="Configuration file path containing the json schema for the list of repositories and tags to filter within the registry. Schema example:{\"repositories\":[{\"repository\":\"alpine\",\"tags\":[\"tag1\",\"tag2\"],\"enabled\":true},{\"repository\":\"python\",\"tags\":[\"*\"],\"enabled\":false}], \"version\": \"v1\", \"tag-convention\": \"floating\"}. \"tag-convention\" is an optional property, values can be \"incremental\" (the default behavior, will increase the patch version of the tag, for example \"{repository}:{original-tag}-1\", \"{repository}:{original-tag}-2\", etc), or \"floating\" (will reuse the tag \"{repository}:{original-tag}-patched\" for patching)", required=True) | ||
| c.argument("schedule", help=f"schedule to run the scan and patching task. E.g. `<n>d` where <n> is the number of days between each run. Max value is {CONTINUOUSPATCH_SCHEDULE_MAX_DAYS}d.", required=True) | ||
| c.argument("run_immediately", help="Set this flag to trigger the immediate run of the selected workflow task. Default value: false.", arg_type=get_three_state_flag()) | ||
| c.argument("dryrun", options_list=["--dry-run"], help="Use this flag to see the qualifying repositories and tags that would be affected by the workflow. Default value: false. 'config' parameter is mandatory to provide with dry-run", arg_type=get_three_state_flag()) | ||
|
|
||
| with self.argument_context("acr supply-chain workflow update") as c: | ||
| c.argument("config", help="Configuration file path containing the json schema for the list of repositories and tags to filter within the registry. Schema example:{\"repositories\":[{\"repository\":\"alpine\",\"tags\":[\"tag1\",\"tag2\"],\"enabled\":true},{\"repository\":\"python\",\"tags\":[\"*\"],\"enabled\":false}], \"version\": \"v1\", \"tag-convention\": \"floating\"}. \"tag-convention\" is an optional property, values can be \"incremental\" (the default behavior, will increase the patch version of the tag, for example \"{repository}:{original-tag}-1\", \"{repository}:{original-tag}-2\", etc), or \"floating\" (will reuse the tag \"{repository}:{original-tag}-patched\" for patching)") | ||
| c.argument("schedule", help=f"schedule to run the scan and patching task. E.g. `<n>d` where n is the number of days between each run. Max value is {CONTINUOUSPATCH_SCHEDULE_MAX_DAYS}d.") | ||
| c.argument("run_immediately", help="Set this flag to trigger the immediate run of the selected workflow task. Default value: false.", arg_type=get_three_state_flag()) | ||
| c.argument("dryrun", options_list=["--dry-run"], help="Use this flag to see the qualifying repositories and tags that would be affected by the workflow. Default value: false. 'config' parameter is mandatory to provide with dry-run", arg_type=get_three_state_flag()) | ||
|
|
||
| with self.argument_context("acr supply-chain workflow list") as c: | ||
| c.argument("status", arg_type=get_enum_type(WorkflowTaskState), options_list=["--run-status"], help="Status to filter the supply-chain workflow image status.") | ||
|
|
||
| with self.argument_context("acr supply-chain workflow delete") as c: | ||
| c.argument("yes", options_list=["--yes", "-y"], help="Proceed with the deletion without user confirmation") |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.