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

Use knative.dev/pkg/changeset #4126

Merged
merged 2 commits into from
Aug 4, 2021
Merged

Conversation

mattmoor
Copy link
Member

Changes

This replaces the need for ./pkg/version and a flag with the automatic inference of the version of the deployed code from the git metadata symlinked into kodata/

This package is already used to automatically decorate the zap loggers, and a few other places (iirc).

/kind cleanup

Submitter Checklist

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

  • Docs included if any changes are user facing
  • Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including
    functionality, content, code)
  • Release notes block below has been filled in or deleted (only if no user facing changes)

Release Notes

NONE

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. labels Jul 29, 2021
@tekton-robot tekton-robot requested review from imjasonh and a user July 29, 2021 16:05
@tekton-robot tekton-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 29, 2021
@mattmoor
Copy link
Member Author

There was a (brief) discussion of this on slack here: https://tektoncd.slack.com/archives/CLCCEBUMU/p1627503258123300

@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/pod/pod.go 87.6% 87.1% -0.5

@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/pod/pod.go 87.6% 87.1% -0.5

This replaces the need for `./pkg/version` and a flag with the automatic inference of the version of the deployed code from the git metadata symlinked into `kodata/`

This package is already used to automatically decorate the zap loggers, and a few other places (iirc).

/kind cleanup
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 29, 2021
@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/pod/pod.go 87.6% 87.1% -0.5

@mattmoor
Copy link
Member Author

@imjasonh
Copy link
Member

Is the change to controller.yaml going to run afoul of the modification done in

# Rewrite "devel" to params.versionTag
sed -i -e 's/\(pipeline.tekton.dev\/release\): "devel"/\1: "$(params.versionTag)"/g' -e 's/\(app.kubernetes.io\/version\): "devel"/\1: "$(params.versionTag)"/g' -e 's/\(version\): "devel"/\1: "$(params.versionTag)"/g' -e 's/\("-version"\), "devel"/\1, "$(params.versionTag)"/g' ${PROJECT_ROOT}/config/*.yaml

@mattmoor
Copy link
Member Author

Thanks for making my eyes bleed @imjasonh 😉

There's probably an expression in there we no longer need, but I hate touching bash that presubmits don't check. Lemme look closer.

@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/pod/pod.go 87.6% 87.1% -0.5

@mattmoor
Copy link
Member Author

@imjasonh @vdemeester this should be RFAL.

@mattmoor
Copy link
Member Author

mattmoor commented Aug 2, 2021

post-weekend bump 😁

@vdemeester
Copy link
Member

@mattmoor does it support only a commit hash, or can it show a tag ?

@mattmoor
Copy link
Member Author

mattmoor commented Aug 2, 2021

does it support only a commit hash, or can it show a tag

As it is today, I believe it resolves the tag to a commit, but all the info is in kodata, so we could adapt the changeset package to do more.

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

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 tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 2, 2021
@chmouel
Copy link
Member

chmouel commented Aug 4, 2021

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 4, 2021
@vdemeester
Copy link
Member

/retest

@tekton-robot tekton-robot merged commit dd7abe8 into tektoncd:main Aug 4, 2021
@mattmoor mattmoor deleted the use-changeset branch August 4, 2021 14:39
@vdemeester
Copy link
Member

vdemeester commented Aug 5, 2021

So @mattmoor one downside of this approach is, it fails if the images are not build with ko 😛 (which is the case for OpenShift Pipelines for example, we rebuild them differently). https://github.com/knative/pkg/blob/main/changeset/commit.go#L60 is less forgiving than what I initially though 😛

The trick is that, if there is no KO_DATA_PATH or not the required file in the image for some reason, we cannot schedule anything (because it fails), even though, it's kind-of a metadata that should prevent us to schedule anything.

Comment on lines +293 to +297
version, err := changeset.Get()
if err != nil {
return nil, err
}
podAnnotations[ReleaseAnnotation] = version
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should log something and print unknown here instead of erroring out, wdyt @mattmoor ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesnt merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants