diff options
author | kwryankrattiger <80296582+kwryankrattiger@users.noreply.github.com> | 2023-05-09 11:42:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-09 10:42:06 -0600 |
commit | 45e1d3498cd3a63038dfc5b63c1b1f5c732e9d1f (patch) | |
tree | 3a678ecda444ac1401ab524740d4b0bba28df256 /lib | |
parent | af0f0942920ffb1fd15e5458e9796f4bd7c8a9d1 (diff) | |
download | spack-45e1d3498cd3a63038dfc5b63c1b1f5c732e9d1f.tar.gz spack-45e1d3498cd3a63038dfc5b63c1b1f5c732e9d1f.tar.bz2 spack-45e1d3498cd3a63038dfc5b63c1b1f5c732e9d1f.tar.xz spack-45e1d3498cd3a63038dfc5b63c1b1f5c732e9d1f.zip |
CI: Backwards compatibility requires script override behavior (#37015)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/ci.py | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/lib/spack/spack/ci.py b/lib/spack/spack/ci.py index 6b2d79a0ce..d7966c13f2 100644 --- a/lib/spack/spack/ci.py +++ b/lib/spack/spack/ci.py @@ -2481,12 +2481,14 @@ def translate_deprecated_config(config): build_job["tags"] = config.pop("tags") if "variables" in config: build_job["variables"] = config.pop("variables") + + # Scripts always override in old CI if "before_script" in config: - build_job["before_script"] = config.pop("before_script") + build_job["before_script:"] = config.pop("before_script") if "script" in config: - build_job["script"] = config.pop("script") + build_job["script:"] = config.pop("script") if "after_script" in config: - build_job["after_script"] = config.pop("after_script") + build_job["after_script:"] = config.pop("after_script") signing_job = None if "signing-job-attributes" in config: @@ -2510,8 +2512,25 @@ def translate_deprecated_config(config): for section in mappings: submapping_section = {"match": section["match"]} if "runner-attributes" in section: - submapping_section["build-job"] = section["runner-attributes"] + remapped_attributes = {} + if match_behavior == "first": + for key, value in section["runner-attributes"].items(): + # Scripts always override in old CI + if key == "script": + remapped_attributes["script:"] = value + elif key == "before_script": + remapped_attributes["before_script:"] = value + elif key == "after_script": + remapped_attributes["after_script:"] = value + else: + remapped_attributes[key] = value + else: + # Handle "merge" behavior be allowing scripts to merge in submapping section + remapped_attributes = section["runner-attributes"] + submapping_section["build-job"] = remapped_attributes + if "remove-attributes" in section: + # Old format only allowed tags in this section, so no extra checks are needed submapping_section["build-job-remove"] = section["remove-attributes"] submapping.append(submapping_section) pipeline_gen.append({"submapping": submapping, "match_behavior": match_behavior}) |