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 SPDX copyright and license headers #571

Merged
merged 8 commits into from
Oct 31, 2022
Merged

Conversation

nirs
Copy link
Member

@nirs nirs commented Oct 25, 2022

Convert license and copyright boilerplate to SPDX format and add missing copyright
and license info for most files

Some files are not handled yet, so we cannot add a reuse lint
step to the CI.

Current status:

$ reuse lint
# MISSING COPYRIGHT AND LICENSING INFORMATION

The following files have no copyright and licensing information:
* config/certmanager/certificate.yaml
* config/certmanager/kustomization.yaml
* config/certmanager/kustomizeconfig.yaml
* config/crd/bases/ramendr.openshift.io_drclusters.yaml
* config/crd/bases/ramendr.openshift.io_drplacementcontrols.yaml
* config/crd/bases/ramendr.openshift.io_drpolicies.yaml
* config/crd/bases/ramendr.openshift.io_protectedvolumereplicationgrouplists.yaml
* config/crd/bases/ramendr.openshift.io_volumereplicationgroups.yaml
* config/crd/kustomization.yaml
* config/crd/kustomizeconfig.yaml
* config/crd/patches/cainjection_in_drclusters.yaml
* config/crd/patches/cainjection_in_drplacementcontrols.yaml
* config/crd/patches/cainjection_in_drpolicies.yaml
* config/crd/patches/cainjection_in_protectedvolumereplicationgrouplists.yaml
* config/crd/patches/cainjection_in_volumereplicationgroups.yaml
* config/crd/patches/webhook_in_drclusters.yaml
* config/crd/patches/webhook_in_drplacementcontrols.yaml
* config/crd/patches/webhook_in_drpolicies.yaml
* config/crd/patches/webhook_in_protectedvolumereplicationgrouplists.yaml
* config/crd/patches/webhook_in_volumereplicationgroups.yaml
* config/default/manager_auth_proxy_patch.yaml
* config/default/manager_config_patch.yaml
* config/dr-cluster/crd/kustomization.yaml
* config/dr-cluster/default/kustomization.yaml
* config/dr-cluster/manager/kustomization.yaml
* config/dr-cluster/manager/ramen_manager_config.yaml
* config/dr-cluster/manifests/bases/ramen_dr_cluster.clusterserviceversion.yaml
* config/dr-cluster/manifests/ramen/kustomization.yaml
* config/dr-cluster/rbac/kustomization.yaml
* config/dr-cluster/rbac/role.yaml
* config/dr-cluster/rbac/role_binding.yaml
* config/dr-cluster/samples/kustomization.yaml
* config/hub/crd/kustomization.yaml
* config/hub/default/kustomization.yaml
* config/hub/manager/kustomization.yaml
* config/hub/manager/ramen_manager_config.yaml
* config/hub/manifests/bases/ramen_hub.clusterserviceversion.yaml
* config/hub/manifests/ramen/kustomization.yaml
* config/hub/manifests/ramen/ramen_manager_config_append.yaml
* config/hub/rbac/kustomization.yaml
* config/hub/rbac/role.yaml
* config/hub/rbac/role_binding.yaml
* config/hub/samples/kustomization.yaml
* config/manager/manager.yaml
* config/olm-install/base/catalog-source-kustomizeconfig.yaml
* config/olm-install/base/kustomization.yaml
* config/olm-install/base/ramen-catalog.yaml
* config/olm-install/base/ramen-operator-group.yaml
* config/olm-install/dr-cluster/kustomization.yaml
* config/olm-install/dr-cluster/ramen-dr-cluster-subscription.yaml
* config/olm-install/hub/kustomization.yaml
* config/olm-install/hub/ramen-hub-subscription.yaml
* config/prometheus/kustomization.yaml
* config/prometheus/monitor.yaml
* config/rbac/auth_proxy_client_clusterrole.yaml
* config/rbac/auth_proxy_role.yaml
* config/rbac/auth_proxy_role_binding.yaml
* config/rbac/auth_proxy_service.yaml
* config/rbac/drcluster_editor_role.yaml
* config/rbac/drcluster_viewer_role.yaml
* config/rbac/drplacementcontrol_editor_role.yaml
* config/rbac/drplacementcontrol_viewer_role.yaml
* config/rbac/drpolicy_editor_role.yaml
* config/rbac/drpolicy_viewer_role.yaml
* config/rbac/leader_election_role.yaml
* config/rbac/leader_election_role_binding.yaml
* config/rbac/protectedvolumereplicationgrouplist_editor_role.yaml
* config/rbac/protectedvolumereplicationgrouplist_viewer_role.yaml
* config/rbac/role.yaml
* config/rbac/role_binding.yaml
* config/rbac/service_account.yaml
* config/rbac/volumereplicationgroup_editor_role.yaml
* config/rbac/volumereplicationgroup_viewer_role.yaml
* config/samples/kustomization.yaml
* config/samples/ramendr_v1alpha1_drcluster.yaml
* config/samples/ramendr_v1alpha1_drplacementcontrol.yaml
* config/samples/ramendr_v1alpha1_drpolicy.yaml
* config/samples/ramendr_v1alpha1_metrodr_drpolicy.yaml
* config/samples/ramendr_v1alpha1_protectedvolumereplicationgrouplist.yaml
* config/samples/ramendr_v1alpha1_ramenconfig.yaml
* config/samples/ramendr_v1alpha1_volumereplicationgroup.yaml
* config/samples/ramnedr_v1alpha1_metrodr_drcluster.yaml
* config/scorecard/bases/config.yaml
* config/scorecard/kustomization.yaml
* config/scorecard/patches/basic.config.yaml
* config/scorecard/patches/olm.config.yaml
* examples/dr_cluster_config.yaml
* examples/dr_hub_config.yaml
* examples/managedclusterview/mcv-pv.yaml
* examples/managedclusterview/mcv-vrg.yaml
* hack/dev-rook-cluster.yaml
* hack/dev-rook-rbdpool.yaml
* hack/dev-rook-sc.yaml
* hack/rook-mirror-secret-template.yaml
* hack/test/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml
* hack/test/0000_00_work.open-cluster-management.io_manifestworks.crd.yaml
* hack/test/0000_01_addon.open-cluster-management.io_managedclusteraddons.crd.yaml
* hack/test/apps.open-cluster-management.io_placementrules_crd.yaml
* hack/test/policy.open-cluster-management.io_placementbindings.yaml
* hack/test/policy.open-cluster-management.io_policies.yaml
* hack/test/replication.storage.openshift.io_volumereplicationclasses.yaml
* hack/test/replication.storage.openshift.io_volumereplications.yaml
* hack/test/snapshot.storage.k8s.io_volumesnapshotclasses.yaml
* hack/test/snapshot.storage.k8s.io_volumesnapshots.yaml
* hack/test/velero.io_backups.yaml
* hack/test/velero.io_backupstoragelocations.yaml
* hack/test/velero.io_restores.yaml
* hack/test/view.open-cluster-management.io_managedclusterviews.yaml
* hack/test/volsync.backube_replicationdestinations.yaml
* hack/test/volsync.backube_replicationsources.yaml

