1 #!/bin/bash 2 set -veux -o pipefail 3 4 if [[ -f /VERSION ]]; then 5 cat /VERSION 6 fi 7 8 readonly GRPC_JAVA_DIR="$(cd "$(dirname "$0")"/../.. && pwd)" 9 10 echo "Verifying that all artifacts are here..." 11 find "$KOKORO_GFILE_DIR" 12 13 # The output from all the jobs are coalesced into a single dir 14 LOCAL_MVN_ARTIFACTS="$KOKORO_GFILE_DIR"/github/grpc-java/mvn-artifacts/ 15 16 # verify that files from all 3 grouped jobs are present. 17 # platform independent artifacts, from linux job: 18 [[ "$(find "$LOCAL_MVN_ARTIFACTS" -type f -iname 'grpc-core-*.jar' | wc -l)" != '0' ]] 19 20 # android artifact from linux job: 21 [[ "$(find "$LOCAL_MVN_ARTIFACTS" -type f -iname 'grpc-android-*.aar' | wc -l)" != '0' ]] 22 23 # from linux job: 24 [[ "$(find "$LOCAL_MVN_ARTIFACTS" -type f -iname 'protoc-gen-grpc-java-*-linux-x86_64.exe' | wc -l)" != '0' ]] 25 [[ "$(find "$LOCAL_MVN_ARTIFACTS" -type f -iname 'protoc-gen-grpc-java-*-linux-x86_32.exe' | wc -l)" != '0' ]] 26 27 # from macos job: 28 [[ "$(find "$LOCAL_MVN_ARTIFACTS" -type f -iname 'protoc-gen-grpc-java-*-osx-x86_64.exe' | wc -l)" != '0' ]] 29 30 # from windows job: 31 [[ "$(find "$LOCAL_MVN_ARTIFACTS" -type f -iname 'protoc-gen-grpc-java-*-windows-x86_64.exe' | wc -l)" != '0' ]] 32 [[ "$(find "$LOCAL_MVN_ARTIFACTS" -type f -iname 'protoc-gen-grpc-java-*-windows-x86_32.exe' | wc -l)" != '0' ]] 33 34 35 mkdir -p ~/.config/ 36 gsutil cp gs://grpc-testing-secrets/sonatype_credentials/sonatype-upload ~/.config/sonatype-upload 37 38 mkdir -p ~/java_signing/ 39 gsutil cp -r gs://grpc-testing-secrets/java_signing/ ~/ 40 gpg --batch --import ~/java_signing/grpc-java-team-sonatype.asc 41 42 # gpg commands changed between v1 and v2 are different. 43 gpg --version 44 45 # This is the version found on kokoro. 46 if gpg --version | grep 'gpg (GnuPG) 1.'; then 47 # This command was tested on 1.4.16 48 find "$LOCAL_MVN_ARTIFACTS" -type f \ 49 -not -name "maven-metadata.xml*" -not -name "*.sha1" -not -name "*.md5" -exec \ 50 bash -c 'cat ~/java_signing/passphrase | gpg --batch --passphrase-fd 0 --detach-sign -a {}' \; 51 fi 52 53 # This is the version found on corp workstations. Maybe kokoro will be updated to gpg2 some day. 54 if gpg --version | grep 'gpg (GnuPG) 2.'; then 55 # This command was tested on 2.2.2 56 find "$LOCAL_MVN_ARTIFACTS" -type f \ 57 -not -name "maven-metadata.xml*" -not -name "*.sha1" -not -name "*.md5" -exec \ 58 gpg --batch --passphrase-file ~/java_signing/passphrase --pinentry-mode loopback \ 59 --detach-sign -a {} \; 60 fi 61 62 STAGING_REPO=a93898609ef848 63 "$GRPC_JAVA_DIR"/buildscripts/sonatype-upload.sh "$STAGING_REPO" "$LOCAL_MVN_ARTIFACTS" 64