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."""
|
||||
import json
|
||||
import os.path
|
||||
import shlex
|
||||
import sys
|
||||
|
||||
import llnl.util.filesystem as fs
|
||||
|
@ -130,8 +131,11 @@ def checkout_command(url, ref, enforce_sha, verify):
|
|||
if enforce_sha or verify:
|
||||
ref = _verify_ref(url, ref, enforce_sha)
|
||||
|
||||
command = (
|
||||
"git clone {0} . && git fetch origin {1}:container_branch &&"
|
||||
" git checkout container_branch "
|
||||
).format(url, ref)
|
||||
return command
|
||||
return " && ".join(
|
||||
[
|
||||
"git init --quiet",
|
||||
f"git remote add origin {shlex.quote(url)}",
|
||||
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):
|
||||
output = containerize()
|
||||
|
||||
# Check for the presence of the clone command
|
||||
assert "git clone" in output
|
||||
# Check for the presence of the Git commands
|
||||
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 \
|
||||
&& cp $SPACK_ROOT/share/spack/docker/modules.yaml \
|
||||
/root/.spack/modules.yaml \
|
||||
&& rm -rf /root/*.* /run/nologin $SPACK_ROOT/.git
|
||||
&& rm -rf /root/*.* /run/nologin
|
||||
|
||||
# [WORKAROUND]
|
||||
# https://superuser.com/questions/1241548/
|
||||
|
|
Loading…
Reference in a new issue