Resolve git branches in scm_dict
If the config uses SCM dicts that include branch or tag names, they will be resolved to specific commit ids. It goes through the caching resolver. The main motivation for that is to correctly support the --offline flag. It's highly unlikely there will be two scm_dicts in the config with the same repo. JIRA: COMPOSE-3279 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
5a7ced5b7d
commit
2d694272c0
@ -293,6 +293,21 @@ def _extend_with_default_and_alias(validator_class, offline=False):
|
|||||||
except util.GitUrlResolveError as exc:
|
except util.GitUrlResolveError as exc:
|
||||||
yield ConfigOptionError(exc)
|
yield ConfigOptionError(exc)
|
||||||
|
|
||||||
|
# Resolve branch in scm dicts.
|
||||||
|
if (
|
||||||
|
# Schema says it can be an scm dict
|
||||||
|
subschema.get("$ref") == "#/definitions/str_or_scm_dict"
|
||||||
|
# and the data is actually a dict
|
||||||
|
and isinstance(instance.get(property), dict)
|
||||||
|
# and it's git
|
||||||
|
and instance[property]["scm"] == "git"
|
||||||
|
# and there's a repo URL specified
|
||||||
|
and "repo" in instance[property]
|
||||||
|
):
|
||||||
|
instance[property]["branch"] = util.resolve_git_ref(
|
||||||
|
instance[property]["repo"], instance[property].get("branch", "HEAD")
|
||||||
|
)
|
||||||
|
|
||||||
for error in _hook_errors(properties, instance, schema):
|
for error in _hook_errors(properties, instance, schema):
|
||||||
yield error
|
yield error
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user