(GitLab?) Webhooks don't work with non-default branches.
Summary
For NodeCore, I have the following setup:
- The
nodecore_alphapackage tracks thedevbranch ofgitlab.com/sztest/nodecore, which can receive frequent new commits for new development. I want this package to always track as close as possible to the current state of development. - The
nodecorepackage tracks themasterbranch ofgitlab.com/sztest/nodecore, which receives occasional fast-forward merges from thedevbranch as things stabilize. I want this package to track approved stable versions of the code, which I manage by moving the branch head.
I want to use webhooks to manage each of these. This would involve setting up 2 webhooks in a single gitlab repo pointing to different CDB packages. Gitlab does not appear to provide any way to filter or otherwise configure webhooks; any push of any ref(s) would cause both webhooks to fire each time.
I want pushing to the dev branch to trigger a release of nodecore_alpha only, pushing to the master branch to trigger a release of nodecore only, and pushing unrelated (e.g. topic) branches not to trigger any releases. I also want the releases to use the correct source branch, but there's nowhere to associate a branch with a package (the association appears to only exist at the time a release is created).
Steps to reproduce
- Setup a repository in GitLab.
- Setup a package in CDB meant to track a branch other than
masterin CDB. - Push commits to that branch.
Expected behavior:
CDB creates a release for the package from the dev branch.
Observed behavior:
CDB creates a release for the package from the master branch.
Other scenarios to test:
(Have one package tracking master and one tracking dev)
- Pushes to
mastershould create a release on the master-tracking package from themasterbranch. - Pushes to
mastershould NOT create a release on the dev-tracking branch. - Pushes to the
devbranch should NOT create a release on the master-tracking branch.
I think there are three issues here:
- A bug: ContentDB creates a release from the wrong reference specified by a GitLab webhook. CDB reads
json["after"]to find the commit hash after the push. (this issue) - A bug: ContentDB treats Git VCS as a unique value, so multiple packages having the same repo will confuse it. (New: #264)
- A feature: The ability to ignore all webhooks not on the specified branch (New: #265)
I want to use webhooks to manage each of these. This would involve setting up 2 webhooks in a single gitlab repo pointing to different CDB packages.
FYI: you should be able to one webhook with an API Token not bound to a package once #264 is fixed