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

Re-writes activations logs command subtree in Go #1282

Merged
merged 39 commits into from
Oct 24, 2022

Conversation

ddebarros
Copy link
Contributor

@ddebarros ddebarros commented Oct 15, 2022

This PR re-write the doctl sls activations logs subtree in native go-lang. All existing behavior is maintained.

joshuaauerbachwatson and others added 30 commits September 7, 2022 09:57
…e-merge-main

Merge main into feature/serverless
…alocean#1232)

* Add support for triggers

* Add lastRun field to trigger list output

* Hide commands we won't be supporting in EA day 1

* Bump deployer version to pick up bug fix

* Fix error handling in services related to triggers

Many calls were not checking for errors.

* Switch to latest API

Change both the triggers command (native to doctl) and the deployer
version (which affects the semantics of deploy/undeploy).

* Pick up latest deployer (triggers bug fix)

* Remove support for prototype API and clean up code

* Fix unit tests

* Fix misleading comment

* Remove added complexity due to successive change

* Add filtering by function when listing triggers

* Fix omitted code in DeleteTrigger

* Guard triggers get/list with status check

Otherwise, the credentials read fails with a cryptic error instead of
an informative one when you are not connected to a namespace.
…-main

Merge latest `main` changes into `feature/serverless`
This completes the elimination of plugin usage in doctl sls fn and the
functions.go source file.
I believe this happened in merge conflict resolution during the recent
rebase.
Affects what happens when a failure occurs in the middle of deleting
functions and triggers together.
…on-list-no-plugin

Finish eliminating plugin usage in 'doctl sls functions' + testing improvements
…#1270)

* WIP for converting activations to direct OW flows

* Finish recoding 'activations get' in native doctl

Tests still to come

* Convert the support for sls actv result

Tests not converted yet

* Generate latet mocks

* Fix some comments

* Use more realistic timestampes

* Revise tests for new paths.  Still no output check

* Tests are now doing meaningful output comparison

Fixed some bugs found once tests were really effective
Re-writes activations list command subtree in Go
…ixes bug with package filtering, and fixes the order we display logs
@ddebarros ddebarros changed the title Re-writes activations list command subtree in Go Re-writes activations log command subtree in Go Oct 15, 2022
@ddebarros ddebarros changed the title Re-writes activations log command subtree in Go Re-writes activations logs command subtree in Go Oct 15, 2022
@ddebarros ddebarros marked this pull request as ready for review October 15, 2022 02:53
Copy link
Contributor

@joshuaauerbachwatson joshuaauerbachwatson left a comment

Choose a reason for hiding this comment

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

Several comments. Concerning whether to get another opinion on the wait group logic, I don't feel strongly about that. I know you got some advice on it already.

commands/activations.go Outdated Show resolved Hide resolved
return nil

} else if followFlag {
var wg sync.WaitGroup
Copy link
Contributor

Choose a reason for hiding this comment

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

As we discussed, I don't really know about wait groups so my approval of this section is based on a somewhat superficial reading. Do we want to get someone who is more expert to sign off? This does seem to work but I'm also lacking in ideas about how to test it thoroughly.

Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we might just want to simplify things here and not use the wait group? Wait groups are very useful when you have multiple pieces of work to do in parallel and want to block until they have all completed. In this case, we're only polling for logs. We can remove a bit of complexity by just calling pollActivations and blocking until it completes. It would need to be updated to return an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made some updates to remove the wait group. I left the other error and signal channel so I can display a cleaner output when users use control+c

without it I get the signal interrupted which I didn't like.

⇒ go run cmd/doctl/main.go sls activations logs --follow
^Csignal: interrupt

commands/activations.go Show resolved Hide resolved
commands/activations.go Outdated Show resolved Hide resolved
commands/activations.go Outdated Show resolved Hide resolved
…, removes both the timeout and only keeps the ticker
Copy link
Contributor

@joshuaauerbachwatson joshuaauerbachwatson left a comment

Choose a reason for hiding this comment

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

This is looking fine to me now.

The PR is currently targeted to feature/serverless. Its merge target should now be main, since PR #1290 has been merged and we are no longer staging on the feature/serverless branch. I'm approving on the assumption that the base branch will be edited (and tests re-verified) prior to any merge.

@ddebarros ddebarros changed the base branch from feature/serverless to main October 24, 2022 10:29
@ddebarros ddebarros dismissed joshuaauerbachwatson’s stale review October 24, 2022 10:29

The base branch was changed.

Copy link
Contributor

@joshuaauerbachwatson joshuaauerbachwatson left a comment

Choose a reason for hiding this comment

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

LGTM 👍

I am slightly concerned to see so many commits in the PR, but the actual changed files seem exactly right. Hoping that once we get past the lump created by the recent merge of feature/serverless and the attendant need to rebase, we will stop seeing regurgitated commits and new PRs will be cleaner. I am assuming this will be squashed when merged.

@andrewsomething andrewsomething merged commit 97da96a into digitalocean:main Oct 24, 2022
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.

3 participants