|
| 1 | +# -------------------------------------------------------------------------------------------- |
| 2 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 3 | +# Licensed under the MIT License. See License.txt in the project root for license information. |
| 4 | +# -------------------------------------------------------------------------------------------- |
| 5 | +# pylint: disable=line-too-long |
| 6 | +from azure.cli.command_modules.acr._constants import REGISTRY_RESOURCE_TYPE |
| 7 | +from azure.cli.command_modules.acr._validators import validate_registry_name |
| 8 | +from azure.cli.core import AzCommandsLoader |
| 9 | +from azure.cli.core.commands.parameters import ( |
| 10 | + get_resource_name_completion_list, |
| 11 | + get_three_state_flag, get_enum_type, |
| 12 | + resource_group_name_type |
| 13 | +) |
| 14 | +from .helper._constants import CONTINUOUSPATCH_SCHEDULE_MAX_DAYS |
| 15 | + |
| 16 | + |
| 17 | +def load_arguments(self: AzCommandsLoader, _): |
| 18 | + from .helper._constants import CSSCTaskTypes |
| 19 | + from .helper._workflow_status import WorkflowTaskState |
| 20 | + |
| 21 | + with self.argument_context("acr supply-chain workflow") as c: |
| 22 | + c.argument('resource_group', arg_type=resource_group_name_type, completer=get_resource_name_completion_list(REGISTRY_RESOURCE_TYPE)) |
| 23 | + 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) |
| 24 | + c.argument("workflow_type", arg_type=get_enum_type(CSSCTaskTypes), options_list=['--type', '-t'], help="Type of workflow task.", required=True) |
| 25 | + |
| 26 | + with self.argument_context("acr supply-chain workflow create") as c: |
| 27 | + 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) |
| 28 | + 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) |
| 29 | + 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()) |
| 30 | + 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()) |
| 31 | + |
| 32 | + with self.argument_context("acr supply-chain workflow update") as c: |
| 33 | + 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)") |
| 34 | + 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.") |
| 35 | + 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()) |
| 36 | + 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()) |
| 37 | + |
| 38 | + with self.argument_context("acr supply-chain workflow list") as c: |
| 39 | + c.argument("status", arg_type=get_enum_type(WorkflowTaskState), options_list=["--run-status"], help="Status to filter the supply-chain workflow image status.") |
| 40 | + |
| 41 | + with self.argument_context("acr supply-chain workflow delete") as c: |
| 42 | + c.argument("yes", options_list=["--yes", "-y"], help="Proceed with the deletion without user confirmation") |
0 commit comments