Skip to content

fix(cmd/deployment): resolve service from --deployment-id in log - #281

Open
stantheman0128 wants to merge 1 commit into
zeabur:mainfrom
stantheman0128:fix/279-deployment-log-service
Open

stantheman0128 wants to merge 1 commit into
zeabur:mainfrom
stantheman0128:fix/279-deployment-log-service

Conversation

@stantheman0128

@stantheman0128 stantheman0128 commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Description (required)

The issue text does not match the code. On current main (and at dc6168a, the version in the report), deployment log and deployment get skip the "Select a service" selector whenever --deployment-id is set, so that prompt never appears for this flag.

The real bug: zeabur deployment log --deployment-id <id> on its own fails with

ERROR	failed to get runtime logs: serviceID is required for runtime logs

because the command never looks up which service the deployment belongs to. Runtime logs are the default --type, so the one-flag call from the issue always fails unless --service-id is passed too.

This change fetches the deployment when --deployment-id is given without a service, and takes its project, service and environment from it. An explicit --env-id still wins. An unknown ID returns deployment <id> not found.

This is a separate code path from #278 (non-TTY prompts hanging), which is in #280.

Testing:

  • New internal/cmd/deployment/log/log_test.go runs the real command with a stubbed API client. Before the fix runtime logs were requested with an empty service ID; after it they get the deployment's service and environment, in both interactive and -i=false modes.
  • Linux build of main with a dummy token, stdin from /dev/null: exits 1 with the error above and no prompt.
  • go test ./..., golangci-lint run ./... (0 issues), gofumpt clean. I don't have make locally, so I ran the commands it wraps. I have no real Zeabur token, so I could not fetch live logs.

Written with help from Cursor (AI). I reviewed the change and ran the tests above.

Related issues & labels (optional)


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

`deployment log --deployment-id <id>` skipped the service selector but never
looked up which service the deployment belongs to, so runtime logs (the
default type) always failed with "serviceID is required for runtime logs"
unless --service-id was also passed.

Fetch the deployment and take its project, service and environment when no
service is given.

Closes zeabur#279

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

deployment log/get: --deployment-id still prompts "Select a service" despite the ID uniquely identifying the service

1 participant