Add option to configure the Container Registry notifications
📻 Context
We are building more features around the GitLab Container Registry.
Several of these require to do something after a container image has been pushed. The main challenge here is that $ docker
clients will push the image directly to the Container Registry backend without interacting back with the Rails backend.
One way we found to cover this need is using the Container Registry notifications. In very short words, the Container Registry can be configured to call a specific url as a callback after an operation happened, like an image push.
Rails has such endpoint and is ready to get those events.
However, these Container Registry notifications are disabled by default and needs configuration. This MR introduces the notifications_enabled
boolean field under the registry
to help with this configuration.
This way, developer don't need to recall which Container Registry configuration section has to be set up for notifications. It's all covered by the config templates.
🔬 What does this merge request do and why?
- Adds a
notifications_enabled
field under theregistry
key of thegdk.yml
file. - When enabled, configure a proper
notifications
section in the Container Registry config file. - Update the
gitlab.yml
to have the correct shared secret string. - Update the related specs.
- Update the related documentation.
⚗ How to set up and validate locally
Add the notifications_enabled
field to gdk.yml
:
registry:
...
notifications_enabled: true
$ gdk reconfigure
Check registry/config.yml
and you should see this part:
notifications:
endpoints:
- name: gitlab-rails
url: http://<rails host and port>/api/v4/container_registry_event/events
headers:
Authorization: [notifications_secret]
timeout: 500ms
threshold: 5
backoff: 1s
🎯 Impacted categories
The following categories relate to this merge request:
-
gdk-reliability - e.g. When a GDK action fails to complete. -
gdk-usability - e.g. Improvements or suggestions around how the GDK functions. -
gdk-performance - e.g. When a GDK action is slow or times out.
🏁 Merge request checklist
-
This change is backward compatible. If not, please include steps to communicate to our users. -
Tests added for new functionality. If not, please raise an issue to follow-up. -
Documentation added/updated, if needed. -
Announcement added, if change is notable. -
gdk doctor
test added, if needed. -
Add the ~highlight
label if this MR should be included in theCHANGELOG.md
.