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

Remove the use of go.uber.org/zap in entrypoint's dependent packages and uses log/slog #8544

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PuneetPunamiya
Copy link
Member

  • This patch uses logging with the standard library instead of using zap to ensure that we are not pulling in too many indirect dependencies into the entrypoint through the uber-go/zap module

Fixes: #8531 (one part of the issue)

Changes

Submitter Checklist

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

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • 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). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

@tekton-robot tekton-robot added the release-note-none Denotes a PR that doesnt merit a release note. label Jan 31, 2025
@tekton-robot tekton-robot requested review from dibyom and jerop January 31, 2025 05:23
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jan 31, 2025
@PuneetPunamiya
Copy link
Member Author

/kind-cleanup

@PuneetPunamiya PuneetPunamiya force-pushed the remove-zap-logger-from-entrypoint branch 2 times, most recently from b4c40b2 to d2c70d5 Compare January 31, 2025 05:40
@tekton-robot
Copy link
Collaborator

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
pkg/entrypoint/entrypointer.go 88.1% 87.7% -0.3

@tekton-robot
Copy link
Collaborator

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
pkg/entrypoint/entrypointer.go 88.1% 87.5% -0.6

@tekton-robot
Copy link
Collaborator

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
pkg/entrypoint/entrypointer.go 88.1% 87.5% -0.6

@PuneetPunamiya
Copy link
Member Author

/test check-pr-has-kind-label

@tekton-robot
Copy link
Collaborator

@PuneetPunamiya: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-tekton-pipeline-build-tests
  • /test pull-tekton-pipeline-unit-tests

The following commands are available to trigger optional jobs:

  • /test pull-tekton-pipeline-go-coverage

Use /test all to run all jobs.

In response to this:

/test check-pr-has-kind-label

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.

@PuneetPunamiya
Copy link
Member Author

/retest

@PuneetPunamiya
Copy link
Member Author

/test check-pr-has-kind-label

@tekton-robot
Copy link
Collaborator

@PuneetPunamiya: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test pull-tekton-pipeline-build-tests
  • /test pull-tekton-pipeline-unit-tests

The following commands are available to trigger optional jobs:

  • /test pull-tekton-pipeline-go-coverage

Use /test all to run all jobs.

In response to this:

/test check-pr-has-kind-label

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.

@PuneetPunamiya
Copy link
Member Author

/test all

@PuneetPunamiya
Copy link
Member Author

/kind cleanup

@tekton-robot tekton-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jan 31, 2025
@tekton-robot
Copy link
Collaborator

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
pkg/entrypoint/entrypointer.go 88.1% 87.5% -0.6

