Add support for GitLab Environments and Deployments
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:
- Create an environment via gitlab-ci: https://docs.gitlab.com/ee/ci/environments/#prepare-an-environment-without-creating-a-deployment
- 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:
- name of the GitLab project's environment (created in step 1 above)
- which branch we're syncing with in the source-controller
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
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.