feat: abra app logs shows task errors #395

Merged
p4u1 merged 1 commits from p4u1/abra:logs-task-error into main 2023-12-14 13:15:24 +00:00
Member

The log command now checks for the ready state in the task list. If it is not ready. It shows the task errors. This might look like this:

ERRO[0000] Service abra-test-recipe_default_app: State rejected: No such image: ngaaaax:1.21.0 
ERRO[0000] Service abra-test-recipe_default_app: State preparing:  
ERRO[0000] Service abra-test-recipe_default_app: State rejected: No such image: ngaaaax:1.21.0 
ERRO[0000] Service abra-test-recipe_default_app: State rejected: No such image: ngaaaax:1.21.0 
ERRO[0000] Service abra-test-recipe_default_app: State rejected: No such image: ngaaaax:1.21.0 

Feel free to suggest a better error ouptput.

Closes coop-cloud/organising#518

The log command now checks for the ready state in the task list. If it is not ready. It shows the task errors. This might look like this: ``` ERRO[0000] Service abra-test-recipe_default_app: State rejected: No such image: ngaaaax:1.21.0 ERRO[0000] Service abra-test-recipe_default_app: State preparing: ERRO[0000] Service abra-test-recipe_default_app: State rejected: No such image: ngaaaax:1.21.0 ERRO[0000] Service abra-test-recipe_default_app: State rejected: No such image: ngaaaax:1.21.0 ERRO[0000] Service abra-test-recipe_default_app: State rejected: No such image: ngaaaax:1.21.0 ``` Feel free to suggest a better error ouptput. Closes https://git.coopcloud.tech/coop-cloud/organising/issues/518
p4u1 added 1 commit 2023-12-12 16:55:32 +00:00
continuous-integration/drone/pr Build is passing Details
e40d99bfe2
feat: abra app logs shows task errors
p4u1 force-pushed logs-task-error from e40d99bfe2 to 98671a9f92 2023-12-12 17:01:12 +00:00 Compare
decentral1se reviewed 2023-12-12 21:06:17 +00:00
decentral1se left a comment
Owner

Amazin' 💯

Amazin' 💯
cli/app/logs.go Outdated
@ -147,0 +99,4 @@
filters.Add("name", service.Spec.Name)
tasks, err := cl.TaskList(context.Background(), types.TaskListOptions{Filters: f})
if err != nil {
logrus.Fatal(err)
Owner

Slightly confusing that this function does return err and also logrus.Fatal(err). Maybe this is handier?

Slightly confusing that this function does `return err` and also `logrus.Fatal(err)`. Maybe this is handier?
Author
Member

Good catch! Changed it to return err. I did not change the logrus.Fatal(err) in the goroutine below because otherwise I would need to create an error channel.

Good catch! Changed it to `return err`. I did not change the `logrus.Fatal(err)` in the goroutine below because otherwise I would need to create an error channel.
decentral1se marked this conversation as resolved
@ -120,3 +110,4 @@
return filters, nil
}
func fmtFilter(appendMode bool, exact bool, stack string, service string) string {
Owner

Missing a docstring? Pretty cryptic function otherwise. Can be taken from the Filters docstring.

Missing a docstring? Pretty cryptic function otherwise. Can be taken from the `Filters` docstring.
Author
Member

I added a docstring and simplified the function by moving the appendMode into the tailLogs function.

I added a docstring and simplified the function by moving the `appendMode` into the `tailLogs` function.
decentral1se marked this conversation as resolved
@ -603,3 +606,3 @@
// GetTimeoutFromLabel reads the timeout value from docker label "coop-cloud.${STACK_NAME}.TIMEOUT" and returns 50 as default value
func GetTimeoutFromLabel(compose *composetypes.Config, stackName string) (int, error) {
var timeout = 50 // Default Timeout
timeout := 50 // Default Timeout
Owner

Should we maybe abstract to pkg/config/env.go as a constant?

Should we maybe abstract to `pkg/config/env.go` as a constant?
Author
Member

This was only changed because I formatted the whole file. I would prefer to make a change like this in a separate pr.

This was only changed because I formatted the whole file. I would prefer to make a change like this in a separate pr.
decentral1se marked this conversation as resolved
p4u1 force-pushed logs-task-error from 98671a9f92 to 10e8bf0c7e 2023-12-13 08:24:36 +00:00 Compare
decentral1se approved these changes 2023-12-14 10:46:51 +00:00
decentral1se left a comment
Owner

LGTM! TYSM! 🤘

LGTM! TYSM! 🤘
p4u1 merged commit d4727db8f9 into main 2023-12-14 13:15:24 +00:00
p4u1 deleted branch logs-task-error 2023-12-14 13:15:25 +00:00
Member

Unfortunately this broke the secret handling completely. Most of the secrets can't be found anymore. Its because of the modified Filters function, that is used by the secrets.

Unfortunately this broke the secret handling completely. Most of the secrets can't be found anymore. Its because of the modified `Filters` function, that is used by the secrets.
Author
Member

Very sorry about that! Can you be a bit more specific on how to reproduce the problem? Because for me it still works and also the integration tests for secrets still pass.

Very sorry about that! Can you be a bit more specific on how to reproduce the problem? Because for me it still works and also the integration tests for secrets still pass.
Sign in to join this conversation.
No description provided.