Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
797a8896
Commit
797a8896
authored
Nov 10, 2020
by
Katrin Leinweber
Committed by
Marcel Amirault
Nov 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update ordering of git strategy details
When reordered, we can remove some of the duplicated examples
parent
e0c43662
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
45 deletions
+30
-45
doc/ci/large_repositories/index.md
doc/ci/large_repositories/index.md
+3
-16
doc/ci/pipelines/settings.md
doc/ci/pipelines/settings.md
+3
-2
doc/ci/runners/README.md
doc/ci/runners/README.md
+24
-27
No files found.
doc/ci/large_repositories/index.md
View file @
797a8896
...
@@ -56,24 +56,11 @@ test:
...
@@ -56,24 +56,11 @@ test:
> Introduced in GitLab Runner 8.9.
> Introduced in GitLab Runner 8.9.
By default, GitLab is configured to always prefer the
`GIT_STRATEGY: fetch`
strategy.
By default, GitLab is configured to use the
[
`fetch` Git strategy
](
../runners/README.md#git-strategy
)
,
The
`GIT_STRATEGY: fetch`
strategy will re-use existing worktrees if found
which is recommended for large repositories.
on disk. This is different to the
`GIT_STRATEGY: clone`
strategy
This strategy reduces the amount of data to transfer and
as in case of clones, if a worktree is found, it is removed before clone.
Usage of
`fetch`
is preferred because it reduces the amount of data to transfer and
does not really impact the operations that you might do on a repository from CI.
does not really impact the operations that you might do on a repository from CI.
However,
`fetch`
does require access to the previous worktree. This works
well when using the
`shell`
or
`docker`
executor because these
try to preserve worktrees and try to re-use them by default.
This does not work today for
`kubernetes`
executor and has limitations when using
`docker+machine`
.
`kubernetes`
executor today always clones into ephemeral directory.
GitLab also offers the
`GIT_STRATEGY: none`
strategy. This disables any
`fetch`
and
`checkout`
commands
done by GitLab, requiring you to do them.
## Git clone path
## Git clone path
> Introduced in GitLab Runner 11.10.
> Introduced in GitLab Runner 11.10.
...
...
doc/ci/pipelines/settings.md
View file @
797a8896
...
@@ -26,10 +26,11 @@ There are two options. Using:
...
@@ -26,10 +26,11 @@ There are two options. Using:
-
`git clone`
, which is slower since it clones the repository from scratch
-
`git clone`
, which is slower since it clones the repository from scratch
for every job, ensuring that the local working copy is always pristine.
for every job, ensuring that the local working copy is always pristine.
-
`git fetch`
, which is faster as it re-uses the local working copy (falling
-
`git fetch`
, which is
GitLab's default and
faster as it re-uses the local working copy (falling
back to clone if it doesn't exist).
back to clone if it doesn't exist).
This is recommended, especially for
[
large repositories
](
../large_repositories/index.md#git-strategy
)
.
The
default Git strategy can be overridden by the
[
GIT_STRATEGY
variable
](
../runners/README.md#git-strategy
)
The
configured Git strategy can be overridden by the
[
`GIT_STRATEGY`
variable
](
../runners/README.md#git-strategy
)
in
`.gitlab-ci.yml`
.
in
`.gitlab-ci.yml`
.
## Git shallow clone
## Git shallow clone
...
...
doc/ci/runners/README.md
View file @
797a8896
...
@@ -478,46 +478,43 @@ You can also use variables to configure how many times a runner
...
@@ -478,46 +478,43 @@ You can also use variables to configure how many times a runner
> - Introduced in GitLab 8.9 as an experimental feature.
> - Introduced in GitLab 8.9 as an experimental feature.
> - `GIT_STRATEGY=none` requires GitLab Runner v1.7+.
> - `GIT_STRATEGY=none` requires GitLab Runner v1.7+.
You can set the
`GIT_STRATEGY`
used for getting recent application code, either
You can set the
`GIT_STRATEGY`
used to fetch the repository content, either
globally or per-job in the
[
`variables`
](
../yaml/README.md#variables
)
section. If left
globally or per-job in the
[
`variables`
](
../yaml/README.md#variables
)
section:
unspecified, the default from the project settings is used.
There are three possible values:
`clone`
,
`fetch`
, and
`none`
.
`clone`
is the slowest option. It clones the repository from scratch for every
job, ensuring that the local working copy is always pristine.
```
yaml
```
yaml
variables
:
variables
:
GIT_STRATEGY
:
clone
GIT_STRATEGY
:
clone
```
```
There are three possible values:
`clone`
,
`fetch`
, and
`none`
. If left unspecified,
jobs use the
[
project's pipeline setting
](
../pipelines/settings.md#git-strategy
)
.
`clone`
is the slowest option. It clones the repository from scratch for every
job, ensuring that the local working copy is always pristine.
If an existing worktree is found, it is removed before cloning.
`fetch`
is faster as it re-uses the local working copy (falling back to
`clone`
`fetch`
is faster as it re-uses the local working copy (falling back to
`clone`
if it does not exist).
`git clean`
is used to undo any changes made by the last
if it does not exist).
`git clean`
is used to undo any changes made by the last
job, and
`git fetch`
is used to retrieve commits made
since
the last job ran.
job, and
`git fetch`
is used to retrieve commits made
after
the last job ran.
```
yaml
However,
`fetch`
does require access to the previous worktree. This works
variables
:
well when using the
`shell`
or
`docker`
executor because these
GIT_STRATEGY
:
fetch
try to preserve worktrees and try to re-use them by default.
```
`none`
also re-uses the local working copy. However, it skips all Git operations,
This has limitations when using the
[
Docker Machine executor
](
https://docs.gitlab.com/runner/executors/docker_machine.html
)
.
including GitLab Runner's pre-clone script, if present.
It
's useful for jobs that operate exclusively on artifacts, like a deployment job.
It
does not work for
[
the `kubernetes` executor
](
https://docs.gitlab.com/runner/executors/kubernetes.html
)
,
Git repository data may be present, but it's likely out-of-date. You should only
but a
[
feature proposal
](
https://gitlab.com/gitlab-org/gitlab-runner/-/issues/3847
)
exists.
rely on files brought into the local working copy from cache or artifacts
.
The
`kubernetes`
executor always clones into an temporary directory
.
```
yaml
A Git strategy of
`none`
also re-uses the local working copy, but skips all Git
variables
:
operations normally done by GitLab. GitLab Runner pre-clone scripts are also skipped,
GIT_STRATEGY
:
none
if present. This strategy could mean you need to add
`fetch`
and
`checkout`
commands
```
to
[
your `.gitlab-ci.yml` script
](
../yaml/README.md#script
)
.
NOTE:
**Note:**
It can be used for jobs that operate exclusively on artifacts, like a deployment job.
`GIT_STRATEGY`
is not supported for
Git repository data may be present, but it's likely out of date. You should only
[
Kubernetes executor
](
https://docs.gitlab.com/runner/executors/kubernetes.html
)
,
rely on files brought into the local working copy from cache or artifacts.
but may be in the future. See the
[
support Git strategy with Kubernetes executor feature proposal
](
https://gitlab.com/gitlab-org/gitlab-runner/-/issues/3847
)
for updates.
### Git submodule strategy
### Git submodule strategy
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment