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

feat: add dependency versions script #741

Closed
wants to merge 71 commits into from
Closed

feat: add dependency versions script #741

wants to merge 71 commits into from

Conversation

salehsquared
Copy link
Contributor

@salehsquared salehsquared commented Jul 24, 2020

Related to #735

Adds in two scripts to be used as presubmit checks:
(1) deps-finder.sh
If added as a presubmit check, this will first check if the associated PR was in the format of "deps: update...". If this is not the case, the script will return success and end. If a google-cloud dependency that is meant to use java-shared-dependencies was updated, then the script will check if the updated dependency has the most recent version of java-shared-dependencies. If it does not, the script will fail. In all other cases (e.g. something that is not meant to use java-shared-dependencies), the script will pass.

(2) release-versions.sh
If added as a presubmit check, this will check if the PR was made on a non-SNAPSHOT release branch. If it was not, the script will return success and end. Otherwise, it will check our dependencyManagement list for any client libraries that utilize java-shared-dependencies.
If at least one client library is meant to use java-shared-dependencies and does not have the latest version of java-shared-dependencies, the script will fail. Currently there are many client libraries in this category, and they are all summarized by the script, including which version of shared-dependencies they use.

Summary of the current state of the client libraries (master branch, checked 07/09):
Number of incorrect dependencies found: 50. Number of correct dependencies: 11.

Edit (07/10): java-storage-nio is no longer incorrectly tagged, and is thus no longer blocking the script.

@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Jul 24, 2020
Saleh Mostafa added 2 commits July 29, 2020 16:09
@salehsquared
Copy link
Contributor Author

@chingor13 Completed updates on scripts per our conversation on Monday. Interested to hear your thoughts!

@stephaniewang526 stephaniewang526 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 20, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 20, 2020
@google-cla
Copy link

google-cla bot commented Aug 25, 2020

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Aug 25, 2020
@stephaniewang526
Copy link
Contributor

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.

What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@salehsquared -- please sigh cla since you are external contributor now. Thanks!

@google-cla
Copy link

google-cla bot commented Aug 25, 2020

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@salehsquared
Copy link
Contributor Author

@googlebot I signed it!

@google-cla google-cla bot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Aug 26, 2020
@stephaniewang526 stephaniewang526 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 27, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Aug 27, 2020
@stephaniewang526 stephaniewang526 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 22, 2020
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 22, 2020
pushd "${scriptDir}/../dependency-convergence"
mvn clean install -DskipTests
# Single quotes around double quotes so that the branch name is counted as only one argument
mvn exec:java -Dexec.args="'${runRelease}'"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest we break these into separate checks (rather than re-using the same check). We can run these from GitHub actions and skip if the commit does not match what we expect.

.generateArtifactData(latestSharedDependencies);
String latestSharedDependenciesVersion = sharedDependenciesData.getLatestVersion();
if (latestSharedDependenciesVersion == null || latestSharedDependenciesVersion.isEmpty()) {
return 2;
Copy link
Collaborator

Choose a reason for hiding this comment

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

These magic integers should either be enums or perhaps thrown exceptions

return 1;
}
// A release PR was found
Arguments arguments = Arguments.readCommandLine("-f ../pom.xml");
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is very odd usage of command line parsing. Instead, you should be able to instantiate the Bom instance yourself. It's also odd to hard code this value.

System.out.println("Total dependencies checked: " + clientLibraries.size());
}

@VisibleForTesting
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is marked visible for testing but is not tested directly.

* google-cloud-shared-dependencies was not in the POM file, null if the POM file could not be
* found
*/
private static String getSharedDependenciesVersion(String pomUrl) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Much of this code seems to share functionality with the dashboard, should we combine the artifacts and share logic?

}
for (Dependency dependency : model.getDependencyManagement()
.getDependencies()) {
if ("com.google.cloud".equals(dependency.getGroupId()) && "google-cloud-shared-dependencies"
Copy link
Collaborator

Choose a reason for hiding this comment

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

It'd be nice if we tested this parsing.

@stephaniewang526
Copy link
Contributor

Closing as it is addressed in #1752

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants