Skip to content

Comments

Implement build/deploy log support#490

Open
smlx wants to merge 4 commits intomainfrom
build-logs
Open

Implement build/deploy log support#490
smlx wants to merge 4 commits intomainfrom
build-logs

Conversation

@smlx
Copy link
Member

@smlx smlx commented Feb 11, 2026

This change adds support for build and task logs and relies on uselagoon/lagoon-ssh-portal#570.

The logs command gets two new flags. The idea is that you can specify --task to get logs from all running tasks, or --task=name if you know the name.

  -b, --build string[="all_builds"]   specify build logs, with an optional specific build name
  -t, --task string[="all_tasks"]     specify task logs, with an optional specific task name

The deploy subcommands also gets new flags --follow that stream deploy logs until the deployment completes.

      --follow                 Follow the deploy logs

I have no idea if this is a good developer UX: feedback requested.

I have tested this manually using the deploy latest subcommand, but have not actually tested the other subcommands because I don't have a good test environment for them. Please let me know if they are broken! In particular, the code relies on the resultData.Result being the name of the build. This holds for deploy latest, but I don't know if it holds for other subcommands?

# tested and working
go run . logs -p test-project -e main --build
go run . logs -p test-project -e main --build=lagoon-build-123xyz
go run . logs -p test-project -e main --task
go run . logs -p test-project -e main --task=lagoon-task-123xyz
go run . deploy latest -p test-project -e main --follow --force

# untested - please test!
go run . deploy branch -p test-project -e main --follow --force
go run . deploy promote -p test-project -e main --follow --force
go run . deploy pullrequest -p test-project -e main --follow --force

Add new flags to the logs command:

* --build get build logs for any running builds
* --task get task logs for any running tasks
@smlx smlx changed the title build logs Implement build/deploy log support Feb 11, 2026
@smlx smlx marked this pull request as ready for review February 11, 2026 01:37
@shreddedbacon shreddedbacon self-requested a review February 11, 2026 01:42
@shreddedbacon
Copy link
Member

shreddedbacon commented Feb 12, 2026

Error returned for a task or build that doesn't have a pod that exists in the namespace needs to be clearer that the pod does not exist anymore to prevent confusion from users when the pod is no longer available

$ go run main.go -l local-k3d logs -p lagoon-demo -e main --task=lagoon-task-qmpun
log stream interrupted. SID: 1ca4add8febb162924d3499578eda5f8e8c8b6cfd57d461711fd2cd940861aca
Error: Process exited with status 253exit status 253

$ go run main.go -l local-k3d logs -p lagoon-demo -e main --build=lagoon-build-def456
log stream interrupted. SID: 4e2063997870bf1c3d83de52874b2ddea0082386764f3abdf865591b86d0a31b
Error: Process exited with status 253exit status 253

Maybe this is something the ssh-portal should handle though

@smlx
Copy link
Member Author

smlx commented Feb 16, 2026

Error returned for a task or build that doesn't have a pod that exists in the namespace needs to be clearer that the pod does not exist anymore to prevent confusion from users when the pod is no longer available

Good idea!

$ go run main.go -l local-k3d logs -p lagoon-demo -e main --task=lagoon-task-qmpun
log stream interrupted. SID: 1ca4add8febb162924d3499578eda5f8e8c8b6cfd57d461711fd2cd940861aca
Error: Process exited with status 253exit status 253

$ go run main.go -l local-k3d logs -p lagoon-demo -e main --build=lagoon-build-def456
log stream interrupted. SID: 4e2063997870bf1c3d83de52874b2ddea0082386764f3abdf865591b86d0a31b
Error: Process exited with status 253exit status 253

Maybe this is something the ssh-portal should handle though

Yep, I added this feature over on uselagoon/lagoon-ssh-portal#570.

It now looks like:

$ go build . && ./lagoon-cli logs -p demo -e demoenv --task=lagoon-task-banana
no pods matched selector. SID: 74c27e22b7820980157f08938c642ae55d8201b38a259d4628c21c7aacc047f2
Error: Process exited with status 253

@smlx
Copy link
Member Author

smlx commented Feb 16, 2026

Based on the suggestion in uselagoon/lagoon-ssh-portal#570 (comment) I added --show-pod and --show-timestamp flags to the logs and deploy commands. Both default to true at the moment (so no change in behaviour), but let me know if you think that should be changed 🙂

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.

2 participants