rancher / fleet

Deploy workloads from Git to large fleets of Kubernetes clusters
https://fleet.rancher.io/
Apache License 2.0
1.52k stars 229 forks source link

[FEATURE] Support for git hooks #252

Closed mkoperator closed 3 years ago

mkoperator commented 3 years ago

Howdy, we would like to see support for webhooks added to Fleet.

For large installations where we may have many microservices deployed with fleet via many repositories. The hits against our self hosted repositories could get overwhelming. This can be adjusted but is far from optimal.

Specifically, we would like to see this function with bitbucket but if it can be done by implementing standard git hooks then maybe it would work across all git vendors.

Thank you for your consideration.

StrongMonkey commented 3 years ago

Avaiable to test in v0.3.5-rc4. For docs reference: https://github.com/rancher/fleet/pull/335.

mkoperator commented 3 years ago

Did I read it correctly that the above release only supports github?

StrongMonkey commented 3 years ago

@thecrazyrussian No, It will support Github, GitLab, Bitbucket, Bitbucket Server and Gogs.

nickgerace commented 3 years ago

Test Configuration

Validation Method

Started an ngrok instance on the same VM that the k3s cluster is running on at port 80. Then, an Ingress was added using the ngrok URL for the gitjob service.

apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: webhook-ingress
  namespace: fleet-system
spec:
  rules:
  - host: <ngrok-url>
    http:
      paths:
        - path: /
          pathType: Prefix
          backend:
            serviceName: gitjob
            servicePort: 80

In the GitHub UI, a webhook was created using the ngrok URL without a secret. The repository used was a dummy repository with little contents.

webhook

Result

The webhook worked as intended on a push event into the dummy repository. This can be seen in the GitHub UI event logs.

webhook2