Git reset for GIT_STRATEGY/GIT_SUBMODULE_STRATEGY
Description
Allow reset for GIT_STRATEGY and GIT_SUBMODULE_STRATEGY in .gitlab-ci.yml.
Proposal
GIT_STRATEGY: reset
git reset --hard
GIT_SUBMODULE_STRATEGY: reset
git submodule --quiet foreach --recursive git reset --hard
Links / references
https://forum.gitlab.com/t/ci-workflow-with-build-artifacts/8160
Documentation blurb
Overview
Create a quick way to get a clean state for build/deploy. A git clone can be a real drawback on systems with a lot submodules in the case of a emergency bugfix.
Use cases
I've a repository wich contains a number of Git submodules. Most of these modules are mirrors with read only access. In rare cases it's necessary to apply patches to some of these submodules. So I write a patch file which is applied during the build process and add that file to the build artifacts.
Some projects contains Git submodules of code I share among several projects. During the build process I create build artifacts (e.g. create CSS files form SASS or build minified JS files).
The problem
The problems start if branches for feature tests are deployed via GitLab CI.
Let's imagine I start a feature and need to patch some files of a Git submodule. I write a patch files which is applied during build. So far so good. Problems start if I build the master branch now (which does not have this patch). The patched file is still around in the GitLab CI build directory on my deploy server.
The only way to get a clean working copy is to use GIT_STRATEGY: clone (since fetch would leave the patched as described above) which can be very time consuming on big projects. This is no problem for regular commits, but for Bugfixes this can be a real drawback.
Feature checklist
Make sure these are completed before closing the issue, with a link to the relevant commit.
-
Feature assurance -
Documentation -
Added to features.yml