Skip to content

Fix rename for helm dep upgrade. For issue #2998 - #5038

Closed
ghost wants to merge 13 commits into
masterfrom
unknown repository
Closed

ghost wants to merge 13 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Dec 10, 2018

Copy link
Copy Markdown

helm dependency upgrade wasn't working on certain file system because it assumes that os.rename is available. Since rename isn't available for subfolders in docker containers, I ripped a fallback rename strategy from dep that works in docker. I wasn't able to reference this package as a dependency because it is an internal package in dep.

This is my first submission to the open source community, so please let me know if committing this fs package from golang/dep is the wrong approach, or if something in their license prohibits this.

https://github.com/golang/dep

@helm-bot helm-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Dec 10, 2018
helm dependency upgrade wasn't working on certain file system because it assumes that os.rename is available. Since rename isn't available for subfolders in docker containers, I ripped a fallback rename strategy from dep (https://github.com/golang/dep/blob/5b1fe9e6d89372487d0aac78d9c5362a517857e7/internal/fs/fs.go#L103-L118) that works in docker.

Signed-off-by: Brice Rising <[email protected]>
@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 10, 2018
The fs package tests are going to be a lot of work to get working without the internal test package used by golang/dep, so I removed all of the unused ones by this project to make the work easier.

Signed-off-by: Brice Rising <[email protected]>
@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 10, 2018
Recreated the features of the test package in dep that were necessary to run the tests in the fs package.

Signed-off-by: Brice Rising <[email protected]>
@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 10, 2018
Root can access all files, so the tests for inaccessible files were failing. Now we will skip these tests when running as root.

Signed-off-by: Brice Rising <[email protected]>
@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 10, 2018
Our style settings don't like underscores in variable names, so I switched to camel case. Also, err was unused in some places, so I made an error a fail condition for some test.

Signed-off-by: Brice Rising <[email protected]>
@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 10, 2018
Unused var was in fs.go. Removed it.

Signed-off-by: Brice Rising <[email protected]>
@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 10, 2018
Neeted to run formatting on fs_test.go

Signed-off-by: Brice Rising <[email protected]>
@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 10, 2018
@bacongobbler

Copy link
Copy Markdown
Member

We might need CNCF's legal team to have a look at this. cc @michelleN

@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 10, 2018
@ghost

ghost commented Dec 10, 2018

Copy link
Copy Markdown
Author

I'm a little confused, I've fixed both of the gofmt issues locally with gofmt -s -w file.go, but circleci still says that they're failing the style check.

@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 11, 2018
@ghost

ghost commented Dec 13, 2018

Copy link
Copy Markdown
Author

Is there anything I can do to help get this merged? If there's a contact on the CNCF legal team that I can talk to, I would be happy to start communications

@bacongobbler

Copy link
Copy Markdown
Member

Not much at this time other than getting the tests to pass. We have all been away at kubecon for the past week.

@ghost

ghost commented Dec 14, 2018

Copy link
Copy Markdown
Author

Oh ok, I hope the conference was great!

The only thing that appears to be failing as far as I can tell is the linter that looks for the apache license. Should I commit that line to each file before we hear back about whether we're allowed to use this code?

This is probably not the correct apporach to using bsd licensed code under an apache license.

Signed-off-by: Brice Rising <[email protected]>
@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 17, 2018
I found another package that took code from a BSD licensed open source project. I copied their approach for reusing that license.

Signed-off-by: Brice Rising <[email protected]>
@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 17, 2018
Signed-off-by: Brice Rising <[email protected]>
@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 17, 2018
@ghost

ghost commented Dec 17, 2018

Copy link
Copy Markdown
Author

I noticed that this package also reuses code licensed under a BSD style license, I've copied the approach used in that package and now it's passing the linter

https://github.com/helm/helm/blob/master/pkg/sympath/walk.go

Signed-off-by: Brice Rising <[email protected]>
@helm-bot helm-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 17, 2018
@ghost

ghost commented Jan 2, 2019

Copy link
Copy Markdown
Author

Is there anything I can do to make progress on this PR?

@bacongobbler

Copy link
Copy Markdown
Member

Since this is BSD-licensed code, it's fine to take it and re-license it as Apache 2. The question, though, is whether that practice follows the DCO. We're just waiting on a response on how we can move forward.

@bacongobbler

Copy link
Copy Markdown
Member

Here's the response from the CNCF legal team:

  1. Since Helm uses a DCO, the person who is making the contribution -- and including a DCO "Signed-off-by" message -- would need to be comfortable that they can sign off on one of the statements in the DCO. This would be https://developercertificate.org/, either (a), (b) or (c). In the context here, it looks like they're using (b).
  1. Instead of pulling these forked files directly into the main Helm /pkg/ directory, I would recommend that this code be pulled into a separate directory, something like /third_party/forked/. That way it should be fully clear to downstream users that this code originated in part from outside the main project, and that different licenses may apply. This is the practice followed by Kubernetes when forking upstream projects: see https://github.com/kubernetes/kubernetes/tree/master/third_party/forked
  1. Finally, I would also suggest putting the full BSD license text in the header comments of these couple of files, instead of the URL. E.g., in the new file pkg/fsutil/fs.go, instead of "https://github.com/golang/dep/blob/master/LICENSE", I would suggest including the actual text from that LICENSE file. This is because complying with BSD-style licenses is generally understood to require actually distributing the applicable license text.

If they follow the steps described in 2 and 3 above, I don't see a problem with bringing in the code.

So in order to accept this PR:

  1. Please move pkg/fs to third_party/dep/fs or something indicative that the code came from dep
  2. Please put the full BSD license text in the header comments of the files being submitted

Once that's done this should be good to go from a legal perspective.

Thanks for your patience!

@bacongobbler

Copy link
Copy Markdown
Member

ping

@bacongobbler

Copy link
Copy Markdown
Member

due to inactivity, I'm going to go ahead and close this. If anyone else feels like taking this across the finish line, feel free!

@ysh7 ysh7 mentioned this pull request Oct 9, 2019
bacongobbler pushed a commit that referenced this pull request Nov 1, 2019
This code was ported over from PR #5038, #6738 which were originally for helm
v2. The code contains functions from golang/dep/internal/fs for renaming files.

Signed-off-by: Yagnesh Mistry <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants