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

Add support for comment and label manifests. #1408

Merged
merged 2 commits into from
Oct 15, 2019

Conversation

wlynch
Copy link
Member

@wlynch wlynch commented Oct 9, 2019

Changes

Introduces .MANIFEST files to comment and label directories to keep
track of sub-resources when the PullRequest resource is initialized.
This allows us to keep track of what resources the user explicitly
deleted, and not accidentally overwrite new comments/lables that were
introduced during execution.

Minor changes included:

  • Changed fake GitHub server to make copies of PullRequests to avoid
    pointer collision across tests.
  • Changed uploadLabels to Add/Delete labels explicitly instead of
    replacing all.

Change manifest path to .MANIFEST to avoid collisions.

Fixes #1286

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

- Fixes bug where PullRequestResource could accidentally delete newly created upsteam resources in certain race conditions.

@tekton-robot tekton-robot requested review from dlorenc and a user October 9, 2019 21:37
@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Oct 9, 2019
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 9, 2019
@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
cmd/pullrequest-init/disk.go 75.9% 76.9% 0.9
cmd/pullrequest-init/fake_github.go 74.8% 73.3% -1.5
cmd/pullrequest-init/github.go 83.5% 82.5% -1.1

@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
cmd/pullrequest-init/disk.go 75.9% 76.9% 0.9
cmd/pullrequest-init/fake_github.go 74.8% 73.3% -1.5
cmd/pullrequest-init/github.go 83.5% 82.5% -1.1

@wlynch
Copy link
Member Author

wlynch commented Oct 9, 2019

/hold

Found some issues with the manifest, so this is not ready for review yet. 😅

@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 Oct 9, 2019
@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
cmd/pullrequest-init/disk.go 75.9% 77.0% 1.1
cmd/pullrequest-init/fake_github.go 74.8% 73.3% -1.5
cmd/pullrequest-init/github.go 83.5% 82.5% -1.1

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Mentioned some minor nits but otherwise this looks good to me!

cmd/pullrequest-init/disk.go Outdated Show resolved Hide resolved
cmd/pullrequest-init/disk_test.go Outdated Show resolved Hide resolved
cmd/pullrequest-init/fake_github.go Show resolved Hide resolved
Copy link
Member Author

@wlynch wlynch left a comment

Choose a reason for hiding this comment

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

Done! Will rebase and squash once I get an LGTM.

cmd/pullrequest-init/disk.go Outdated Show resolved Hide resolved
cmd/pullrequest-init/disk_test.go Outdated Show resolved Hide resolved
cmd/pullrequest-init/fake_github.go Show resolved Hide resolved
@wlynch
Copy link
Member Author

wlynch commented Oct 11, 2019

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 11, 2019
@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
cmd/pullrequest-init/disk.go 75.9% 77.0% 1.1
cmd/pullrequest-init/fake_github.go 74.8% 72.7% -2.1
cmd/pullrequest-init/github.go 83.5% 82.5% -1.1

@ghost
Copy link

ghost commented Oct 14, 2019

/lgtm

@tekton-robot tekton-robot assigned ghost Oct 14, 2019
@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 14, 2019
Introduces `.MANIFEST` files to comment and label directories to keep
track of sub-resources when the PullRequest resource is initialized.
This allows us to keep track of what resources the user explicitly
deleted, and not accidentally overwrite new comments/lables that were
introduced during execution.

Minor changes included:
* Changed fake GitHub server to make copies of PullRequests to avoid
  pointer collision across tests.
* Changed uploadLabels to Add/Delete labels explicitly instead of
  replacing all.

Change manifest path to .MANIFEST to avoid collisions.

Fixes tektoncd#1286
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 14, 2019
@wlynch
Copy link
Member Author

wlynch commented Oct 14, 2019

Squashed the commits in prep for submission.

@ghost
Copy link

ghost commented Oct 14, 2019

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 14, 2019
@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
cmd/pullrequest-init/disk.go 75.9% 77.0% 1.1
cmd/pullrequest-init/fake_github.go 74.8% 72.7% -2.1
cmd/pullrequest-init/github.go 83.5% 82.5% -1.1

for _, c := range comments {
commentPath := filepath.Join(path, strconv.FormatInt(c.ID, 10)+".json")
id := strconv.FormatInt(c.ID, 10)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this manifest intended to be human readable? Would json serializing or gob serializing make it easier to safely round trip, so we don't have to manually encode to text?

Copy link
Member Author

Choose a reason for hiding this comment

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

Great idea!

Manifests are not meant to be human readable. Switched to gob encoding.

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 15, 2019
@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
cmd/pullrequest-init/disk.go 75.9% 78.2% 2.2
cmd/pullrequest-init/fake_github.go 74.8% 72.7% -2.1
cmd/pullrequest-init/github.go 83.5% 82.5% -1.1

@ghost
Copy link

ghost commented Oct 15, 2019

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 15, 2019
@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 15, 2019
@dlorenc
Copy link
Contributor

dlorenc commented Oct 15, 2019

/approve

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dlorenc

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

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 lgtm Indicates that a PR is ready to be merged. 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.

Design to keep PullRequest PipelineResource in sync with reality
4 participants