10000 Fix okteto preview deploy --log-output json command by jvc5546 · Pull Request #4726 · okteto/okteto · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix okteto preview deploy --log-output json command #4726

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

Closed
wants to merge 2 commits into from

Conversation

jvc5546
Copy link
Contributor
@jvc5546 jvc5546 commented Jun 4, 2025

Fixes PROD-290 issue where the okteto preview deploy --log-output json doesn't output anything.

Okteto Agent Fleets generated text below here

The issue was that the handlerPipelineLogLine function in pkg/okteto/stream.go was not setting the log stage before printing messages. When --log-output json is specified, the logs need to be formatted as JSON with the proper stage information.

The fix sets the stage using oktetoLog.SetStage() before calling oktetoLog.Println(), ensuring that the JSON writer properly formats the output with stage information.

Proposed changes

Fixes # (issue)

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

How to validate

Please provide step-by-step instructions to replicate your validation scenario. For bug fixes, detail how to reproduce both the bug and its fix, along with any observations.

CLI Quality Reminders 🔧

For both authors and reviewers:

  • Scrutinize for potential regressions
  • Ensure key automated tests are in place
  • Build the CLI and test using the validation steps
  • Assess Developer Experience impact (log messages, performances, etc)
  • If too broad, consider breaking into smaller PRs
  • Adhere to our code style and code review guidelines

The issue was that the handlerPipelineLogLine function in pkg/okteto/stream.go
was not setting the log stage before printing messages. When --log-output json
is specified, the logs need to be formatted as JSON with the proper stage
information.

The fix sets the stage using oktetoLog.SetStage() before calling
oktetoLog.Println(), ensuring that the JSON writer properly formats the
output with stage information.
@jvc5546 jvc5546 requested a review from a team as a code owner June 4, 2025 13:27
Signed-off-by: Javier Lopez <javier@okteto.com>
@jLopezbarb
Copy link
Contributor

Hi @jvc5546, This has a downside. If you are deploying a repo with dependencies the messages will now appear in the main one as part of the LoadManifest step and in the correct logs of the dependency.

Copy link
codecov bot commented Jun 18, 2025

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 48.83%. Comparing base (756791b) to head (a4554e6).
Report is 9 commits behind head on master.

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4726      +/-   ##
==========================================
- Coverage   48.86%   48.83%   -0.03%     
==========================================
  Files         354      354              
  Lines       29718    29722       +4     
==========================================
- Hits        14521    14515       -6     
- Misses      14040    14048       +8     
- Partials     1157     1159       +2     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jLopezbarb
Copy link
Contributor

@jvc5546 I'm going to close this PR given that we need to figure out how to do this without affecting other pipelines. Let me know if you have any concern

@jLopezbarb jLopezbarb closed this Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0