Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: webhook not called for branch create/delete/rebase/merge events #5219

Open
wvandeun opened this issue Dec 15, 2024 · 1 comment
Open
Labels
group/backend Issue related to the backend (API Server, Git Agent) type/bug Something isn't working as expected

Comments

@wvandeun
Copy link
Contributor

Component

API Server / GraphQL

Infrahub version

1.0.9 and below

Current Behavior

When you create, delete, rebase or merge a branch in Infrahub, the external webhook receiver is not called.

Expected Behavior

The webhook receiver is called when a branch is created, deleted, rebased or merged.

Steps to Reproduce

  • start a webhook receiver (a simple flask example)
from flask import Flask, jsonify, request
from pprint import pprint as pp

app = Flask(__name__)


@app.route("/", defaults={"path": ""}, methods=["POST"])
@app.route("/<path:path>", methods=["POST"])
def catch_all(path):
    print("Received a POST request on /" + path)
    data = request.get_json()
    print("Data Received:")
    pp(data)
    return jsonify({"status": "success", "message": "POST request received"}), 200


if __name__ == "__main__":
    app.run(debug=False, port=8200)
  • spin up instance of Infrahub
  • set up the webhook receiver in Infrahub
  • create/delete/rebase or merge a branch

Additional Information

No response

@wvandeun wvandeun added type/bug Something isn't working as expected group/backend Issue related to the backend (API Server, Git Agent) labels Dec 15, 2024
@ogenstad
Copy link
Contributor

I wouldn't classify this as a bug it's the expected behaviour with the existing code. The webhooks only fire on node mutated events. Instead of having this as a bug it should be a feature request and I don't think it's something that should happen automatically instead we should look at redesigning the webhooks completely and allow users to select the type of events that would trigger webhooks to be sent. It could also be branch aware so that we only trigger some event types on the default branch alternatively non-default branches. Also we might want things like filtering to only send webhooks for certain types of nodes within a given namespace etc. There are other event types that could be considered as missing as well such as when a proposed change is opened / merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent) type/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

2 participants