diff --git a/src/acrcssc/azext_acrcssc/cssc.py b/src/acrcssc/azext_acrcssc/cssc.py index 8aa7b6eb958..840df20bcd6 100644 --- a/src/acrcssc/azext_acrcssc/cssc.py +++ b/src/acrcssc/azext_acrcssc/cssc.py @@ -39,7 +39,7 @@ def _perform_continuous_patch_operation(cmd, logger.debug('validations completed successfully.') if dryrun: - acr_cssc_dry_run(cmd, registry=registry, config_file_path=config) + acr_cssc_dry_run(cmd, registry=registry, config_file_path=config, is_create=is_create) else: create_update_continuous_patch_v1(cmd, registry, config, cadence, dryrun, defer_immediate_run, is_create) diff --git a/src/acrcssc/azext_acrcssc/helper/_taskoperations.py b/src/acrcssc/azext_acrcssc/helper/_taskoperations.py index 1155430a97a..d9fd96e24cb 100644 --- a/src/acrcssc/azext_acrcssc/helper/_taskoperations.py +++ b/src/acrcssc/azext_acrcssc/helper/_taskoperations.py @@ -140,12 +140,14 @@ def list_continuous_patch_v1(cmd, registry): return filtered_cssc_tasks -def acr_cssc_dry_run(cmd, registry, config_file_path): +def acr_cssc_dry_run(cmd, registry, config_file_path, is_create=True): logger.debug("Entering acr_cssc_dry_run with parameters: %s %s", registry, config_file_path) if config_file_path is None: logger.error("--config parameter is needed to perform dry-run check.") return + if is_create and check_continuous_task_exists(cmd, registry): + raise AzCLIError(f"{CONTINUOUS_PATCHING_WORKFLOW_NAME} workflow task already exists. Use 'az acr supply-chain workflow update' command to perform updates.") try: file_name = os.path.basename(config_file_path) tmp_folder = os.path.join(os.getcwd(), tempfile.mkdtemp(prefix="cli_temp_cssc"))