diff --git a/tasks/libs/ciproviders/gitlab_api.py b/tasks/libs/ciproviders/gitlab_api.py index 060bad5fe5ded..136d6a5a77fc8 100644 --- a/tasks/libs/ciproviders/gitlab_api.py +++ b/tasks/libs/ciproviders/gitlab_api.py @@ -195,11 +195,20 @@ def apply_yaml_extends(config: dict, node): if key not in node: node[key] = value elif key in node and isinstance(node[key], dict) and isinstance(value, dict): - node[key].update(value) + update_without_overwrite(node[key], value) del node['extends'] +def update_without_overwrite(d, u): + """ + Update a dictionary without overwriting existing keys + """ + for k, v in u.items(): + if k not in d: + d[k] = v + + def apply_yaml_reference(config: dict, node): """ Applies `!reference` gitlab yaml tags to the node and its children inplace diff --git a/tasks/testwasher.py b/tasks/testwasher.py index 5f3c7c377c591..8ea02bb639099 100644 --- a/tasks/testwasher.py +++ b/tasks/testwasher.py @@ -202,9 +202,15 @@ def generate_flake_finder_pipeline(_, n=3): new_job["stage"] = f"flake-finder-{i}" new_job["dependencies"] = [] if 'variables' in new_job: - if 'E2E_PIPELINE_ID' in new_job['variables']: + if ( + 'E2E_PIPELINE_ID' in new_job['variables'] + and new_job['variables']['E2E_PIPELINE_ID'] == "$CI_PIPELINE_ID" + ): new_job['variables']['E2E_PIPELINE_ID'] = "$PARENT_PIPELINE_ID" - if 'E2E_COMMIT_SHA' in new_job['variables']: + if ( + 'E2E_COMMIT_SHA' in new_job['variables'] + and new_job['variables']['E2E_COMMIT_SHA'] == "$CI_COMMIT_SHA" + ): new_job['variables']['E2E_COMMIT_SHA'] = "$PARENT_COMMIT_SHA" new_job["rules"] = [{"when": "always"}] new_jobs[f"{job}-{i}"] = new_job