pipeline icon indicating copy to clipboard operation
pipeline copied to clipboard

Fix no logs in stdout/stderr if uses stdoutConfig

Open chengjoey opened this issue 2 years ago β€’ 6 comments

Changes

fix #6136 used to only collect stdout and err to a file if the std{out/err}Path is specified, now add both os.std{out/err} and the std{out/err}Path to multiwriter to collect logs.

there is a full test to verify the function, now if you run the test TestRealRunnerStdoutAndStderrPaths you can see that the standard output has a log, there was no before

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • [x] Has Docs included if any changes are user facing
  • [x] Has Tests included if any functionality added or changed
  • [x] Follows the commit message standard
  • [x] Meets the Tekton contributor standards (including functionality, content, code)
  • [x] Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • [ ] Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • [ ] Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

chengjoey avatar Feb 14 '23 15:02 chengjoey

/kind bug

chengjoey avatar Feb 14 '23 15:02 chengjoey

/assign @wlynch could you please take a review?πŸ™

chengjoey avatar Feb 14 '23 15:02 chengjoey

The following is the coverage report on the affected files. Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
cmd/entrypoint/runner.go 82.8% 83.3% 0.5

tekton-robot avatar Feb 14 '23 15:02 tekton-robot

The following is the coverage report on the affected files. Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
cmd/entrypoint/runner.go 82.8% 85.2% 2.4

tekton-robot avatar Feb 14 '23 15:02 tekton-robot

This will probably need a release-note entry πŸ‘ΌπŸΌ

thanks @vdemeester , i added the release-note and marked the release-note checklist

chengjoey avatar Feb 15 '23 01:02 chengjoey

/test pull-tekton-pipeline-integration-tests

chengjoey avatar Feb 15 '23 01:02 chengjoey

@chengjoey thanks for this fix.

As you pointed out, there is a test for this, which was already succeeding, which unfortunately means there is full coverage for this change - it could be inadvertently broken again and the tests would not catch it. Would it be possible to add test coverage to make sure we do not lose pod logs when using stdoutConfig?

afrittoli avatar Feb 16 '23 13:02 afrittoli

@wlynch it would be nice if you could review this one since you changed this code last πŸ™

afrittoli avatar Feb 16 '23 13:02 afrittoli

The following is the coverage report on the affected files. Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
cmd/entrypoint/runner.go 84.4% 83.3% -1.0

tekton-robot avatar Feb 16 '23 15:02 tekton-robot

The following is the coverage report on the affected files. Say /test pull-tekton-pipeline-go-coverage-df to re-run this coverage report

File Old Coverage New Coverage Delta
cmd/entrypoint/runner.go 84.4% 85.2% 0.8

tekton-robot avatar Feb 16 '23 15:02 tekton-robot

@chengjoey thanks for this fix.

As you pointed out, there is a test for this, which was already succeeding, which unfortunately means there is full coverage for this change - it could be inadvertently broken again and the tests would not catch it. Would it be possible to add test coverage to make sure we do not lose pod logs when using stdoutConfig?

Of course, i added verification in TestRealRunnerStdoutAndStderrPaths that whether realRunner print the log to std{out/err}. Thanks for the reminder, your advice is great!

chengjoey avatar Feb 16 '23 15:02 chengjoey

/test pull-tekton-pipeline-alpha-integration-tests

chengjoey avatar Feb 17 '23 05:02 chengjoey

/assign

Yongxuanzhang avatar Mar 22 '23 17:03 Yongxuanzhang

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester, Yongxuanzhang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

tekton-robot avatar Mar 27 '23 20:03 tekton-robot

/lgtm

Yongxuanzhang avatar Mar 28 '23 14:03 Yongxuanzhang

@chengjoey @pritidesai @jerop should this be cherry-picked in the latest LTS ? (0.41 and 0.44)

vdemeester avatar Apr 06 '23 08:04 vdemeester

/cherry-pick release-v0.41.x /cherry-pick release-v0.42.x /cherry-pick release-v0.43.x /cherry-pick release-v0.44.x

chengjoey avatar Apr 06 '23 14:04 chengjoey

@chengjoey: #6162 failed to apply on top of branch "release-v0.41.x":

Applying: Fix no logs in stdout/stderr if uses stdoutConfig
Using index info to reconstruct a base tree...
M	cmd/entrypoint/runner.go
M	cmd/entrypoint/runner_test.go
Falling back to patching base and 3-way merge...
Auto-merging cmd/entrypoint/runner_test.go
CONFLICT (content): Merge conflict in cmd/entrypoint/runner_test.go
Auto-merging cmd/entrypoint/runner.go
CONFLICT (content): Merge conflict in cmd/entrypoint/runner.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Fix no logs in stdout/stderr if uses stdoutConfig
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-v0.41.x /cherry-pick release-v0.42.x /cherry-pick release-v0.43.x /cherry-pick release-v0.44.x

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

tekton-robot avatar Apr 06 '23 14:04 tekton-robot

@chengjoey @pritidesai @jerop should this be cherry-picked in the latest LTS ? (0.41 and 0.44)

when i try to cherry-pick to 0.41, there are some conflicts, I manually submitted a hotfix pr, is this the correct hotfix process

chengjoey avatar Apr 06 '23 15:04 chengjoey

/cherry-pick release-v0.44.x

chengjoey avatar Apr 07 '23 02:04 chengjoey

@chengjoey: new pull request created: #6506

In response to this:

/cherry-pick release-v0.44.x

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

tekton-robot avatar Apr 07 '23 02:04 tekton-robot