libgit2: Update documentation

Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
This commit is contained in:
Paulo Gomes 2022-12-09 14:49:52 +00:00
parent 2d65cf4f24
commit ce4ac58bff
No known key found for this signature in database
GPG Key ID: 9995233870E99BEE
2 changed files with 9 additions and 64 deletions

View File

@ -13,27 +13,6 @@ There are a number of dependencies required to be able to run the controller and
- [Install Docker](https://docs.docker.com/engine/install/) - [Install Docker](https://docs.docker.com/engine/install/)
- (Optional) [Install Kubebuilder](https://book.kubebuilder.io/quick-start.html#installation) - (Optional) [Install Kubebuilder](https://book.kubebuilder.io/quick-start.html#installation)
The [libgit2](https://libgit2.org/) dependency is now automatically managed by the Makefile logic.
However, it depends on [pkg-config](https://freedesktop.org/wiki/Software/pkg-config/) being installed:
### macOS
```console
$ # Ensure pkg-config is installed
$ brew install pkg-config
```
### Linux
```console
$ # Ensure pkg-config is installed
$ pacman -S pkgconf
```
**Note:** Example shown is for Arch Linux, but likewise procedure can be
followed using any other package manager. Some distributions may have slight
variation of package names (e.g. `apt install -y pkg-config`).
In addition to the above, the following dependencies are also used by some of the `make` targets: In addition to the above, the following dependencies are also used by some of the `make` targets:
- `controller-gen` (v0.7.0) - `controller-gen` (v0.7.0)
@ -149,18 +128,11 @@ Create a `.vscode/launch.json` file:
"type": "go", "type": "go",
"request": "launch", "request": "launch",
"mode": "auto", "mode": "auto",
"envFile": "${workspaceFolder}/build/.env",
"program": "${workspaceFolder}/main.go" "program": "${workspaceFolder}/main.go"
} }
] ]
} }
``` ```
Create the environment file containing details on how to load
`libgit2` dependencies:
```bash
make env
```
Start debugging by either clicking `Run` > `Start Debugging` or using Start debugging by either clicking `Run` > `Start Debugging` or using
the relevant shortcut. the relevant shortcut.

View File

@ -228,8 +228,7 @@ spec:
branch: <branch-name> branch: <branch-name>
``` ```
Using the [`go-git` Git implementation](#git-implementation), this will perform This will perform a shallow clone to only fetch the specified branch.
a shallow clone to only fetch the specified branch.
#### Tag example #### Tag example
@ -284,9 +283,9 @@ spec:
commit: "<commit SHA>" commit: "<commit SHA>"
``` ```
This field takes precedence over all other fields. Using the [`go-git` Git This field takes precedence over all other fields. It can be combined with
implementation](#git-implementation), it can be combined with `.spec.ref.branch` `.spec.ref.branch` to perform a shallow clone of the branch, in which the
to perform a shallow clone of the branch, in which the commit must exist: commit must exist:
```yaml ```yaml
--- ---
@ -385,32 +384,13 @@ resume.
### Git implementation ### Git implementation
**Note:** `libgit2` is being deprecated, as its use is known to cause controllers `.spec.gitImplementation` is deprecated and its value ignored, the git
to panic when running over long periods of time, or when under high GC pressure. implementation used across Flux is go-git.
A new opt-out feature gate `ForceGoGitImplementation` was introduced, which will
use `go-git` regardless of the value defined at `.spec.gitImplementation`.
This can be disabled by starting the controller with the additional flag below:
`--feature-gates=ForceGoGitImplementation=false`.
`.spec.gitImplementation` is an optional field to change the client library
implementation used for Git operations (e.g. clone, checkout). The default
value is `go-git`.
Unless you need support for a specific Git wire protocol functionality not
supported by the default implementation (as documented below), changing the
implementation is generally not recommended as it can come with its own set of
drawbacks. For example, not being able to make use of shallow clones forces the
controller to fetch the whole Git history tree instead of a specific one,
resulting in an increase of disk space and traffic usage.
**Note:** The `libgit2` implementation does not support shallow clones or
Git submodules.
#### Optimized Git clones #### Optimized Git clones
Optimized Git clones decreases resource utilization for GitRepository Optimized Git clones decreases resource utilization for GitRepository
reconciliations. It supports both `go-git` and `libgit2` implementations reconciliations.
when cloning repositories using branches or tags.
When enabled, it avoids full Git clone operations by first checking whether When enabled, it avoids full Git clone operations by first checking whether
the revision of the last stored artifact is still the head of the remote the revision of the last stored artifact is still the head of the remote
@ -428,20 +408,13 @@ not affected by this functionality.
#### Proxy support #### Proxy support
When a proxy is configured in the source-controller Pod through the appropriate When a proxy is configured in the source-controller Pod through the appropriate
environment variables, for example `HTTPS_PROXY`, `NO_PROXY`, etc. There may be environment variables, for example `HTTPS_PROXY`, `NO_PROXY`, etc.
some limitations in the proxy support based on the Git implementation.
| Git Implementation | HTTP_PROXY | HTTPS_PROXY | NO_PROXY | Self-signed Certs |
|--------------------|------------|-------------|----------|-------------------|
| `go-git` | true | true | true | false |n
| `libgit2` | true | true | true | true |
### Recurse submodules ### Recurse submodules
`.spec.recurseSubmodules` is an optional field to enable the initialization of `.spec.recurseSubmodules` is an optional field to enable the initialization of
all submodules within the cloned Git repository, using their default settings. all submodules within the cloned Git repository, using their default settings.
This option is only available when using the (default) `go-git` [Git This option defaults to `false`.
implementation](#git-implementation), and defaults to `false`.
Note that for most Git providers (e.g. GitHub and GitLab), deploy keys can not Note that for most Git providers (e.g. GitHub and GitLab), deploy keys can not
be used as reusing a key across multiple repositories is not allowed. You have be used as reusing a key across multiple repositories is not allowed. You have