fix(runner): allow version-guarded base repair overlays
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -487,6 +487,10 @@ def deploy_app(
|
|||||||
# may already include the environmental compose.ccci.yml). Stripped before the head redeploy
|
# may already include the environmental compose.ccci.yml). Stripped before the head redeploy
|
||||||
# (generic.perform_upgrade) so the PR head runs unmodified.
|
# (generic.perform_upgrade) so the PR head runs unmodified.
|
||||||
if apply_previous:
|
if apply_previous:
|
||||||
|
# This untracked overlay also trips abra's pinned-deploy clean-tree gate.
|
||||||
|
# The exact version was checked out above; chaos deploys that base plus
|
||||||
|
# its repair, just as for compose.ccci.yml, without fetching latest.
|
||||||
|
chaos = True
|
||||||
cf = compose_file_add(extra.get("COMPOSE_FILE", "compose.yml"), PREVIOUS_COMPOSE)
|
cf = compose_file_add(extra.get("COMPOSE_FILE", "compose.yml"), PREVIOUS_COMPOSE)
|
||||||
abra.env_set(domain, "COMPOSE_FILE", cf)
|
abra.env_set(domain, "COMPOSE_FILE", cf)
|
||||||
provide_previous_overlay(recipe)
|
provide_previous_overlay(recipe)
|
||||||
|
|||||||
@@ -116,3 +116,37 @@ def test_previous_status_stale_without_marker(monkeypatch):
|
|||||||
monkeypatch.setattr(lifecycle, "previous_target_version", lambda r: None)
|
monkeypatch.setattr(lifecycle, "previous_target_version", lambda r: None)
|
||||||
st = lifecycle.previous_status("rx", "version", "0.7.0+3.3.1")
|
st = lifecycle.previous_status("rx", "version", "0.7.0+3.3.1")
|
||||||
assert st["apply"] is False and st["stale"] is True and "marker" in st["reason"]
|
assert st["apply"] is False and st["stale"] is True and "marker" in st["reason"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_previous_overlay_deploys_checked_out_base_without_clean_tree_gate(monkeypatch):
|
||||||
|
events = []
|
||||||
|
for name in (
|
||||||
|
"acquire_app_lock",
|
||||||
|
"provide_ccci_overlay",
|
||||||
|
"provide_previous_overlay",
|
||||||
|
"prepull_images",
|
||||||
|
):
|
||||||
|
monkeypatch.setattr(lifecycle, name, lambda *a, **kw: None)
|
||||||
|
for name in ("app_config_remove", "app_new", "env_set", "secret_generate"):
|
||||||
|
monkeypatch.setattr(lifecycle.abra, name, lambda *a, **kw: None)
|
||||||
|
monkeypatch.setattr(lifecycle.meta_mod, "extra_env", lambda *a: {})
|
||||||
|
monkeypatch.setattr(lifecycle.meta_mod, "hook_ctx", lambda *a: None)
|
||||||
|
monkeypatch.setattr(lifecycle.abra, "has_lightweight_version_tags", lambda r: False)
|
||||||
|
monkeypatch.setattr(lifecycle, "has_ccci_overlay", lambda r: False)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
lifecycle.abra, "recipe_checkout", lambda r, v: events.append(("checkout", v))
|
||||||
|
)
|
||||||
|
monkeypatch.setattr(
|
||||||
|
lifecycle.abra, "deploy", lambda d, **kw: events.append(("deploy", kw["chaos"]))
|
||||||
|
)
|
||||||
|
for apply_previous in (False, True):
|
||||||
|
events.clear()
|
||||||
|
lifecycle.deploy_app(
|
||||||
|
"example",
|
||||||
|
"example.invalid",
|
||||||
|
version="1.0.0",
|
||||||
|
apply_previous=apply_previous,
|
||||||
|
meta=object(),
|
||||||
|
_count_deploy=False,
|
||||||
|
)
|
||||||
|
assert events == [("checkout", "1.0.0"), ("deploy", apply_previous)]
|
||||||
|
|||||||
Reference in New Issue
Block a user