Repository navigation
fix(cmd/deployment): resolve service from --deployment-id in log - #281
Open
stantheman0128 wants to merge 1 commit into
Open
stantheman0128 wants to merge 1 commit into
stantheman0128 wants to merge 1 commit into
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description (required)
The issue text does not match the code. On current main (and at dc6168a, the version in the report),
deployment loganddeployment getskip the "Select a service" selector whenever--deployment-idis set, so that prompt never appears for this flag.The real bug:
zeabur deployment log --deployment-id <id>on its own fails withbecause 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-idis passed too.This change fetches the deployment when
--deployment-idis given without a service, and takes its project, service and environment from it. An explicit--env-idstill wins. An unknown ID returnsdeployment <id> not found.This is a separate code path from #278 (non-TTY prompts hanging), which is in #280.
Testing:
internal/cmd/deployment/log/log_test.goruns 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=falsemodes.go test ./...,golangci-lint run ./...(0 issues), gofumpt clean. I don't havemakelocally, 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)
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.