The following files have no licensing information:
* DCO
* hack/minio-deployment.yaml
* hack/test/multicluster.x-k8s.io_serviceexports.yaml


# SUMMARY

* Bad licenses:
* Deprecated licenses:
* Licenses without file extension:
* Missing licenses:
* Unused licenses:
* Used licenses: Apache-2.0
* Read errors: 0
* Files with copyright information: 128 / 238
* Files with license information: 125 / 238

Unfortunately, your project is not compliant with version 3.0 of the REUSE Specification :-(

@ShyamsundarR
Copy link
Member

Ack! :) ignore other discussion in e2e PR for now...

@nirs nirs force-pushed the spdx branch 5 times, most recently from cf81aa9 to 9a9f7f3 Compare October 25, 2022 23:24
@nirs nirs marked this pull request as ready for review October 25, 2022 23:40
@nirs
Copy link
Member Author

nirs commented Oct 26, 2022

The Build image and ensure clean branch test failure is unerelated, works on my fork:
https://github.com/nirs/ramen/actions/runs/3325073812

DCO Outdated Show resolved Hide resolved
@@ -1,3 +1,6 @@
# SPDX-FileCopyrightText: The RamenDR authors
Copy link
Member

Choose a reason for hiding this comment

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

These are copied of CRD from other repositories, placed here for ease of use in envtests (mostly). I would hence assume these should not be copyrighted by Ramen.

Copy link
Member Author

Choose a reason for hiding this comment

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

Having different copyrights is complicated, I don't think we want to go there.
It is easier to have different license for such files (this is why LICENSES/ is
a directory), but this also add complication for no good reason.

What is the issue of Ramen copyright and Apache license on all files in the repo?

Copy link
Member

Choose a reason for hiding this comment

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

Both on DCO and these files, we copied them into this repository and do not own the copyright on them?

Copy link
Member Author

Choose a reason for hiding this comment

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

the DCO is a special case since it is kind of a unmodifed license files and already
has a copyright.

