- github.com/fluxcd/pkg/apis/meta to v0.19.0
- github.com/fluxcd/source-controller/api to v0.34.0
- github.com/fluxcd/image-reflector-controller/api to v0.24.0
- k8s.io/api to v0.26.1
- k8s.io/apimachinery to v0.26.1
- k8s.io/client-go to v0.26.1
- sigs.k8s.io/controller-runtime to v0.14.2
Signed-off-by: Hidde Beydals <hello@hidde.co>
The new feature gate enables users to toggle the download of all branch
head references when push branches are configured.
Tests were refactored to ensure that they are feature gate sensitive.
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
In specific cases, the update mechanism may lead to no files being
changed. The changes short-circuit the process to exit early when
0 files have been modified.
go-git has been changed to return an error when an empty commit
is detected, which is used as a last resort.
When the push branch is different than the clone branch, the controller
will now download all branch references from the Git server, in order
to enable a single fetch operation.
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
ForceGoGitImplementation ignores the value set for gitImplementation
and ensures that go-git is used for all GitRepository objects.
This can be used to confirm that Flux instances won't break if/when
the libgit2 implementation was to be deprecated.
When enabled, libgit2 won't be initialized, nor will any git2go cgo
code be called.
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
Automations using a different push branch can now
enable force push to ensure that it gets refreshed
with the latest version of the branch used for the
clone operation.
Initially this was going to be added in combination
with Shallow clones for the `go-git` implementation.
However, force push is required for feature completeness
whilst Shallow clones are mostly an optimisation, and
will therefore be implemented at a later stage.
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
This gets the behaviour a step closer to Source Controller
which logs after every reconciliation, even when no changes
were made.
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
Fixes error when push branch and reference branch are equal
by skipping switch to push branch
Signed-off-by: Pierre-Barthelemy Fiocconi <pierre-barthelemy.fi@doctolib.com>
The controller-runtime provides the ability to recover from
panics that have arisen from a reconciliation. This change
enables this functionality by default.
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
Also, removes the panic recovery code added in cloneInto() as the
underlying Checkout() in SC already has a panic handler. The issues were
due to goroutine panicking, which are now handled in the SC libgit
managed transport.
Signed-off-by: Sunny <darkowlzz@protonmail.com>
Fixes regression in which we fail to push to a branch after switching to
a branch, if origin is ahead of local. Fixed by setting the upstream
commit as the local branch target.
Regression introduced in #330, and partially addressed in #369.
Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
Fixes regression in which IAC will fail to update push branch
when the push branch already exists and checkout branch is
ahead.
The reconciliation errors with: 'cannot push because a reference
that you are trying to update on the remote contains commits
that are not present locally.'
Regression introduced on #330.
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
- Panic recovery for Git operations.
- Improved SSH connection management without use of caching.
- Enforce context timeout for managed SSH.
- Remove dependency to callback functions.
- Add support for hashed known_hosts.
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
Add two new flags to enable users to configure exponential
back-off for Flux objects. The default values are now
set to 750ms for minimum retry time, and 15min for max.
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
libgit2 network operations are blocking and do not provide timeout nor context capabilities,
leading to several reports of the controllers hanging indefinitely.
By using managed transport, golang primitives such as http.Transport and net.Dial can be used
to ensure timeouts are enforced.
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
ImageUpdateAutomation objects can now refer to GitRepository objects in other
namespaces. Implemented by switching sourceRef from a SourceReference to a
dependency.CrossNamespaceDependencyReference.
Signed-off-by: Sanskar Jaiswal <sanskar.jaiswal@weave.works>
os.RemoveAll can return an error; even if we're exiting the procedure
at the time, it's worth knowing when it's failing, because typically
the working directory is a memory-backed volume and you can run out
quite easily.
Signed-off-by: Michael Bridgen <michael@weave.works>
Pass cancellable context to libgit2.RemoteCallbacks to be able to cancel
the remote operations when the context is cancelled.
For git clone, fetch and push, a context is created with the timeout of
the target GitRepository.
Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit makes use of the refactored `git` package, which has
been reworked to increase stability and test coverage, and ensures
implementation details do not leak out into the "main wrapper".
This indirectly seems to resolve a memory leak that happenedd with
the previous wiring, thereby fixing #247.
The code changes for this controller itself are minimal, mostly
ensuring the auth and checkout configurations are created in the
"new way".
Signed-off-by: Hidde Beydals <hello@hidde.co>
All functions are not supported, The following are discarded:
// Date functions
"date",
"date_in_zone",
"date_modify",
"now",
"htmlDate",
"htmlDateInZone",
"dateInZone",
"dateModify",
// Strings
"randAlphaNum",
"randAlpha",
"randAscii",
"randNumeric",
"uuidv4",
// OS
"env",
"expandenv",
// Network
"getHostByName",
Signed-off-by: Soule BA <bah.soule@gmail.com>
This commit updates `github.com/libgit2/git2go` to `v31.6.1` (with
`libgit2` `1.1.1`), and changes the container image build process so
that it makes use of `ghcr.io/hiddeco/golang-with-libgit2`.
This image provides a pre-build dynamic `libgit2` dependency linked
against OpenSSL and LibSSH2 (without gcrypt), and a set of cross-compile
build tools (see
[rationale](https://github.com/hiddeco/golang-with-libgit2#rationale) and
[usage](https://github.com/hiddeco/golang-with-libgit2#usage) for more
detailed information).
The linked set of dependency should solve most known issues around
unsupport private key types, but does not resolve the issues with ECDSA*
and ED25519 hostkeys yet. Solving this requires a newer version of
`libgit2` (`>=1.2.0`), which currently does not seem to work properly
with `git2go/v32`.
Signed-off-by: Hidde Beydals <hello@hidde.co>