RFR: 8223: Copyright script is failing

Alex Macdonald aptmac at openjdk.org
Wed Jun 26 17:27:41 UTC 2024


This PR addresses https://bugs.openjdk.org/browse/JMC-8223.

There have been recent false positives with the copyright check script, which were happening if the PR branch was out of date with the master branch. At the moment, the script takes a diff between master and the PR branch to see what files have been changed, and then checks those files for the license header years. If a PR branch is not based ontop of upstream/master, there can be a chance that the latest master branch commits include file changes not in the PR branch, which creates a false positivie.

To give better insight as to why the script failed, I added a check in the conditional where files have been flagged as being out of date headers, to check whether or not the branch is out of date. This way it will list all the files that are affected, but then exit the script asking the user to rebase their work.

For example, I've created a branch where HEAD points at a commit before the platform-definitions were removed. As a result, doing a diff against upstream/master will flag these files: 

https://github.com/aptmac/jmc/actions/runs/9683981058/job/26720688313#step:3:39

Requires update: releng/platform-definitions/platform-definition-2022-09/pom.xml
Requires update: releng/platform-definitions/platform-definition-2022-09/pom.xml
Requires update: releng/platform-definitions/platform-definition-2022-12/pom.xml
Requires update: releng/platform-definitions/platform-definition-2022-12/pom.xml
Requires update: releng/platform-definitions/platform-definition-2023-03/pom.xml
Requires update: releng/platform-definitions/platform-definition-2023-03/pom.xml
Requires update: releng/platform-definitions/platform-definition-2023-09/pom.xml
Requires update: releng/platform-definitions/platform-definition-2023-09/pom.xml
Branch is out of date with upstream/master. Please rebase your branch and try again.
Error: Process completed with exit code 1.

-------------

Commit messages:
 - 8223: Copyright script is failing

Changes: https://git.openjdk.org/jmc/pull/569/files
  Webrev: https://webrevs.openjdk.org/?repo=jmc&pr=569&range=00
  Issue: https://bugs.openjdk.org/browse/JMC-8223
  Stats: 9 lines in 1 file changed: 9 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jmc/pull/569.diff
  Fetch: git fetch https://git.openjdk.org/jmc.git pull/569/head:pull/569

PR: https://git.openjdk.org/jmc/pull/569


More information about the jmc-dev mailing list