@@ -311,7 +307,8 @@ func (e Entrypointer) Go() error {
resultPath = e.ResultsDirectory
}
if err := e.readResultsFromDisk(ctx, resultPath, result.TaskRunResultType); err != nil {
logger.Fatalf("Error while handling results: %s", err)
slog.Error("Error while substituting step artifacts: ", slog.Any("error", err))
return err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious why log.Fatalf is replaced with logger.Fatalf in other places, but why are slog.Error used in these two instances?

@@ -237,10 +233,10 @@ func (e Entrypointer) Go() error {
var cancel context.CancelFunc
if err == nil {
if err := e.applyStepResultSubstitutions(pipeline.StepsDir); err != nil {
logger.Error("Error while substituting step results: ", err)
slog.Error("Error while substituting step results: ", slog.Any("error", err))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can the spaces at the end of the log be removed?

@tekton-robot tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 4, 2025
@tekton-robot
Copy link
Collaborator

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/main.go 11.9% 14.3% 2.3
cmd/entrypoint/spire.go Do not exist 0.0%
pkg/apis/config/feature_flags.go 95.1% 95.0% -0.1
pkg/apis/config/metrics.go 78.3% 77.3% -1.0
pkg/apis/config/metrics_tls.go Do not exist 100.0%
pkg/apis/pipeline/v1/types/artifact_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/artifact_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/artifact_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/param_types.go Do not exist 81.0%
pkg/apis/pipeline/v1/types/param_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/param_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/results_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/results_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/results_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/resultsref.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/resultsref.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/resultsref.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/when_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/when_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/when_types.go Do not exist 35.5%
pkg/entrypoint/entrypointer.go 88.1% 90.2% 2.2
pkg/entrypoint/spire.go Do not exist 0.0%
pkg/substitution/replacements.go Do not exist 100.0%
pkg/substitution/substitution.go 87.6% 86.2% -1.4
pkg/termination/message/messae.go Do not exist 0.0%
pkg/termination/message/messae.go Do not exist 0.0%

@PuneetPunamiya PuneetPunamiya force-pushed the remove-zap-logger-from-entrypoint branch from 11834ef to d2c70d5 Compare February 4, 2025 09:35
@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Feb 4, 2025
@tekton-robot
Copy link
Collaborator

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
pkg/entrypoint/entrypointer.go 88.1% 87.5% -0.6

@PuneetPunamiya
Copy link
Member Author

/retest

@PuneetPunamiya PuneetPunamiya reopened this Feb 4, 2025
@tekton-robot
Copy link
Collaborator

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
pkg/entrypoint/entrypointer.go 88.1% 87.5% -0.6

@tekton-robot
Copy link
Collaborator

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
pkg/entrypoint/entrypointer.go 88.1% 87.5% -0.6

@PuneetPunamiya PuneetPunamiya force-pushed the remove-zap-logger-from-entrypoint branch from d2c70d5 to 12aba0a Compare February 5, 2025 09:12
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign abayer after the PR has been reviewed.
You can assign the PR to them by writing /assign @abayer in a comment when ready.

The full list of commands accepted by this bot can be found 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 tekton-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 5, 2025
@tekton-robot
Copy link
Collaborator

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/main.go 11.9% 14.5% 2.6
cmd/entrypoint/runner.go 84.5% 86.2% 1.7
pkg/apis/config/feature_flags.go 95.1% 95.0% -0.1
pkg/apis/config/metrics.go 78.3% 77.3% -1.0
pkg/apis/config/metrics_tls.go Do not exist 100.0%
pkg/apis/pipeline/v1/types/artifact_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/artifact_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/param_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/param_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/result_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/result_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/resultsref.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/resultsref.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/when_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/when_types.go Do not exist 0.0%
pkg/substitution/replacements.go Do not exist 100.0%
pkg/substitution/substitution.go 87.6% 86.2% -1.4

@tekton-robot
Copy link
Collaborator

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/main.go 11.9% 14.5% 2.6
cmd/entrypoint/runner.go 84.5% 86.2% 1.7
pkg/apis/config/feature_flags.go 95.1% 95.0% -0.1
pkg/apis/config/metrics.go 78.3% 77.3% -1.0
pkg/apis/config/metrics_tls.go Do not exist 100.0%
pkg/apis/pipeline/v1/types/artifact_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/artifact_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/param_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/param_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/result_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/result_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/resultsref.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/resultsref.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/when_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/when_types.go Do not exist 0.0%
pkg/substitution/replacements.go Do not exist 100.0%
pkg/substitution/substitution.go 87.6% 86.2% -1.4

Comment on lines 33 to 38
// featureFlags "github.com/tektoncd/pipeline/pkg/apis/config"
//"github.com/tektoncd/pipeline/pkg/apis/pipeline"
v1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1/types"
// "github.com/tektoncd/pipeline/pkg/credentials"
// "github.com/tektoncd/pipeline/pkg/credentials/dockercreds"
// "github.com/tektoncd/pipeline/pkg/credentials/gitcreds"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these commented out? If they need to be removed, please do so instead of commenting them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is temporary (to check the zap symbols) ? @PuneetPunamiya

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's temporary thingy, I'm working on the patch, will keep the pr on hold for now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, got it, sorry I didn't realise 🙏

@PuneetPunamiya
Copy link
Member Author

/hold

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 5, 2025
@PuneetPunamiya PuneetPunamiya force-pushed the remove-zap-logger-from-entrypoint branch from 12aba0a to 2ab503d Compare February 8, 2025 11:31
@tekton-robot
Copy link
Collaborator

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
pkg/apis/config/feature_flags.go 95.1% 95.0% -0.1
pkg/apis/config/metrics.go 78.3% 77.3% -1.0
pkg/apis/config/metrics_tls.go Do not exist 100.0%
pkg/apis/pipeline/v1/types/artifact_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/artifact_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/artifact_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/param_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/param_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/param_types.go Do not exist 81.0%
pkg/apis/pipeline/v1/types/result_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/result_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/result_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/resultsref.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/resultsref.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/resultsref.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/when_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/when_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/when_types.go Do not exist 35.5%
pkg/entrypoint/entrypointer.go 88.1% 87.6% -0.5
pkg/substitution/replacements.go Do not exist 100.0%
pkg/substitution/substitution.go 87.6% 86.2% -1.4

Signed-off-by: PuneetPunamiya <[email protected]>
@PuneetPunamiya PuneetPunamiya force-pushed the remove-zap-logger-from-entrypoint branch from 2ab503d to 2088751 Compare February 8, 2025 12:33
@tekton-robot
Copy link
Collaborator

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 86.2% 84.5% -1.7
pkg/apis/config/feature_flags.go 95.1% 95.0% -0.1
pkg/apis/config/metrics.go 78.3% 77.3% -1.0
pkg/apis/config/metrics_tls.go Do not exist 100.0%
pkg/apis/pipeline/v1/types/artifact_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/artifact_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/artifact_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/param_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/param_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/param_types.go Do not exist 81.0%
pkg/apis/pipeline/v1/types/result_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/result_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/result_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/resultsref.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/resultsref.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/resultsref.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/when_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/when_types.go Do not exist 0.0%
pkg/apis/pipeline/v1/types/when_types.go Do not exist 35.5%
pkg/entrypoint/entrypointer.go 88.1% 87.6% -0.5
pkg/substitution/replacements.go Do not exist 100.0%
pkg/substitution/substitution.go 87.6% 86.2% -1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note-none Denotes a PR that doesnt merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Making pipeline (and entrypoint) FIPS complitant
5 participants