Commit Graph

12 Commits

Author SHA1 Message Date
Sanskar Jaiswal f5c9dbbb03
add tests to check object's status message
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2024-03-12 12:07:08 +01:00
Sanskar Jaiswal e7cd5c07f1
fix push branch reporting if its equal to checkout branch
Fix the push branch reported in the logs and status if
`.spec.git.push.branch==.spec.git.checkout.branch`.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2024-03-12 12:07:08 +01:00
Sanskar Jaiswal 4505fa56da
add support for specifying push options
Add `.spec.git.push.options` to allow specifying the push options to be
sent to the upstream Git server during a push operation. For more info,
see: https://git-scm.com/docs/git-push#Documentation/git-push.txt---push-optionltoptiongt

This is useful for platforms like GitLab when used with
image-automation-controller by enabling the creation of MRs automatically
upon a push operation (ref: https://docs.gitlab.com/ee/user/project/push_options.html#push-options-for-merge-requests)

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2024-03-12 12:07:06 +01:00
Sanskar Jaiswal 4f200b148c
add proxy support for Git operations
Add proxy support for Git operations using the proxy configuration
specified in the source GitRepository's `.spec.proxySecretRef`.

Refactor the Git client building process to make it more testable.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2024-03-12 12:07:06 +01:00
Sanskar Jaiswal 1bda340df0
git: add push.refspec to push using a refspec
Add `.spec.git.push.refspec` to allow specifying a refspec to be used
for performing a push operation. If specified alongside
`.spec.git.push.branch`, two push operations, one for each specified
push configuration will be performed.

Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2024-03-12 12:07:05 +01:00
Sunny ccde21b37c
Delete stale metrics on object delete
The metrics helper now accepts owned finalizers to determine if an
object is no longer managed by the controller and is being deleted, and
deletes the metrics associated with the object.

Call the metrics recording defer function in controller early to be able
to record the object in deleting state.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2024-03-12 12:07:04 +01:00
Sunny a3d3419a1a
Handle delete before adding finalizer
In Reconcile() method, move the object deletion above add finalizer.
Finalizers can't be set when an object is being deleted.

Introduce a cacheless client in suite_test to use for testing this
change. It ensures that the Reconcile() call always operates on the
latest version of the object which has the deletion timestamp and
existing finalizer.

Signed-off-by: Sunny <darkowlzz@protonmail.com>
2024-03-12 12:07:03 +01:00
Sanskar Jaiswal 09f54512d9
check if GPG private key is nil before decrypting
Signed-off-by: Sanskar Jaiswal <jaiswalsanskar078@gmail.com>
2024-03-12 12:06:58 +01:00
Hidde Beydals fe073b3e46
Return signing entity parsing error
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2024-03-12 12:06:57 +01:00
Hidde Beydals e93bf0e8c9
Set controller package name
Set package name in the files under internal/controller to have the
base name of the directory.

This style is recommended by Go, and certain text editors/IDEs get
confused when the names don't match.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2024-03-12 12:06:57 +01:00
Hidde Beydals 7d88985ab2
Drop go-git fork in favor of go-git v5.7.0
This replaces the `fluxcd/go-git` fork with official go-git v5.7.0
release, after all patches from the fork have been included
upstream.

Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2024-03-12 12:06:55 +01:00
Hidde Beydals f725068d20
Rename controllers to controller
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
2024-03-12 12:06:55 +01:00