But file like this:
https://github.com/RamenDR/ramen/blob/aeb78e2c0b4865691806e8dd61d6247921c0d378/hack/test/0000_00_clusters.open-cluster-management.io_managedclusters.crd.yaml

has no info on the source of the file and the copyright. We cannot have such files in
the source without any copyright and license. What copyright and license do you want to use for this files?

Can we download the crds from the original source during the build like we do in #559
for rook yamls?

Copy link
Member

Choose a reason for hiding this comment

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

Technically we can and the following should change:

  • - name: Deploy dependent CRDs
    run: |
    kubectl apply -f hack/test/
  • By("bootstrapping test environment")
    testEnv = &envtest.Environment{
    CRDDirectoryPaths: []string{
    filepath.Join("..", "config", "crd", "bases"),
    filepath.Join("..", "hack", "test"),
    },
    }
    (and similar in files util_suite_test.go and volsync_suite_test.go)

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't want to invest more time in this right now, so I'll open issues creating the test
environment dynamically and adding a reuse lint step.

I will change the first commit to add licenses on to files that already have license
boileplate, so we keep the current copyright/license status of the project, using SPDX
instead of the text boilerplate.

Copy link
Member

@ShyamsundarR ShyamsundarR left a comment

Choose a reason for hiding this comment

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

Overall I would feel better if we did not copyright anything in config directory. This one is mostly auto generated, and really do not need to be copyrighted as such.

Are there ways to exclude directories that need not have the copyrights with the reuse tool?

@nirs
Copy link
Member Author

nirs commented Oct 26, 2022

Overall I would feel better if we did not copyright anything in config directory. This one is mostly auto generated, and really do not need to be copyrighted as such.

Are there ways to exclude directories that need not have the copyrights with the reuse tool?

Reuse does not have a way to exclude specific files[1], but it does support the .reuse/dep5 file, which support bulk-license[2] specifying license for specific files without modifying
the files.

I'm checking if this works with reuse lint. I think we want to have a linter so we never
have to argue about these issues in the future, in the same way we use a gofmt to handle
code style.

[1] https://reuse.software/faq/#exclude-file
[2] https://reuse.software/faq/#bulk-license
[3] https://reuse.software/faq/#uncopyrightable

@nirs nirs marked this pull request as draft October 26, 2022 17:27
@nirs nirs marked this pull request as ready for review October 26, 2022 18:04
@nirs nirs requested a review from ShyamsundarR October 26, 2022 19:14
@ShyamsundarR
Copy link
Member

Overall I would feel better if we did not copyright anything in config directory. This one is mostly auto generated, and really do not need to be copyrighted as such.
Are there ways to exclude directories that need not have the copyrights with the reuse tool?

Reuse does not have a way to exclude specific files[1], but it does support the .reuse/dep5 file, which support bulk-license[2] specifying license for specific files without modifying the files.

I'm checking if this works with reuse lint. I think we want to have a linter so we never have to argue about these issues in the future, in the same way we use a gofmt to handle code style.

[1] https://reuse.software/faq/#exclude-file [2] https://reuse.software/faq/#bulk-license [3] https://reuse.software/faq/#uncopyrightable

The YAML files for example under config/samples are provided with the olm bundle to enable users to create their versions of the resource, modifying the given sample. A copyright appearing in the sample would require what from the user under the Redistribution clause of the copyright .

Practice in this space does not seem to copyright the YAMLs and unless we know where we stand legally on this it is difficult to decide otherwise. IOW, I do not want to spook a user making changes to the deployment YAMLs or samples for their distribution.

@ShyamsundarR
Copy link
Member

The YAML files for example under config/samples are provided with the olm bundle to enable users to create their versions of the resource, modifying the given sample. A copyright appearing in the sample would require what from the user under the Redistribution clause of the copyright .

I would possibly put these as configuration files and hence copyright not required, as in: https://reuse.software/faq/#what-is-copyrightable

@nirs
Copy link
Member Author

nirs commented Oct 27, 2022

The YAML files for example under config/samples are provided with the olm bundle to enable users to create their versions of the resource, modifying the given sample. A copyright appearing in the sample would require what from the user under the Redistribution clause of the copyright .

I would possibly put these as configuration files and hence copyright not required, as in: https://reuse.software/faq/#what-is-copyrightable

In the current version, the entire config directory is marked CC0-1.0 (public domain). Are
you OK, with this?

@nirs nirs marked this pull request as draft October 27, 2022 14:54
@nirs nirs marked this pull request as ready for review October 27, 2022 23:06
The modern way to specify copyright and license is using SPDX[1]
headers. This is nicer for developers and more friendly for programs
that want to extract this info.

