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

Fix re-applying v1beta1 TaskRun failing 🚢 #2285

Merged
merged 1 commit into from
Mar 25, 2020

Conversation

vdemeester
Copy link
Member

Changes

Re-apply a v1beta1 resource would failed because of inputs (or
outputs) not a valid field. This is mainly because we are using
v1alpha1 as stored version and thus getting the struct as v1alpha1
internally.

This fixes this issue by marking TaskRun.Spec.Inputs and
TaskRun.Spec.Outputs as pointers. It doesn't change the API, but
fixes the problem as a nil pointer will not be unmarshall where the
struct was.

Signed-off-by: Vincent Demeester vdemeest@redhat.com

Fixes #2276

/cc @sbwsg @bobcatfish @afrittoli

/priority critical-urgent
/kind bug

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

See the contribution guide for more details.

Double check this list of stuff that's easy to miss:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

Release Notes

Fix re-applying v1beta1 TaskRun failing 🚢

Re-apply a v1beta1 resource would failed because of `inputs` (or
`outputs`) not a valid field. This is mainly because we are using
`v1alpha1` as stored version and thus getting the struct as v1alpha1
internally.

This fixes this issue by marking `TaskRun.Spec.Inputs` and
`TaskRun.Spec.Outputs` as pointers. It doesn't change the API, but
fixes the problem as a `nil` pointer will not be unmarshall where the
struct was.

Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
@tekton-robot tekton-robot requested review from afrittoli, bobcatfish and a user March 25, 2020 09:02
@tekton-robot tekton-robot added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. kind/bug Categorizes issue or PR as related to a bug. labels Mar 25, 2020
@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Mar 25, 2020
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 25, 2020
@vdemeester vdemeester added the needs-cherry-pick Indicates a PR needs to be cherry-pick to a release branch label Mar 25, 2020
@vdemeester vdemeester added this to the Pipelines 0.11 🐱 milestone Mar 25, 2020
@tekton-robot
Copy link
Collaborator

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

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha1/taskrun_conversion.go 95.2% 95.2% 0.1
pkg/apis/pipeline/v1alpha1/taskrun_validation.go 93.0% 89.8% -3.2

Copy link
Member

@afrittoli afrittoli left a comment

Choose a reason for hiding this comment

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

Thank you for this!
Were you able to prove that this fixes the issue?
/lgtm

@@ -4,7 +4,6 @@ go 1.13

require (
cloud.google.com/go v0.47.0 // indirect
cloud.google.com/go/storage v1.0.0
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 not sure why this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Me neither.. go mod wonders… it comes, it goes those two things.. I have no idea why…

@@ -43,7 +42,6 @@ require (
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
golang.org/x/tools v0.0.0-20200214144324-88be01311a71 // indirect
gomodules.xyz/jsonpatch/v2 v2.1.0 // indirect
google.golang.org/api v0.15.0
Copy link
Member

Choose a reason for hiding this comment

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

Ditto

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 25, 2020
@vdemeester
Copy link
Member Author

Thank you for this!
Were you able to prove that this fixes the issue?
/lgtm

Yeah, re-applying twice the same TaskRun yaml failed before, succeeds now. I am not entirely sure how to write a tests for this as it is because of a kubectl behaviour (well I know how we could do, but it means adding another form of tests that we don't have yet).

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbwsg

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 Mar 25, 2020
@tekton-robot tekton-robot merged commit c53d549 into tektoncd:master Mar 25, 2020
@vdemeester vdemeester deleted the fix-erro-re-apply-v1beta1 branch March 25, 2020 11:55
@ghost ghost removed the needs-cherry-pick Indicates a PR needs to be cherry-pick to a release branch label Mar 25, 2020
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. cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. 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.

applying the same TaskRun yaml more than once produces errors
4 participants