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

Add webhook management for repositories and organizations #154

Merged

Commits on Aug 22, 2023

  1. Add admin required middleware and webhook endpoint

      * Add a new middleware that tests for admin access
      * Add a new controller ID suffixed webhook endpoint. This will be used
        to accept webhook events on a webhook URL that is suffixed with our own
        controller ID.
    
    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    f2796f1 View commit details
    Browse the repository at this point in the history
  2. Add functions to (un)install webhooks for orgs and repos

    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    7ce3f00 View commit details
    Browse the repository at this point in the history
  3. Add CLI webhook enablement

    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    dbd41f5 View commit details
    Browse the repository at this point in the history
  4. Return bad request if hook already installed

    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    6051fa0 View commit details
    Browse the repository at this point in the history
  5. Add webhook show, return info and some fixes

      * Added a webhook show command. This gives us info about the webhook and
        if it is installed.
      * Return webhook info when installing the webhook
      * Small typo fixes.
    
    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    779afe9 View commit details
    Browse the repository at this point in the history
  6. Remove webhook when removing an entity & cmd fixes

      * When removing a repo or org, we uninstall the webhook as well.
      * Upgrade cobra command and mark "webhook-secret" and "random-webhook-secret"
        as MarkFlagsOneRequired()
    
    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    763eb70 View commit details
    Browse the repository at this point in the history
  7. Add keepWebhook flag when deleting entities

    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    bb6ee9c View commit details
    Browse the repository at this point in the history
  8. Add optional keepWebhook flag when removing an entity

    The user can opt to not delete the webhook (if installed) when removing
    the entity from garm. Garm will only ever try to remove a webhook that
    exactly matches the URL that is composed of the base webhook URL configured
    in the config.toml file and the unique controller ID that is generated
    when the controller is first installed. It should be safe to remove the
    webhook when the entity is removed.
    
    Of course, this behavior can be disabled.
    
    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    c00048e View commit details
    Browse the repository at this point in the history
  9. Add flag to toggle webhook management

    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    1c0ff85 View commit details
    Browse the repository at this point in the history
  10. Fixup field name

    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    c641e1d View commit details
    Browse the repository at this point in the history
  11. Return details in case PAT does not have access

    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    d57e488 View commit details
    Browse the repository at this point in the history
  12. Update comment on option

    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    64d3da4 View commit details
    Browse the repository at this point in the history
  13. Add ping hook functions to client

    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    7bd3e0b View commit details
    Browse the repository at this point in the history
  14. ping the webhook after creation

    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    93bfb6f View commit details
    Browse the repository at this point in the history
  15. Add optional --install-webhook flag when creating repo/org

    Signed-off-by: Gabriel Adrian Samfira <[email protected]>
    gabriel-samfira committed Aug 22, 2023
    Configuration menu
    Copy the full SHA
    3b651af View commit details
    Browse the repository at this point in the history