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

webhooks are still around after npx pepr dev #739

Closed
cmwylie19 opened this issue Apr 12, 2024 · 0 comments · Fixed by #816
Closed

webhooks are still around after npx pepr dev #739

cmwylie19 opened this issue Apr 12, 2024 · 0 comments · Fixed by #816
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@cmwylie19
Copy link
Collaborator

cmwylie19 commented Apr 12, 2024

Is your feature request related to a problem? Please describe.

It is annoying to people who are testing modules that the Validating/MutatingWebhookConfigurations stick around after npx pepr dev

Describe the solution you'd like

  • Given you run npx pepr dev
  • When you escape out of the command
  • Then the webhook are cleaned up

Solution could be to warn the user or clean it up.

There could be code like this to clean up the webhooks here

Describe alternatives you've considered

(optional) A clear and concise description of any alternative solutions or features you've considered.

Additional context

Add any other context or screenshots about the feature request here.

@cmwylie19 cmwylie19 added enhancement New feature or request good first issue Good for newcomers labels Apr 12, 2024
@cmwylie19 cmwylie19 added this to the v0.32.0 milestone May 20, 2024
@cmwylie19 cmwylie19 self-assigned this May 20, 2024
btlghrants added a commit that referenced this issue May 21, 2024
## Description

This clears up issue 739 and removes the webhooks by listening for
`SIGINT` on the process and listening for `close` on the program (child
process) and upon receiving the signal removing the webhooks with a
`Promise.all`.

Test:
```bash
# in one terminal
$> npm test 
$> cd pepr-test-module
$> npx pepr dev --confirm
# in another terminal
$> k get mutatingwebhookconfiguration,validatingwebhookconfiguration -oyaml # should be two
# HIT CTRL+C IN TERMINAL 1
$> k get mutatingwebhookconfiguration,validatingwebhookconfiguration -oyaml # should be 0
```



## Related Issue

Fixes #739 
<!-- or -->
Relates to #

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Other (security config, docs update, etc)

## Checklist before merging

- [x] Test, docs, adr added or updated as needed
- [x] [Contributor Guide
Steps](https://docs.pepr.dev/main/contribute/contributor-guide/#submitting-a-pull-request)
followed

---------

Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
Co-authored-by: Barrett <81570928+btlghrants@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant