Skip to content

ci: GitHub Actions to validate a Maven BOM#5928

Merged
gcf-merge-on-green[bot] merged 19 commits intomainfrom
bom-canary-project
Apr 17, 2023
Merged

ci: GitHub Actions to validate a Maven BOM#5928
gcf-merge-on-green[bot] merged 19 commits intomainfrom
bom-canary-project

Conversation

@suztomo
Copy link
Member

@suztomo suztomo commented Apr 14, 2023

Fixes #5922

It worked in googleapis/sdk-platform-java#1629

Todo:

@suztomo suztomo requested a review from a team April 14, 2023 19:49
@product-auto-label product-auto-label bot added the size: l Pull request size is large. label Apr 14, 2023
@generated-files-bot
Copy link

Warning: This pull request is touching the following templated files:

  • .github/workflows/ci.yaml

@suztomo
Copy link
Member Author

suztomo commented Apr 14, 2023

"ci / bom-content-test" fails. The check detected the invalid entries in the previous gapic-libraries-bom successfully https://github.com/googleapis/java-cloud-bom/actions/runs/4703742327/jobs/8342595777?pr=5928:

[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 14.253 s [INFO] Finished at: 2023-04-14T20:41:59Z [INFO] ------------------------------------------------------------------------ Error: Failed to execute goal on project bom-validation-canary-project: Could not resolve dependencies for project com.google.cloud:bom-validation-canary-project:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: com.google.analytics.api.grpc:grpc-google-analytics-admin-v1alpha:jar:0.24.0, com.google.analytics.api.grpc:grpc-google-analytics-admin-v1beta:jar:0.24.0, com.google.analytics.api.grpc:proto-google-analytics-admin-v1alpha:jar:0.24.0, com.google.analytics.api.grpc:proto-google-analytics-admin-v1beta:jar:0.24.0, com.google.analytics.api.grpc:grpc-google-analytics-data-v1beta:jar:0.25.0, com.google.analytics.api.grpc:grpc-google-analytics-data-v1alpha:jar:0.25.0, com.google.analytics.api.grpc:proto-google-analytics-data-v1beta:jar:0.25.0, com.google.analytics.api.grpc:proto-google-analytics-data-v1alpha:jar:0.25.0, com.google.area120.api.grpc:grpc-google-area120-tables-v1alpha1:jar:0.18.0, com.google.area120.api.grpc:proto-google-area120-tables-v1alpha1:jar:0.18.0: Could not find artifact com.google.analytics.api.grpc:grpc-google-analytics-admin-v1alpha:jar:0.24.0 in central (https://repo.maven.apache.org/maven2) -> [Help 1]

#5927 fixes the invalid entries.

Comment on lines -22 to -24
run: |
mvn -B -V -ntp verify -Dtest="BomContentTest#testLibrariesBomReachable"
working-directory: tests
Copy link
Member Author

Choose a reason for hiding this comment

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

This new check can replace testLibrariesBomReachable

Comment on lines +23 to +25
uses: ./tests/validate-bom
with:
bom-path: libraries-bom/pom.xml
Copy link
Member Author

Choose a reason for hiding this comment

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

This is how to use the action within the repository.

Until #5927 is merged, this check fails.

@suztomo suztomo requested a review from burkedavison April 14, 2023 21:03
@@ -12,6 +12,7 @@ jobs:
with:
distribution: zulu
Copy link
Member

Choose a reason for hiding this comment

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

Reminder about Temurin

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

# Before this "cd", the working directory is the repository that calls
# this action. To use validate-bom classes, it needs to change directory
# to the directory that defines this action.
cd ${{ github.action_path }}
Copy link
Member

Choose a reason for hiding this comment

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

Is this change in directory going to persist for actions that occur after this one? Consider whether a cd - might needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

With 5a2b10f#diff-a99b266a2cc5b5faa4e52c7033afaa8f21940a05da21eee64411476434d97788R41 I checked debug print and confirmed this "cd" affects only within this step.

image

In general, "cd" in shell script invocation with "bash some-script.sh" does not affect the working directory of the caller.

echo "Compiling CreateBomCanaryProject.java in $(pwd)"
mvn -V -ntp compile
echo "Running CreateBomCanaryProject with ${bom_absolute_path}"
mvn -V -ntp -B exec:java -DoutputPath=/tmp/bom-validation -DbomPath="${bom_absolute_path}"
Copy link
Member

Choose a reason for hiding this comment

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

If this action is used twice in a repo with two different BOMs, will the first invocation pollute the project setup or results of the second? (I think the answer is: this is fine. However, if GitHub were to run two BOM validations concurrently, there might be a conflict.) If we're unsure, consider making the BOM's output path calculated from the BOM-under-tests' name.

Copy link
Member Author

@suztomo suztomo Apr 17, 2023

Choose a reason for hiding this comment

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

if GitHub were to run two BOM validations concurrently

GitHub Actions do not run concurrently on one filesystem.


Bom bom;
try {
bom = Bom.readBom(bomPath);
Copy link
Member

Choose a reason for hiding this comment

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

Neat

@suztomo suztomo added the automerge Merge the pull request once unit tests and other checks pass. label Apr 17, 2023
@gcf-merge-on-green gcf-merge-on-green bot merged commit 04160b1 into main Apr 17, 2023
@gcf-merge-on-green gcf-merge-on-green bot deleted the bom-canary-project branch April 17, 2023 14:48
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How might we enhance validation on BOMs?

2 participants