-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Ensure lint workflow checks whether 3rd party license and code is up to date #11047
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
Conversation
This commit introduces the use of `go-licenses` within CI/CD and manual processes for generating / updating the license information used by GitHub CLI including the code required by license to be redistributed. During GitHub CLI pull requests, the `lint` workflow will notify users if this information is not updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds automated checks and tooling to ensure third-party license information is kept up to date, including source files for licenses that require redistribution.
- Introduce
script/licenses
to generate license reports and copy necessary license files - Add
script/licenses-check
and update.github/workflows/lint.yml
to fail CI if license docs aren’t current - Add documentation (
docs/license-compliance.md
) and a Go-licenses template for consistent output
Reviewed Changes
Copilot reviewed 1028 out of 1028 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
.github/workflows/lint.yml | Include license compliance paths and add a “Check licenses” step |
script/licenses | New script to generate third-party license files |
script/licenses-check | New script to verify license documentation is up to date |
docs/license-compliance.md | Documentation for maintaining and checking license compliance |
.github/licenses.tmpl | Go-licenses template for generating markdown listings |
Comments suppressed due to low confidence (2)
script/licenses-check:1
- Ensure this script file has execute permissions (e.g.,
chmod +x script/licenses-check
) so that CI and local invocations can run it directly.
#!/bin/bash
script/licenses:1
- Ensure this script file has execute permissions (e.g.,
chmod +x script/licenses
) so it can be executed in CI and by contributors.
#!/bin/bash
third-party/github.com/letsencrypt/boulder/metrics/measured_http/http.go
Dismissed
Show dismissed
Hide dismissed
third-party/github.com/letsencrypt/boulder/observer/probers/tls/tls.go
Dismissed
Show dismissed
Hide dismissed
third-party/github.com/letsencrypt/boulder/ocsp/responder/responder.go
Dismissed
Show dismissed
Hide dismissed
With these changes, `cli/cli` will be redistributing code as-is due to license compliance, which we will not change or address issues around. Without these changes, our pull requests are getting a bunch of false positive annotations we cannot and will not fix directly.
This comment was marked as spam.
This comment was marked as spam.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I don't think anything is blocking enough to avoid merge this 👏
I would like to understand the versioning strategy a bit more, but I don't think that blocks this PR - more details in my comment on script/licenses
:)
@@ -0,0 +1,25 @@ | |||
#!/bin/bash | |||
|
|||
go install github.com/google/go-licenses@latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Are we comfortable with always using the latest here, or should we pin to a sha for stability/security etc?
I know that pinning comes with the "when does this get updated then?" question, and I don't know the answer to that either :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is especially in my mind with this script being used in actions... 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BagToad : what do you think about conditionalizing this to skip installing this if CI
, leaving that to the workflow?
otherwise, everything running the script has to manage its installation. conditionalizing it will make it easy for contributors and maintainers.
# Clear third-party source code to avoid stale content | ||
rm -rf third-party | ||
mkdir -p third-party | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Should we check successes (exit codes) here? Are we okay with this maybe failing but then continuing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not worried about these commands failing, but if there is a concern then we might want to set -e
so any errors cause the whole script to fail.
|
||
# Setup temporary directory to collect updated third-party source code | ||
export TEMPDIR="$(mktemp -d)" | ||
trap "rm -fr ${TEMPDIR}" EXIT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(praise) Smart!
echo "Generating licenses for ${goos}..." | ||
GOOS="${goos}" go-licenses save ./... --save_path="${TEMPDIR}/${goos}" --force || echo "Ignore warnings" | ||
GOOS="${goos}" go-licenses report ./... --template .github/licenses.tmpl --ignore github.com/cli/cli > third-party-licenses.${goos}.md || echo "Ignore warnings" | ||
cp -fR "${TEMPDIR}/${goos}"/* third-party/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Similar question here - should we check exit codes here or keep going even if something failed?
fixes #9422
fixes github/cli#111
This pull request addresses GitHub CLI obligation to comply with the licenses of our 3rd party dependencies.
These changes update the
lint
workflow to verify license information is up to date including source code certain licenses require redistributing source code around.Additionally, this pull request introduces
scripts/license
andscripts/license-check
to help maintainers and contributors regenerate this information easily.