Commit Graph

353 Commits

Author SHA1 Message Date
Hidde Beydals 64388a395d libgit2: free underlying C objects
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-18 21:21:42 +02:00
Stefan Prodan b8f6d3d1e0
Merge pull request #234 from fluxcd/release-v0.15.0
Release v0.15.0
2021-10-08 19:47:20 +03:00
Hidde Beydals c8e751f63a
Release v0.15.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-08 19:17:29 +03:00
Stefan Prodan 5546bccf25
Merge pull request #233 from fluxcd/update-irc
Update fluxcd/image-reflector-controller to v0.12.0
2021-10-08 19:16:10 +03:00
Stefan Prodan 78b565dc90
Use NamespacedObjectReference in tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-10-08 19:05:54 +03:00
Hidde Beydals 27ca639b8e Update fluxcd/image-reflector-controller to v0.12.0
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-08 17:23:19 +02:00
Hidde Beydals 4bd6a39ccc
Merge pull request #222 from fluxcd/update-libgit2
Update github.com/libgit2/git2go to v31.6.1
2021-10-08 16:39:45 +02:00
Hidde Beydals f1220d1cd9 Update golang-with-libgit2 to 1.1.1-1
This includes a tiny fix for Darwin to ensure the generated `.pc`
file includes the right paths.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-08 16:27:58 +02:00
Hidde Beydals e6ef46c947 CONTRIBUTING: document build requirements
Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-08 16:27:58 +02:00
Hidde Beydals 64ca8dcc48 Update Dockerfile used in tests as well
This ensures the Dockerfile used for testing is making use of the
same scratch image to compile `libgit2` as the actual application
image.

In a future iteration we should restructure our GitHub Action
workflows to re-use the application image, saving us an additional
Dockerfile and a duplicate build. Inspiration for this (which makes
use of a local registry for the duration of the build) can be found
at: https://github.com/fluxcd/golang-with-libgit2/blob/main/.github/workflows/build.yaml

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-08 16:27:58 +02:00
Hidde Beydals a3e9f69bd5 Switch to scratch based libgit2 container image
This moves the `libgit2` compilation to the image, to ensure it
can be build on builders that aren't backed by AMD64.

The image is structured in such a way that e.g. running nightly
builds targeting a different Go version, or targeting a different
OS vendor would be possible in the future via build arguments.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-08 16:27:58 +02:00
Hidde Beydals 58e21f37fb Update github.com/libgit2/git2go to v31.6.1
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>
2021-10-08 16:26:15 +02:00
Hidde Beydals 370f98e281 Build libgit2 using `golang-with-libgit2` helper
- Detection of the system version of `libgit2` is attempted using
  `pkg-config`. If this fails, or does not match the version as defined
  in the `Makefile` (or configured using `LIBGIT2_VER=1.x.y`), the
  library is compiled using the instructions from the `BASE_IMG`, and
  installed to `REPOSITORY_ROOT/hack/libgit2`.
- Where `libgit2` is required as a dependency, `LD_LIBRARY_PATH` and/or
  `PKG_CONFIG_PATH` instructions are added as a prefix to the command.
  This works for system libraries as well, because the paths are
  ignored if they do not exist.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-08 14:46:43 +02:00
Hidde Beydals a959ee77f6 Add `help` target to `Makefile`
To help listing the available commands, using the same formatting as
already used in `fluxcd/flux2`.

Signed-off-by: Hidde Beydals <hello@hidde.co>
2021-10-08 14:46:43 +02:00
Michael Bridgen 263ff7cdd4
Merge pull request #232 from fluxcd/use-trace-loglevel
Use pkg/runtime consts for log levels
2021-10-06 17:30:38 +01:00
Michael Bridgen b19eaf67f4 Use pkg/runtime consts for log levels
github.com/fluxcd/pkg/runtime/logger now supports the trace log level,
and has consts for the V(...) argument to supply. This commit updates
that module so to use those consts.

Previously, trace messages were output at the debug level; after this
commit they will be in their own level, so you need

    --log-level=trace

