ci: build the dev images in parallel with the checks and gate only the push [CI]
This commit is contained in:
1 parent
b33e50696d
commit
1ccbb847b5
6 files changed
+99
-8
No files matched your search
+16
-1
@@ -5,6 +5,7 @@ from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import shutil
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
@@ -28,6 +29,20 @@ CONTAINERFILES = {
|
||||
}
|
||||
|
||||
|
||||
def copy_for_restore(path: Path, relative: Path, target: Path) -> None:
|
||||
"""The restore layer must not change when only the build version does: CI rewrites <Version> in the workspace
|
||||
Directory.Build.props (ci/version.sh), which used to invalidate the cached dependency restore on every commit.
|
||||
Restore only needs the committed props (package versions); the source copy still carries the real version."""
|
||||
if path.name == "Directory.Build.props":
|
||||
committed = subprocess.run(
|
||||
["git", "show", f"HEAD:backend/{relative.as_posix()}"], cwd=ROOT, capture_output=True, check=False
|
||||
)
|
||||
if committed.returncode == 0:
|
||||
target.write_bytes(committed.stdout)
|
||||
return
|
||||
shutil.copy2(path, target)
|
||||
|
||||
|
||||
def stage(component: str, runtime_identifier: str, destination: Path) -> None:
|
||||
if destination.exists():
|
||||
shutil.rmtree(destination)
|
||||
@@ -49,7 +64,7 @@ def stage(component: str, runtime_identifier: str, destination: Path) -> None:
|
||||
):
|
||||
target = restore / relative
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy2(path, target)
|
||||
copy_for_restore(path, relative, target)
|
||||
target = source / relative
|
||||
target.parent.mkdir(parents=True, exist_ok=True)
|
||||
shutil.copy2(path, target)
|
||||
|
||||
Reference in new issue
Block a user