This change replaces existing copyright and license boilerplate with SPDX
headers.

SPDX headers were added using:

    reuse init
    ...
    reuse addheader \
        --copyright 'The RamenDR authors' \
        --exclude-year \
        --license Apache-2.0 \
        --template ramen \
        --skip-unrecognised \
        `git grep -l -E '^Copyright [0-9]+ The RamenDR'`

And removing the duplicate `Copyright` lines created by the `reuse` tool:

    // Copyright 2022 The RamenDR authors.

The copyright excludes the years since this info is not really needed,
and this avoids the work of updating all copyrights every year.

The hack/boilerplate.go.txt and .golangci.yaml were modified manually.

Signed-off-by: Nir Soffer <[email protected]>
@nirs nirs force-pushed the spdx branch 2 times, most recently from 590a95c to 7a0b024 Compare October 28, 2022 00:38
nirs added 6 commits October 28, 2022 03:47
Keeping LICENSE helps github and Go tools to detect the license.

Signed-off-by: Nir Soffer <[email protected]>
For some reason drplacementcontrolvolsync.go did not have copyright and
license boileplate, add SPDX haders.

Signed-off-by: Nir Soffer <[email protected]>
For some reason some of the tests had no copyright and license
boilerplate, add SPDX headers.

Added using:

    $ reuse addheader \
        --copyright 'The RamenDR authors' \
        --exclude-year \
        --license Apache-2.0 \
        --template ramen \
        `git ls-files | grep _test.g`

Signed-off-by: Nir Soffer <[email protected]>
Various documents had no license or copyright information. Add the same
copyright and license used by the Go files.

Added using:

    $ reuse addheader \
        --copyright 'The RamenDR authors' \
        --exclude-year \
        --license Apache-2.0 \
        --template ramen \
        `git ls-files | grep '.md$'

Signed-off-by: Nir Soffer <[email protected]>
Like the rest of the documents, the images should have copyright and
license information. This is done by an explicit .license file.

Add using:

    reuse addheader \
        --copyright 'The RamenDR authors' \
        --exclude-year \
        --license Apache-2.0 \
        --template ramen \
        docs/interfaces.png

Signed-off-by: Nir Soffer <[email protected]>
The hack directory scripts had no copyright info. Use the same as the Go
files.

Added using:

    $ reuse addheader \
        --copyright 'The RamenDR authors' \
        --exclude-year \
        --license Apache-2.0 \
        --template ramen \
        `git ls-files | grep -E 'hack/.+\.sh$'`

Signed-off-by: Nir Soffer <[email protected]>
Copy link
Member

@ShyamsundarR ShyamsundarR left a comment

Choose a reason for hiding this comment

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

Questions:

  • The CC for config/ is removed, the plan is to add this later?
  • reuse automation is again for later?
  • I think as a followup these files should not get a copyright notice, they are autogenerated or config files and if we can exclude them and implement reuse automation we should:
    • go.mod, go.sum, .dockerignore, .gitignore

Rest of the changes are good, and moves us closer to lesser copyright worries in the future, thanks!

@nirs
Copy link
Member Author

nirs commented Oct 28, 2022

Questions:

  • The CC for config/ is removed, the plan is to add this later?

Yes, but I'm not sure this is correct for all files in config.

  • reuse automation is again for later?

Yes, this can be used only when handle all files in the project.

  • I think as a followup these files should not get a copyright notice, they are autogenerated or config files and if we can exclude them and implement reuse automation we should:

    • go.mod, go.sum, .dockerignore, .gitignore

I don't think it worth the effort to have special license (e.g. CC0-10) for these files,
but it is very easy to add rule in .reuse/dep5 to handle this.

For now I will remove these files from the last commit, and we can discuss them later.

To make the project compliant with the REUSE spec[1], all files should
have SPDX headers. For simplicity, treat the rest of the files in the
same way we treat code.

Some files in config, examples, and hack directories are not handled
yet, since it is not clear if we own them and which license should be
used.

We did not decide yet how to license go.mod, go.sum, .*ignore, so they
are not included in this commit.

[1] https://reuse.software/spec/

Signed-off-by: Nir Soffer <[email protected]>
@nirs
Copy link
Member Author

nirs commented Oct 28, 2022

@ShyamsundarR I removed go.mod, go.sum, and .*ignore files from the last commit. This should
be ready for merge.

Added #577 for tracking the next step of this work.

@ShyamsundarR ShyamsundarR merged commit 8e0d8b9 into RamenDR:main Oct 31, 2022
@nirs nirs deleted the spdx branch November 13, 2022 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants