harbor: Webhook integration fails with "response code is 400"
Expected behavior and actual behavior: Hi all,
Currently we are facing an issue with the webhook integration in Harbor. We want to send outbound messages to our internal Mattermost application. I have set up a Mattermost Incoming Webhook for a private and public channel. For both channels we will see the following error messages in the logs:
Job 'WEBHOOK:0490888e0d6e06a2ba632b98' exit with error: run error: webhook job(target: https://URL/hooks/xxxx) response code is 400
The DEBUG log level is enabled.
Here is a screenshot, of the webhook I set up in Harbor:
Steps to reproduce the problem:
- Set up Incoming webhook in Mattermost
- Create webhook in a Harbor project with type
http
- Add the Mattermost Webhook URL
- Select
Verify Remote Certificate
- Pull or push an image from the project
Versions:
- harbor version: v2.4.0
- Mattermost: latest version
Are you aware of this or do you know how to fix this issue? Thank you in advance!
Alexander Barth (alexander.barth@mercedes-benz.com) on behalf of Daimler TSS, Provider Information
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 23 (4 by maintainers)
Hi @wy65701436 I think this is not a bug of Harbor, but I (and others as you can see above) would like to have this possibility to send messages to Mattermost. I could think about something in addition to the existing notify types
http
andslack
in the dropdown menu (e.g.mattermost
). In our organization thousands of people are using Mattermost and we as a platform team have a lot of customers who would like to have this feature/possibility. Therefore I would like to keep this issue open and hope, this could be something for the v2.7 release.Alexander Barth (alexander.barth@mercedes-benz.com) on behalf of Mercedes-Benz Tech Innovation GmbH, Provider Information
I am also interested in this. I can create a PR for Mattermost and Discord, if you are willing to merge it and integrate it in one of the next releases.
I thought about this problem a little longer and until this is fixed somehow officially, I tried to create some kind of bridge between Harbor and Mattermost and came up with the script attached. This is more like a skeleton atm, but I think one can get the idea.
You start the skript like this:
python3 echo_server.py <port to listen to> <Mattermost Server URL> <api_key>
and you have to set your Harbor Endpoint URL tohttp://<machine the script is running on>:<port to listen to>
It will listen for incoming messages, reformat them and then send them to you Mattermost Server. Yes, I know, no authentication, no SSL, only pull and replication events with more details atm, no nothing, but it is an idea.
It is mostly based on a gist I do not find anymore and the fabulous https://github.com/numberly/matterhook library, so you need to install that first:
pip install matterhook
Perhaps someone can build something more sophisticated based on this…
Python message bridge skeleton:
The issue still exists and needs to be fixed.