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

Escape label names when writing to disk. #1195

Merged
merged 1 commit into from
Aug 14, 2019

Conversation

dlorenc
Copy link
Contributor

@dlorenc dlorenc commented Aug 14, 2019

Changes

Github/other providers allow labels to contain special characters like /. These
cannot easily be represented as filenames. This commit URL encodes these label
keys, which should provide a safe mechanism for writing these names as files.

I've been unable to find documentation containing an exhaustive list of characters
allowed in labels, but this change works with everything in the Tekton repos.

This PR also includes a sample YAML that ensures a Tekton PR has been approved, which
caught this issue.

Submitter Checklist

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

Reviewer Notes

Release Notes

Describe any user facing changes here, or delete this block.

PR filenames are URL-escaped before being written to disk.

@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Aug 14, 2019
@tekton-robot tekton-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 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 74.8% 73.1% -1.6

@vdemeester
Copy link
Member

/cc @dibyom @bobcatfish
We need this for 0.6 too 👼

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 14, 2019
Copy link
Collaborator

@bobcatfish bobcatfish left a comment

Choose a reason for hiding this comment

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

Awesome!! I'm especially excited to have an example for this now too :D My only feedback is a quick plug for maybe adding a focused unit test or two, and a comment, but nothing major

cmd/pullrequest-init/disk_test.go Show resolved Hide resolved
examples/taskruns/taskrun-github-pr-yaml Show resolved Hide resolved
@bobcatfish
Copy link
Collaborator

/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 Aug 14, 2019
Github/other providers allow labels to contain special characters like /. These
cannot easily be represented as filenames. This commit URL encodes these label
keys, which should provide a safe mechanism for writing these names as files.

I've been unable to find documentation containing an exhaustive list of characters
allowed in labels, but this change works with everything in the Tekton repos.

This PR also includes a sample YAML that ensures a Tekton PR has been approved, which
caught this issue.
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Aug 14, 2019
@dlorenc
Copy link
Contributor Author

dlorenc commented Aug 14, 2019

Awesome!! I'm especially excited to have an example for this now too :D My only feedback is a quick plug for maybe adding a focused unit test or two, and a comment, but nothing major

Ready!

@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 74.8% 75.9% 1.2

Copy link
Member

@dibyom dibyom left a comment

Choose a reason for hiding this comment

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

/lgtm
/hold cancel

@tekton-robot tekton-robot added lgtm Indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Aug 14, 2019
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom, 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

@tekton-robot tekton-robot merged commit 1699fd8 into tektoncd:master Aug 14, 2019
@dlorenc dlorenc deleted the escape branch August 14, 2019 18:58
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.

None yet

6 participants