f2560588bc
This patch reworks the logic when setting KAS_REPO_REF_DIR. When this variable is set, a two-staged clone is used: First, a bare-clone (or similar) is created in the ref-dir, according to the naming scheme. This clone is executed in a way that is both reentrant as well as race-free across multiple instances of KAS working on the same dir. Internally we clone into a tmpdir below the refdir and rename on success to guarantee the atomicity of the operation on POSIX compliant filesystems. Second, the clone in the KAS_WORK_DIR is executed against the local copy. After that, the origin url is redirected to the upstream url. By that, the KAS_REPO_REF_DIR directory can be cached across builds which significantly speedsup clone times against large repos. In case the requested refspec is already in the cache (very likely in CI builds), no direct access to the upstream repo is required. This logic is crucial for CI systems in China, where e.g. access to github is blocked from time to time. The clone-from-local logic is currently only implemented for the git plugin as HG misses the caching logic. Repo implementations that do not support this logic can simply opt-out for the first stage by returning 'true'. The existing user-facing logic of KAS_REPO_REF_DIR is not affected. However, internally we no longer clone via --reference as this still requires access to the remote repo, even if the requested commit is already in the local copy. Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> |
||
---|---|---|
.. | ||
plugins | ||
__init__.py | ||
__main__.py | ||
__version__.py | ||
config.py | ||
configschema.py | ||
context.py | ||
includehandler.py | ||
kas.py | ||
libcmds.py | ||
libkas.py | ||
repos.py | ||
schema-kas.json |