to see them.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-10-06 16:10:05 +01:00
Michael Bridgen 7ec4e6150e
Merge pull request #224 from DavidKorczynski/nil-deref-fix
Fix nil-dereference in controller
2021-09-30 10:26:03 +01:00
David Korczynski 5a831a8a00
Fix nil-dereference in controller
Signed-off-by: David Korczynski <david@adalogics.com>
2021-09-29 18:06:11 +01:00
Michael Bridgen a5aafca441
Merge pull request #219 from fluxcd/sample-v1beta1
Provide a sample of v1beta1 ImageUpdateAutomation
2021-09-20 11:11:59 +01:00
Michael Bridgen 1a77c05bbb Provide a sample of v1beta1 ImageUpdateAutomation
Signed-off-by: Michael Bridgen <michael@weave.works>
2021-09-16 17:40:57 +01:00
Stefan Prodan 55b55c66de
Merge pull request #212 from fluxcd/release-v0.14.1
Release 0.14.1
2021-08-05 18:14:39 +03:00
Stefan Prodan aadf60fa1e
Release 0.14.1
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-05 17:55:18 +03:00
Stefan Prodan 4e8ffa1c2c
Merge pull request #211 from fluxcd/update-deps
Update dependencies
2021-08-05 17:51:33 +03:00
Stefan Prodan 5cf4c4a5a6
Update dependencies
- k8s.io/* v0.21.3
- controller-runtime v0.9.5
- source-controller/api v0.15.4
- image-reflector-controller/api v0.11.1

Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-08-05 17:27:25 +03:00
Michael Bridgen bd7af24306
Merge pull request #198 from aaron-trout/policy-typo
Fix Typo: policiy -> policy
2021-07-19 15:05:56 +01:00
Aaron Trout c99bc07ac7
Fix Typo: policiy -> policy
Signed-off-by: Aaron Trout <atrout@confluent.io>
2021-07-14 12:54:13 +01:00
Michael Bridgen 70eb6c4a62
Merge pull request #195 from fluxcd/rejected-branch-push
Fail push if a ref update is rejected
2021-07-14 10:50:46 +01:00
Michael Bridgen 3476ecb950 Fail push if a ref update is rejected
libgit2's Push method will succeed even when ref updates are rejected,
meaning it can silently fail if you e.g., use branch protection in
GitHub.

To make these errors visible, a callback is supplied to Push, which
checks for a non-empty status (on the advice of
https://libgit2.org/libgit2/#HEAD/group/callback/git_push_update_reference_cb).

For whatever reason, gogit seems overly sensitive to hook errors (in a
way that `git` and libgit2 aren't), and reports "invalid pkg-len
found" when it sees a rejected ref message. This doesn't affect the
runtime code, since that uses libgit2 -- but it does affect the test
code, which initialises the git repo used in many tests, so more care
is needed to push only the main branch, so as not to trigger a
rejection.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-07-13 16:06:17 +01:00
Michael Bridgen 3102d487ff
Merge pull request #193 from fluxcd/release-v0.14.0
Release v0.14.0
2021-06-28 14:57:55 +01:00
Michael Bridgen a46981f660 Bump version used in controller config
Signed-off-by: Michael Bridgen <michael@weave.works>
2021-06-28 14:45:21 +01:00
Michael Bridgen 7ae502fee4 Write changelog entry for v0.14.0
Signed-off-by: Michael Bridgen <michael@weave.works>
2021-06-28 14:44:39 +01:00
Michael Bridgen 4a34480a8d Bump version of image (automation) API to v0.14.0
Signed-off-by: Michael Bridgen <michael@weave.works>
2021-06-28 14:35:31 +01:00
Michael Bridgen 5711c59e5b
Merge pull request #191 from fluxcd/api-v1beta1
Graduate to v1beta1
2021-06-28 14:32:10 +01:00
Michael Bridgen fd52463ac5 Use v1beta1 of the API from image reflector
This bumps the version of the image reflector types to v1beta1. This
doesn't technically make a difference for the minute, since the
Kubernetes API server would convert between versions, but is tidier.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-06-28 13:59:34 +01:00
Michael Bridgen 3629cc7d25 Download image reflector v1beta1 API
This bumps the image reflector CRDs, used in tests, to the release
including v1beta1.

It also removes a long-standing, occasional annoyance, which is that
the downloaded CRDs would conflict with each other unless you
remembered to do `make clean-test-deps`. Though you will have to do
that once more.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-06-28 13:56:51 +01:00
Michael Bridgen f64d6cd4c8 Port API guide from v1alpha2 to v1beta1
The guides are kept in versioned directories, but only one version
appears to make it to the documentation website. For that reason,
rather than trying to refer to the previous version's migration guide,
I've just copied it and adapted it minimally to the new version.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-06-28 11:26:59 +01:00
Michael Bridgen 5b9631327f Graduate v1alpha2 API to v1beta1
This does the following:

 - copies the type definitions from v1alpha2 to v1beta1
 - changes the "stored" version to v1beta1
 - gives the CRD a conversion strategy of None, meaning just rewrite the version
 - switches the controller to use v1beta1
 - moves the generated documentation to v1beta1

This effectively rebadges the v1alpha2 version of this part of the
image API to v1beta1. The v1alpha2 version is left in place; there are
no conversion issues, as with v1alpha1->v1alpha2. The CRD specifies
that converting between v1alpha2 and v1beta1 just means changing the
version (i.e., the schema and semantics are the same).

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-06-28 11:26:59 +01:00
Stefan Prodan c1533ea757
Merge pull request #192 from makkes/makkes/concurrent-reconciles
feat: add controller concurrency
2021-06-25 10:18:34 +03:00
Max Jonas Werner 93782755ef
feat: add controller concurrency
The controller is now working with 4 concurrent workers by default.
This value is configurable through the `--concurrent` flag.

Signed-off-by: Max Jonas Werner <mail@makk.es>
2021-06-24 20:15:00 +02:00
Michael Bridgen aabdcc92bb
Merge pull request #190 from fluxcd/more-debug-output
More debug output
2021-06-24 09:46:09 +01:00
Michael Bridgen 0a9c9a7437 Fill in tracking gaps
- trace different code paths, e.g., how the push branch is chosen
 - move debug output so it records things not already covered by e.g.,
   errors, events

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-06-23 12:23:36 +01:00
Michael Bridgen f011f2334e Thread debug/tracing through controller and pkg/
This commit finesses the use of the debug log a little, and introduces
a trace log. The trace log gets threaded through calls to utility
procedures -- it's a little awkward putting loggers into func
parameters and structs, but it always is.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-06-23 10:57:04 +01:00
Michael Bridgen c798f559fe Let log level be supplied for make run
It's useful to be able to run with debug logging, which you can do now
with:

    make run LOG_LEVEL=debug

As a companion change, logging from `make run` is now explicitly set
to console format, since the expectation is it will be run from a
console.

Signed-off-by: Michael Bridgen <michael@weave.works>
2021-06-22 15:47:50 +01:00
Stefan Prodan a13bbb69ca
Merge pull request #189 from fluxcd/release-v0.13.0
Release v0.13.0
2021-06-22 16:20:03 +03:00
Stefan Prodan 773d2bcb71
Release v0.13.0
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-06-22 16:01:06 +03:00
Stefan Prodan 8c455cea39
Merge pull request #188 from fluxcd/source-controller-v0.15.2
Update source-controller to v0.15.2
2021-06-22 15:59:20 +03:00
Stefan Prodan 8b3c4420bb
Update source-controller to v0.15.2
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-06-22 15:49:10 +03:00
Stefan Prodan 5ba9ef9efb
Merge pull request #187 from fluxcd/debian
Use Debian as base image
2021-06-22 15:04:01 +03:00
Stefan Prodan c309c9515e
Use Debian Slim for the controller base image
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-06-22 13:58:40 +03:00
Stefan Prodan 1142f776ff
Use Debian for running unit tests
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
2021-06-22 11:50:28 +03:00