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

feat: playbooks #499

Merged
merged 42 commits into from
Aug 25, 2023
Merged

feat: playbooks #499

merged 42 commits into from
Aug 25, 2023

Conversation

adityathebe
Copy link
Member

No description provided.

@adityathebe adityathebe linked an issue Aug 16, 2023 that may be closed by this pull request
playbook/actions.go Outdated Show resolved Hide resolved
@adityathebe adityathebe marked this pull request as ready for review August 18, 2023 03:49
@adityathebe
Copy link
Member Author

@moshloop This is ready for review now.

  • implemented approvals by a person/team
  • endpoint that lists all the suitable playbooks for a config/component

@adityathebe
Copy link
Member Author

@moshloop @yashmehrotra I've added a new application level error struct that can be easily mapped to HTTP errors. It was kind of necessary for me right now so I've added it in this PR itself.

It's pretty much a copy of https://github.com/benbjohnson/wtf/blob/main/error.go with some minor changes.

playbook/playbook.go Outdated Show resolved Hide resolved
})

ginkgo.It("should store playbook run via API", func() {
run := RunParams{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it is necessary to call these functions via HTTP - we can all the functions directly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything about saving a playbook run is handled by the HTTP handler. The actual task is simply to save to DB and the handler performs other validation on top of that.

I think its better to test the handler this way than just directly saving to db from the test.


func (t *queueConsumer) Listen() error {
pgNotify := make(chan string)
go utils.ListenToPostgresNotify(t.pool, "playbook_run_updates", t.dbReconnectMaxDuration, t.dbReconnectBackoffBaseDuration, pgNotify)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this method to the QueueConsumer .e.g

t.PgListen("playbook_spec_approval", approvalUpdated)

playbook/runner.go Outdated Show resolved Hide resolved
playbook/runner.go Outdated Show resolved Hide resolved
playbook/runner.go Outdated Show resolved Hide resolved
@moshloop moshloop merged commit eee91a9 into main Aug 25, 2023
5 checks passed
@moshloop moshloop deleted the feat/playbooks branch August 25, 2023 15:01
@adityathebe adityathebe mentioned this pull request Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Playbooks / Actions
2 participants