containers: retain shallow git data (#37734)
This commit is contained in:
parent
c8026c3c87
commit
90208da8a5
3 changed files with 14 additions and 8 deletions
|
@ -5,6 +5,7 @@
|
||||||
"""Manages the details on the images used in the various stages."""
|
"""Manages the details on the images used in the various stages."""
|
||||||
import json
|
import json
|
||||||
import os.path
|
import os.path
|
||||||
|
import shlex
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import llnl.util.filesystem as fs
|
import llnl.util.filesystem as fs
|
||||||
|
@ -130,8 +131,11 @@ def checkout_command(url, ref, enforce_sha, verify):
|
||||||
if enforce_sha or verify:
|
if enforce_sha or verify:
|
||||||
ref = _verify_ref(url, ref, enforce_sha)
|
ref = _verify_ref(url, ref, enforce_sha)
|
||||||
|
|
||||||
command = (
|
return " && ".join(
|
||||||
"git clone {0} . && git fetch origin {1}:container_branch &&"
|
[
|
||||||
" git checkout container_branch "
|
"git init --quiet",
|
||||||
).format(url, ref)
|
f"git remote add origin {shlex.quote(url)}",
|
||||||
return command
|
f"git fetch --depth=1 origin {shlex.quote(ref)}",
|
||||||
|
"git checkout --detach FETCH_HEAD",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
|
@ -41,5 +41,7 @@ def test_bootstrap_phase(minimal_configuration, config_dumper, capsys):
|
||||||
with fs.working_dir(spack_yaml_dir):
|
with fs.working_dir(spack_yaml_dir):
|
||||||
output = containerize()
|
output = containerize()
|
||||||
|
|
||||||
# Check for the presence of the clone command
|
# Check for the presence of the Git commands
|
||||||
assert "git clone" in output
|
assert "git init" in output
|
||||||
|
assert "git fetch" in output
|
||||||
|
assert "git checkout" in output
|
||||||
|
|
|
@ -23,7 +23,7 @@ RUN ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash \
|
||||||
RUN mkdir -p /root/.spack \
|
RUN mkdir -p /root/.spack \
|
||||||
&& cp $SPACK_ROOT/share/spack/docker/modules.yaml \
|
&& cp $SPACK_ROOT/share/spack/docker/modules.yaml \
|
||||||
/root/.spack/modules.yaml \
|
/root/.spack/modules.yaml \
|
||||||
&& rm -rf /root/*.* /run/nologin $SPACK_ROOT/.git
|
&& rm -rf /root/*.* /run/nologin
|
||||||
|
|
||||||
# [WORKAROUND]
|
# [WORKAROUND]
|
||||||
# https://superuser.com/questions/1241548/
|
# https://superuser.com/questions/1241548/
|
||||||
|
|
Loading…
Reference in a new issue