From 92fcecc30da00dd775fea41bab512a99b33a6dfe Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 24 Oct 2022 12:11:47 -0400 Subject: [PATCH] ci: adding flatten plugin check (#530) Fixes https://github.com/googleapis/java-shared-config/issues/525 --- .../workflows/downstream-dependencies.yaml | 16 +++++++++ .kokoro/client-library-check.sh | 23 ++++++++++++- ...v2.9.3-expected-flattened-dependencies.txt | 33 +++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .kokoro/java-storage-v2.9.3-expected-flattened-dependencies.txt diff --git a/.github/workflows/downstream-dependencies.yaml b/.github/workflows/downstream-dependencies.yaml index 5911098d..c6f5e91d 100644 --- a/.github/workflows/downstream-dependencies.yaml +++ b/.github/workflows/downstream-dependencies.yaml @@ -27,3 +27,19 @@ jobs: - run: sudo apt-get update -y - run: sudo apt-get install libxml2-utils - run: .kokoro/client-library-check.sh ${{matrix.repo}} dependencies + + flatten-plugin-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 11 + - run: java -version + - run: sudo apt-get update -y + - run: sudo apt-get install libxml2-utils + - run: .kokoro/client-library-check.sh java-storage flatten-plugin + env: + REPO_TAG: v2.9.3 + EXPECTED_DEPENDENCIES_LIST: java-storage-v2.9.3-expected-flattened-dependencies.txt diff --git a/.kokoro/client-library-check.sh b/.kokoro/client-library-check.sh index 3cddeb10..bbc8470e 100755 --- a/.kokoro/client-library-check.sh +++ b/.kokoro/client-library-check.sh @@ -52,7 +52,12 @@ echo "Version: ${VERSION}" # Check this BOM against a few java client libraries # java-bigquery -git clone "https://github.com/googleapis/${REPO}.git" --depth=1 +if [ -z "${REPO_TAG}" ]; then + git clone "https://github.com/googleapis/${REPO}.git" --depth=1 +else + git clone "https://github.com/googleapis/${REPO}.git" --depth=1 --branch "${REPO_TAG}" +fi + pushd ${REPO} # replace version @@ -69,6 +74,22 @@ dependencies) .kokoro/dependencies.sh RETURN_CODE=$? ;; +flatten-plugin) + # This creates .flattened-pom.xml + .kokoro/build.sh + pushd google-cloud-* + mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true \ + | grep '\[INFO] .*:.*:.*:.*:.*' |awk '{print $2}' > .actual-flattened-dependencies-list.txt + echo "Diff from the expected file (${EXPECTED_DEPENDENCIES_LIST}):" + diff "${scriptDir}/${EXPECTED_DEPENDENCIES_LIST}" .actual-flattened-dependencies-list.txt + RETURN_CODE=$? + if [ "${RETURN_CODE}" == 0 ]; then + echo "No diff." + else + echo "There was a diff." + fi + popd + ;; *) # This reads the JOB_TYPE environmental variable .kokoro/build.sh diff --git a/.kokoro/java-storage-v2.9.3-expected-flattened-dependencies.txt b/.kokoro/java-storage-v2.9.3-expected-flattened-dependencies.txt new file mode 100644 index 00000000..c71db6f6 --- /dev/null +++ b/.kokoro/java-storage-v2.9.3-expected-flattened-dependencies.txt @@ -0,0 +1,33 @@ +com.fasterxml.jackson.core:jackson-core:jar:2.13.3:compile +com.google.api-client:google-api-client:jar:1.35.1:compile +com.google.api.grpc:proto-google-common-protos:jar:2.9.0:compile +com.google.api.grpc:proto-google-iam-v1:jar:1.4.1:compile +com.google.api:api-common:jar:2.2.1:compile +com.google.api:gax-httpjson:jar:0.103.2:compile +com.google.api:gax:jar:2.18.2:compile +com.google.apis:google-api-services-storage:jar:v1-rev20220705-1.32.1:compile +com.google.auth:google-auth-library-credentials:jar:1.7.0:compile +com.google.auth:google-auth-library-oauth2-http:jar:1.7.0:compile +com.google.auto.value:auto-value-annotations:jar:1.10:compile +com.google.cloud:google-cloud-core-http:jar:2.8.0:compile +com.google.cloud:google-cloud-core:jar:2.8.0:compile +com.google.code.findbugs:jsr305:jar:3.0.2:compile +com.google.code.gson:gson:jar:2.9.0:compile +com.google.guava:failureaccess:jar:1.0.1:compile +com.google.guava:guava:jar:31.1-jre:compile +com.google.guava:listenablefuture:jar:9999.0-empty-to-avoid-conflict-with-guava:compile +com.google.http-client:google-http-client-apache-v2:jar:1.42.0:compile +com.google.http-client:google-http-client-appengine:jar:1.42.0:compile +com.google.http-client:google-http-client-gson:jar:1.42.0:compile +com.google.http-client:google-http-client-jackson2:jar:1.42.0:compile +com.google.http-client:google-http-client:jar:1.42.0:compile +com.google.j2objc:j2objc-annotations:jar:1.3:compile +com.google.oauth-client:google-oauth-client:jar:1.34.1:compile +com.google.protobuf:protobuf-java-util:jar:3.21.1:compile +com.google.protobuf:protobuf-java:jar:3.21.1:compile +io.grpc:grpc-context:jar:1.47.0:compile +io.opencensus:opencensus-api:jar:0.31.1:compile +io.opencensus:opencensus-contrib-http-util:jar:0.31.1:compile +javax.annotation:javax.annotation-api:jar:1.3.2:compile +org.checkerframework:checker-qual:jar:3.22.2:compile +org.threeten:threetenbp:jar:1.6.0:compile