In Reconcile() methods, move the object deletion above add finalizer.
Finalizers can't be set when an object is being deleted.
Signed-off-by: Sunny <darkowlzz@protonmail.com>
This change makes identifying the source of certain errors easier,
e.g. in test failures or container logs.
Signed-off-by: Max Jonas Werner <mail@makk.es>
try.gitea.io, used before this change for testing the Gitea notifier,
has been provisioned with a bug that broke the tests. Now, the tests
are run against a mock HTTP server mimicking parts of Gitea's API so
that the tests don't rely on that 3rd-pary service, anymore.
Signed-off-by: Max Jonas Werner <mail@makk.es>
This to prevent collisions between different event attributes.
For example when first an event with revision `foo` is received
without a token, after which a token `foo` is received without a
revision.
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
This appends the metadata summary field in the genre (if one exists)
otherwise retains the fluxcd entry.
Signed-off-by: Kevin McDermott <bigkevmcd@gmail.com>
Introduce event fixtures in the eventhandler test to prevent
sideeffects from the previous test case. The event fixtures are used
to reset the event used in the test cases to an initial fixed value.
The reset is moved to the beginning of subtest to ensure those variables
always get reset at the beginning of a subtest. The previous
implementation in which the reset was done at the end doesn't get
executed when a test fails.
This helps ensure that two consecutive test cases don't use the same
event value.
Signed-off-by: Sunny <darkowlzz@protonmail.com>
- Update usage of old GitRepository API.
- In eventhandler test, create new `g` per subtest and pass it to the
assertion helpers to resolve confusing error message. Without this,
when a subtest fails, root level `g` of the test complains that a
subtest may have called FailNow on parent test. Also, mark the
assertion helpers as test helpers.
Signed-off-by: Sunny <darkowlzz@protonmail.com>
Use `.status.webhookPath` as a key to index Receivers. Use this key
while listing Receivers during the handling of a payload.
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
Receiver .status.url was deprecated in v1beta2 API and replaced with
.status.webhookPath. Remove it from v1 API and all references to it.
Signed-off-by: Sunny <darkowlzz@protonmail.com>
This commit bumps the Receiver API version to v1 in preparation of
the Flux GitOps GA milestone
(https://fluxcd.io/roadmap/#flux-gitops-ga-q1-2023).
We are now actively maintaining two versions of the notification API
group in parallel: v1 which currently only holds the Receiver kind and
v1beta2 for all other kinds.
Since we haven't run into this situation before, I had to change the
way we expose the API docs in ./docs/api: The directory now has
sub-directories for each active API version. Therefore we need to
change our scripts in the website repository to take this change into
account so that we expose both API group version at
https://fluxcd.io/flux/components/notification/api/. This change is
implemented in https://github.com/fluxcd/website/pull/1427.
refs #436
Signed-off-by: Max Jonas Werner <mail@makk.es>
You can re-enable caching by starting the controller with the argument
`--feature-gates=CacheSecretsAndConfigMaps=true`.
Signed-off-by: Hidde Beydals <hello@hidde.co>
Use the Provider cluster assigned UID to compose a unique commit status
ID to avoid name collisions when multiple clusters write to the same
repository.
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Establish conventions which aligns with what is supported upstream
today, whilst expanding on documentation to ensure folks have
pointers on how to debug/check for issues going forwards.
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>
This commit adds the "generic-hmac" Provider type for authenticating
webhook requests coming from notification-controller. I extended the
`Forwarder` notifier to accept an optional key used for generating the
HMAC. If the key is nil or empty no HMAC header is generated and the
forwarder behaves as before. If it is provided an `X-Signature` HTTP
header is added to the request carrying the HMAC.
I transformed the `TestForwarder_Post` test into a table-driven test
so that we can use the same setup and testing code for testing HMAC
and non-HMAC forwarder instances.
Any existing `X-Signature` header value set through
a `Provider.spec.secretRef` Secret's `header` field will be
overwritten.
closes#99
Signed-off-by: Max Jonas Werner <max@e13.dev>
The existing fuzzers were converted into the Go native format.
Based on how the code was structured on this project, the fuzzers
can be quite effective, allowing for entire E2E fuzzing in some
cases, but with very low execution cost.
Signed-off-by: Paulo Gomes <paulo.gomes@weave.works>