Add fetch strategy support templates for HAF apps
Summary
Adds reusable templates for HAF apps that want to use GIT_STRATEGY=fetch instead of clone. Fetch strategy reduces GitLab server load by reusing workspace between jobs.
New templates
-
.haf_fetch_strategy_variables- Variable definitions to copy (documentation) -
.haf_git_corruption_cleanup- Pre-get-sources hook for cleaning corrupt git state left by cancelled pipelines -
.haf_submodule_init- Manual HAF submodule initialization for nested hive submodules -
.haf_fetch_strategy_example- Shows all pieces together (documentation)
Usage
# In your .gitlab-ci.yml
include:
- project: 'hive/common-ci-configuration'
ref: develop
file: '/templates/haf_app_testing.gitlab-ci.yml'
# Add corruption cleanup hook at default level
default:
hooks: !reference [.haf_git_corruption_cleanup, hooks]
# In jobs that need submodules
my_job:
before_script:
- !reference [.haf_submodule_init, script]
- # ... rest of before_script
Motivation
HAfAH switched to fetch strategy to reduce GitLab server load. This extracts that logic into reusable templates so other HAF apps can benefit.
Test plan
- HAfAH v3 branch uses these templates successfully
- Pipeline passes: https://gitlab.syncad.com/hive/HAfAH/-/pipelines/145910