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
Add github_webhook module #35813
Add github_webhook module #35813
Conversation
@adrianmoisey @Akasurde @andreparames @bincyber @dj-wasabi @djmattyg007 @dsummersl @pcgentry @yeukhon As a maintainer of a module in the same namespace this new module has been submitted to, your vote counts for shipits. Please review this module and add |
bea696c
to
c7f4133
Compare
The test
|
shipit |
b4f4c95
to
4811087
Compare
The test
|
@@ -0,0 +1,240 @@ | |||
#!/usr/bin/python | |||
# | |||
# Copyright: (c) Ansible Project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Copyright: (c) 2018, Ansible Project
DOCUMENTATION = ''' | ||
--- | ||
module: github_webhook | ||
short_description: Manage Github webhooks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Github/GitHub/
short_description: Manage Github webhooks | ||
version_added: "2.6" | ||
description: | ||
- "Create and delete Github webhooks" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add more description here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What more is needed? This seems sufficient to me.
break | ||
except github.GithubException as err: | ||
module.fail_json( | ||
msg="Unable to get hooks from repository %s: %s" % to_native(err), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too few format values
Unable to get hooks from repository : %s" % to_native(err)
changed, data = create_hook(repo, module) | ||
elif hook is not None and module.params["state"] == "absent": | ||
hook.delete() | ||
changed = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will always return changed even if there is failure in deleting hook.
7ffd423
to
a708ace
Compare
a708ace
to
8925751
Compare
The test
|
github_webhook lets you easily create, update and delete Github webhooks. This is part of a two-part replacement for github_hooks, which lacks a number of important features and has a strange interface.
256d7b4
to
d225f39
Compare
@Akasurde I believe your objections have mostly been addressed. |
Need another pair of eyes to approve this. |
I made a change by specifying |
Merged into |
* Add github_webhook module github_webhook lets you easily create, update and delete Github webhooks. This is part of a two-part replacement for github_hooks, which lacks a number of important features and has a strange interface.
SUMMARY
github_webhook
lets you easily create, update and delete Github webhooks.This is part of a two-part replacement for
github_hooks
, which lacks a number of important features and has a strange interface.The other parts are:
github_webhook_facts
module: Add github_webhook_facts module #35814github_hooks
module: Deprecate the github_hooks module #49296github_hooks
lacks a number of important features: The ability to specify the events on which a webhook should fire; the ability to add a shared secret to a hook; the ability to create hooks that do not verify SSL against their target; and more. I considered merely updating that module to add the features needed, but the existing interface is pretty odd and would be difficult to update in a backwards-compatible way. For instance, it has a built-in feature for deleting all hooks whose last request returned 504 (action: clean504
), but no way to update an existing hook, or delete a specific hook. It requires you to provide the API URL to a repository, rather than just the name of the repo (and optionally a Github API base), which requires a fair degree of familiarity with the Github API.It has other issues that are easier to fix, but still weighed in on my decision to replace rather than upgrade: it rolls its own API client layer rather than using an existing library; it appears to support both password and API token auth, but only accepts a single
oauthkey
argument, which is a misnomer in both cases.Rather than try to update it and fix all of the issues, I replaced it with two modules whose usage patterns are, I hope, much more intuitive.
ISSUE TYPE
COMPONENT NAME
github_webhook
ANSIBLE VERSION