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

deploy: display smoke-check failure even when logs are unavailable #3926

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions internal/command/deploy/machines_deploymachinesapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -1268,16 +1268,16 @@ func (md *machineDeployment) doSmokeChecks(ctx context.Context, lm machine.Leasa
span.AddEvent("not authorized to retrieve logs")
fmt.Fprintf(md.io.ErrOut, "Warn: not authorized to retrieve app logs (this can happen when using deploy tokens), so we can't show you what failed. Use `fly logs -i %s` or open the monitoring dashboard to see them: https://fly.io/apps/%s/monitoring?region=&instance=%s\n", lm.Machine().ID, md.appConfig.AppName, lm.Machine().ID)
} else {
if logErr != nil {
err := fmt.Errorf("error getting logs for machine %s: %w", lm.Machine().ID, logErr)
span.RecordError(err)
return err
}
var log string
for _, l := range logs {
// Ideally we should use InstanceID here, but it's not available in the logs.
if l.Timestamp >= lm.Machine().UpdatedAt {
log += fmt.Sprintf("%s\n", l.Message)
if logErr != nil {
log = fmt.Sprintf("error getting logs for machine %s: %v", lm.Machine().ID, logErr)
span.AddEvent(log)
} else {
for _, l := range logs {
// Ideally we should use InstanceID here, but it's not available in the logs.
if l.Timestamp >= lm.Machine().UpdatedAt {
log += fmt.Sprintf("%s\n", l.Message)
}
}
}

Expand Down
Loading