fluxcd / notification-controller

The GitOps Toolkit event forwarder and notification dispatcher
https://fluxcd.io
Apache License 2.0
150 stars 131 forks source link

Add support for GitLab Environments and Deployments #225

Open cskarby opened 3 years ago

cskarby commented 3 years ago

I'm looking at the git commit status notification provider for GitLab and is wondering if there would be interesting to extend the capabilities to work with GitLab Environments and Deployments, see https://docs.gitlab.com/ee/ci/environments/ ?

I believe it should be possible to:

  1. Create an environment via gitlab-ci: https://docs.gitlab.com/ee/ci/environments/#prepare-an-environment-without-creating-a-deployment
  2. Make the notification controller post a deployment (with success/failed status) to GitLab: https://docs.gitlab.com/ee/api/deployments.html#create-a-deployment (if the environment name does not exist, probably also create this first?)

For this to work we would need some more information for the notification:

It seems that the golang library used to post back to gitlab, already has support for Deployments, see https://github.com/fluxcd/notification-controller/blob/15d98c9afca937d01c64c7753df4615045f2fc65/internal/notifier/gitlab.go#L26 and https://github.com/xanzy/go-gitlab#coverage

jrauschenbusch commented 2 years ago

Would be a really cool feature for Gitlab. But i think first there needs to be the new dedicated CommitStatus CRD so that there is more flexibility for such specific fields.