Flux Receiver Integration
This change set introduces a new Flux module which is the first part of the GitLab agent - Flux integration.
The module consists mainly of a controller that for Flux GitRepository objects creates associates Receivers to trigger a Flux reconciliation on a git push for that particular GitLab project.
Try it out
I suggest to enable debug logs on the agent you are testing with to see what the controller does.
If you are running the agent outside of the cluster you may configure the webhook endpoint that is called - you can use a Kubernetes Service Proxy URL, like this in the agent config (and see the debug option ;)):
flux:
webhook_receiver_url: /api/v1/namespaces/flux-system/services/http:webhook-receiver:80/proxy
observability:
logging:
level: debug
Then you can use the Flux CLI to create a GitRepository object, using something like this:
flux create source git test --url https://gdk.test:3443/root/agentk-flux.git --branch main --ca-file ../gitlab-development-kit/gdk.test.crt
After that you should already see logs of the agentk that it created the receiver etc.
You can then also emit an update event so that the webhook is triggered using the gdk rails console
:
client = Gitlab::Kas::Client.new()
=> #<Gitlab::Kas::Client:0x0000000139d56a58>
[2] pry(main)> client.send_git_push_event(project: Project.find(21))
Project Load (2.2ms) SELECT "projects".* FROM "projects" WHERE "projects"."id" = 21 LIMIT 1 /*application:console,db_config_name:main,console_hostname:tuxmac.local,console_username:timo,line:(pry):2:in `__pry__'*/
Route Load (0.5ms) SELECT "routes".* FROM "routes" WHERE "routes"."source_id" = 21 AND "routes"."source_type" = 'Project' LIMIT 1 /*application:console,db_config_name:main,console_hostname:tuxmac.local,console_username:timo,line:/app/models/concerns/routable.rb:141:in `block in full_attribute'*/
=> <Gitlab::Agent::Notifications::Rpc::GitPushEventResponse: >