Skip to content

Commit

Permalink
remove workflow_name as part of project validation in run_id. the wor…
Browse files Browse the repository at this point in the history
…kflow_name might be truncated and not contain the complete project/branch (#2095)
  • Loading branch information
saikonen authored Oct 10, 2024
1 parent 3171308 commit 1a3070d
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions metaflow/plugins/argo/argo_workflows_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,27 +1016,15 @@ def validate_run_id(

if project_name is not None:
# Verify we are operating on the correct project.
# Perform match with separators to avoid substrings matching
# e.g. 'test_proj' and 'test_project' should count as a mismatch.
project_part = "%s." % sanitize_for_argo(project_name)
if (
current.get("project_name") != project_name
and project_part not in workflow_name
):
if current.get("project_name") != project_name:
raise RunIdMismatch(
"The workflow belongs to the project *%s*. "
"Please use the project decorator or --name to target the correct project"
% project_name
)

# Verify we are operating on the correct branch.
# Perform match with separators to avoid substrings matching.
# e.g. 'user.tes' and 'user.test' should count as a mismatch.
branch_part = ".%s." % sanitize_for_argo(branch_name)
if (
current.get("branch_name") != branch_name
and branch_part not in workflow_name
):
if current.get("branch_name") != branch_name:
raise RunIdMismatch(
"The workflow belongs to the branch *%s*. "
"Please use --branch, --production or --name to target the correct branch"
Expand Down

0 comments on commit 1a3070d

Please sign in to comment.