diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml new file mode 100644 index 000000000000..43014dfd6393 --- /dev/null +++ b/.github/.OwlBot.lock.yaml @@ -0,0 +1,17 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +docker: + image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest + digest: sha256:b47e411068ffc6e6990cb4e0802fbac9a4488dec7f5f424553518ba21abea208 + # created: 2022-07-26T00:00:00.000000000Z diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml new file mode 100644 index 000000000000..5d9a9d8b5607 --- /dev/null +++ b/.github/.OwlBot.yaml @@ -0,0 +1,16 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +docker: + image: "gcr.io/cloud-devrel-public-resources/owlbot-java:latest" diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 000000000000..ec94288dbc9b --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1,3 @@ +primaryBranch: monorepo_script_output +releaseType: java-yoshi +manifest: true diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml new file mode 100644 index 000000000000..7fe36225780b --- /dev/null +++ b/.github/release-trigger.yml @@ -0,0 +1 @@ +enabled: true \ No newline at end of file diff --git a/.github/rename-to-workflows/googleapis_hermetic_sync.yaml b/.github/rename-to-workflows/googleapis_hermetic_sync.yaml new file mode 100644 index 000000000000..e54a6dcff224 --- /dev/null +++ b/.github/rename-to-workflows/googleapis_hermetic_sync.yaml @@ -0,0 +1,53 @@ +name: Googleapis Sync (Hermetic Build) +on: + workflow_dispatch: + +jobs: + create-pull-request: + name: Create pull request for recent googleapis changes + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + repository: 'googleapis/google-cloud-java' + - name: Setup workspace + run: | + mkdir -p "${WORKSPACE}" + git config user.email "yoshi-code-bot[bot]@users.noreply.github.com" + git config user.name "yoshi-code-bot" + + git clone --quiet --branch "${BASE_BRANCH}" --depth 1 \ + https://github.com/googleapis/google-cloud-java \ + "${WORKSPACE}/google-cloud-java" + cd "${WORKSPACE}/google-cloud-java" + # This should match the branch name we push to remote in the following steps + git checkout -b monorepo_googleapis_change + env: + WORKSPACE: /tmp/googleapis-sync + # Note for cutover to main: update this to main + BASE_BRANCH: monorepo_script_output + - name: Propagate googleapis commits to google-cloud-java + run: | + .kokoro/sync_with_googleapis.sh + env: + WORKSPACE: /tmp/googleapis-sync + GOOGLE_CLOUD_JAVA_DIR: /tmp/googleapis-sync/google-cloud-java + - name: Push changes to remote repository + run: | + git remote add origin_with_auth \ + https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git + git push -f --set-upstream origin_with_auth monorepo_googleapis_change + working-directory: /tmp/googleapis-sync/google-cloud-java + env: + GITHUB_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} + - name: Create pull request + run: | + gh pr create --title='chore: googleapis change propagation via hermetic build' \ + --body='googleapis change propagation via hermetic build' \ + --base="${BASE_BRANCH}" \ + --head=monorepo_googleapis_change + working-directory: /tmp/googleapis-sync/google-cloud-java + env: + GITHUB_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} + # Note for cutover to main: update this to main + BASE_BRANCH: monorepo_script_output \ No newline at end of file diff --git a/.github/rename-to-workflows/readme.yaml b/.github/rename-to-workflows/readme.yaml new file mode 100644 index 000000000000..2ddf36cb45ac --- /dev/null +++ b/.github/rename-to-workflows/readme.yaml @@ -0,0 +1,45 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +on: + workflow_dispatch: + schedule: + # every morning + - cron: '0 1 * * *' +name: readme +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.7' + architecture: 'x64' + - run: python3 -m pip install requests + - run: python3 generate-readme.py + - uses: googleapis/code-suggester@v3 + env: + ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + command: pr + upstream_owner: googleapis + upstream_repo: google-cloud-java + description: 'ran python3 generate-readme.py' + title: 'chore: regenerate client table in README' + message: 'chore: regenerate client table in README' + branch: update-readme + primary: main + force: true + git_dir: '.' diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml new file mode 100644 index 000000000000..eaaf22d3e36b --- /dev/null +++ b/.github/sync-repo-settings.yaml @@ -0,0 +1,39 @@ +# Whether or not rebase-merging is enabled on this repository. +# Defaults to `true` +rebaseMergeAllowed: false + +# Whether or not squash-merging is enabled on this repository. +# Defaults to `true` +squashMergeAllowed: true + +# Whether or not PRs are merged with a merge commit on this repository. +# Defaults to `false` +mergeCommitAllowed: false + +# Rules for main branch protection +branchProtectionRules: +# Identifies the protection rule pattern. Name of the branch to be protected. +# Defaults to `main` +- pattern: main + # Can admins overwrite branch protection. + # Defaults to `true` + isAdminEnforced: true + # Number of approving reviews required to update matching branches. + # Defaults to `1` + requiredApprovingReviewCount: 1 + # Are reviews from code owners required to update matching branches. + # Defaults to `false` + requiresCodeOwnerReviews: true + # Require up to date branches + requiresStrictStatusChecks: false + # List of required status check contexts that must pass for commits to be accepted to matching branches. + requiredStatusCheckContexts: + - "cla/google" +# List of explicit permissions to add (additive only) +permissionRules: +- team: yoshi-admins + permission: admin +- team: yoshi-java-admins + permission: admin +- team: yoshi-java + permission: push \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000000..6b11d92c8aff --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,105 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# Github action job to test core java library features on +# downstream client libraries before they are released. +on: + push: + branches: + # TODO: Update to main + - monorepo_script_output + pull_request: +name: ci +jobs: + units: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + java: [8, 11, 17] + steps: + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d' --utc)" + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: ${{matrix.java}} + - run: java -version + - uses: actions/cache@v3 + id: mvn-cache + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.date }} + - run: | + mvn -B -ntp \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dcheckstyle.skip=true \ + -Dflatten.skip=true \ + -Danimal.sniffer.skip=true \ + -T 1C \ + test + windows: + runs-on: windows-latest + steps: + - name: Support longpaths + run: git config --system core.longpaths true + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 11 + - run: java -version + - run: .kokoro/build.bat + env: + JOB_TYPE: test +# TODO: Uncomment the needed Github Actions +# dependencies: +# runs-on: ubuntu-latest +# strategy: +# matrix: +# java: [8, 11, 17] +# steps: +# - uses: actions/checkout@v3 +# - uses: actions/setup-java@v3 +# with: +# distribution: zulu +# java-version: ${{matrix.java}} +# - run: java -version +# - run: .kokoro/dependencies.sh +# lint: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - uses: actions/setup-java@v3 +# with: +# distribution: zulu +# java-version: 11 +# - run: java -version +# - run: .kokoro/build.sh +# env: +# JOB_TYPE: lint +# clirr: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# - uses: actions/setup-java@v3 +# with: +# distribution: zulu +# java-version: 8 +# - run: java -version +# - run: .kokoro/build.sh +# env: +# JOB_TYPE: clirr \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..b8507e862423 --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +# Packages +dist +bin +var +sdist +target + +# Unit test / coverage reports +.coverage +.tox +nosetests.xml + +# Translations +*.mo + +.metadata +.project +.pydevproject +*.iml +.idea +.settings +.DS_Store +.classpath + +# Built documentation +docs/ + +# API key file containing value of GOOGLE_API_KEY for integration tests +api_key + +# Python utilities +*.pyc diff --git a/.kokoro/build.bat b/.kokoro/build.bat new file mode 100644 index 000000000000..067cf4a4c489 --- /dev/null +++ b/.kokoro/build.bat @@ -0,0 +1,18 @@ +:: Copyright 2022 Google LLC +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. +:: Github action job to test core java library features on +:: downstream client libraries before they are released. +:: See documentation in type-shell-output.bat + +"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh new file mode 100755 index 000000000000..9a619b87ffcd --- /dev/null +++ b/.kokoro/build.sh @@ -0,0 +1,256 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Use GCP Maven Mirror +mkdir -p ${HOME}/.m2 +cp settings.xml ${HOME}/.m2 + +function assign_modules_to_job() { + modules=$(mvn help:evaluate -Dexpression=project.modules | grep '<.*>.*' | sed -e 's/<.*>\(.*\)<\/.*>/\1/g') + module_list=() + num=0 + for module in $modules + do + # Add 1 as JOB_NUMBER is 1-indexed instead of 0-indexed + mod_num=$((num % NUM_JOBS + 1)) + if [[ ! "${excluded_modules[*]}" =~ $module ]] && [[ $mod_num -eq $JOB_NUMBER ]]; then + module_list+=($module) + fi + num=$((num + 1)) + done + module_list=$(IFS=, ; echo "${module_list[*]}") +} + +excluded_modules=('CoverageAggregator' 'google-cloud-gapic-bom') + +mvn -B -pl "!google-cloud-gapic-bom,!CoverageAggregator" \ + -ntp \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dcheckstyle.skip=true \ + -Dflatten.skip=true \ + -Danimal.sniffer.skip=true \ + -DskipTests=true \ + -Djacoco.skip=true \ + -T 1C \ + install + +# if GOOGLE_APPLICATION_CREDENTIALS is specified as a relative path, prepend Kokoro root directory onto it +if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then + export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) +fi + +if [ -f "${KOKORO_GFILE_DIR}/secret_manager/java-bigqueryconnection-samples-secrets" ]; then + source "${KOKORO_GFILE_DIR}/secret_manager/java-bigqueryconnection-samples-secrets" +fi + +RETURN_CODE=0 + +case ${JOB_TYPE} in + test) + mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true + RETURN_CODE=$? + ;; + lint) + mvn com.coveo:fmt-maven-plugin:check -B -ntp + RETURN_CODE=$? + ;; + javadoc) + mvn javadoc:javadoc javadoc:test-javadoc -B -ntp + RETURN_CODE=$? + ;; + integration) + TEST_ALL=false + # Find the files changed from when the PR branched to the last commit + # Filter for java modules and get all the unique elements + # grep returns 1 (error code) and exits the pipeline if there is no match + # If there is no match, it will return true so the rest of the commands can run + modified_files=$(git diff --name-only $KOKORO_GITHUB_PULL_REQUEST_COMMIT $KOKORO_GITHUB_PULL_REQUEST_TARGET_BRANCH) + printf "Modified files:\n%s\n" "${modified_files}" + + # If root pom.xml is touched, run ITs on all the modules + root_pom_modified=$(echo "${modified_files}" | grep -e '^pom.xml$' || true) + if [[ -n $root_pom_modified ]]; then + TEST_ALL=true + echo "Testing the entire monorepo" + else + directories=$(echo "${modified_files}" | grep -e 'java-.*' || true) + printf "Files in java modules:\n%s\n" "${directories}" + if [[ -n $directories ]]; then + directories=$(echo "${directories}" | cut -d '/' -f1 | sort -u) + dir_list=() + for directory in $directories + do + dir_list+=($directory) + done + # Combine each entry with a comma + module_list=$(IFS=, ; echo "${dir_list[*]}") + fi + printf "Module List:\n%s\n" "${module_list}" + fi + + if [ ${TEST_ALL} ]; then + mvn -B ${INTEGRATION_TEST_ARGS} \ + -ntp \ + -Penable-integration-tests \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dcheckstyle.skip=true \ + -Dflatten.skip=true \ + -Danimal.sniffer.skip=true \ + -Djacoco.skip=true \ + -DskipUnitTests=true \ + -fae \ + -T 1C \ + verify + RETURN_CODE=$? + elif [[ -n $module_list ]]; then + printf "Running Integration Tests for:\n%s\n" "${module_list}" + mvn -B ${INTEGRATION_TEST_ARGS} \ + -pl "${module_list}" \ + -amd \ + -ntp \ + -Penable-integration-tests \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dcheckstyle.skip=true \ + -Dflatten.skip=true \ + -Danimal.sniffer.skip=true \ + -Djacoco.skip=true \ + -DskipUnitTests=true \ + -fae \ + -T 1C \ + verify + RETURN_CODE=$? + printf "Finished Integration Tests for:\n%s\n" "${module_list}" + else + echo "No Integration Tests to run" + fi + ;; + graalvm) + assign_modules_to_job + printf "Running GraalVM Native ITs on:\n%s\n" "${module_list[*]}" + + # Run Unit and Integration Tests with Native Image + if [[ -n $module_list ]]; then + mvn -B ${INTEGRATION_TEST_ARGS} \ + -pl "${module_list}" \ + -amd \ + -ntp \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dcheckstyle.skip=true \ + -Dflatten.skip=true \ + -Danimal.sniffer.skip=true \ + -Penable-integration-tests \ + -Pnative \ + -fae \ + verify + RETURN_CODE=$? + printf "Finished Unit and Integration Tests for GraalVM Native:\n%s\n" "${module_list}" + else + echo "No Unit and Integration Tests to run for GraalVM Native" + fi + ;; + graalvm17) + assign_modules_to_job + printf "Running GraalVM Native-17 ITs on:\n%s\n" "${module_list[*]}" + + # Run Unit and Integration Tests with Native Image + if [[ -n $module_list ]]; then + mvn -B ${INTEGRATION_TEST_ARGS} \ + -pl "${module_list}" \ + -amd \ + -ntp \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dcheckstyle.skip=true \ + -Dflatten.skip=true \ + -Danimal.sniffer.skip=true \ + -Penable-integration-tests \ + -Pnative \ + -fae \ + verify + RETURN_CODE=$? + printf "Finished Unit and Integration Tests for GraalVM Native 17:\n%s\n" "${module_list}" + else + echo "No Unit and Integration Tests to run for GraalVM Native 17" + fi + ;; + samples) + SAMPLES_DIR=samples + # only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. + if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]] + then + SAMPLES_DIR=samples/snapshot + fi + + if [[ -f ${SAMPLES_DIR}/pom.xml ]] + then + for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do + [[ -f "$FILE" ]] || continue + source "$FILE" + done + + pushd ${SAMPLES_DIR} + mvn -B \ + -ntp \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -fae \ + verify + RETURN_CODE=$? + popd + else + echo "no sample pom.xml found - skipping sample tests" + fi + ;; + clirr) + mvn -B -ntp -Denforcer.skip=true clirr:check + RETURN_CODE=$? + ;; + *) + ;; +esac + +if [ "${REPORT_COVERAGE}" == "true" ]; then + bash ${KOKORO_GFILE_DIR}/codecov.sh +fi + +# fix output location of logs +bash .kokoro/coerce_logs.sh + +if [[ "${ENABLE_FLAKYBOT}" == "true" ]]; then + chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot + ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/google-cloud-java +fi + +echo "exiting with ${RETURN_CODE}" +exit ${RETURN_CODE} diff --git a/.kokoro/coerce_logs.sh b/.kokoro/coerce_logs.sh new file mode 100755 index 000000000000..46edbf7f2fcd --- /dev/null +++ b/.kokoro/coerce_logs.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script finds and moves sponge logs so that they can be found by placer +# and are not flagged as flaky by sponge. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +job=$(basename ${KOKORO_JOB_NAME}) + +echo "coercing sponge logs..." +for xml in `find . -name *-sponge_log.xml` +do + class=$(basename ${xml} | cut -d- -f2) + dir=$(dirname ${xml})/${job}/${class} + text=$(dirname ${xml})/${class}-sponge_log.txt + mkdir -p ${dir} + mv ${xml} ${dir}/sponge_log.xml + mv ${text} ${dir}/sponge_log.txt +done diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg new file mode 100644 index 000000000000..5732314bd50e --- /dev/null +++ b/.kokoro/common.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# All builds use the trampoline script to run in docker. +build_file: "google-cloud-java/.kokoro/trampoline.sh" + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-cloud-java/.kokoro/build.sh" +} diff --git a/.kokoro/common.sh b/.kokoro/common.sh new file mode 100644 index 000000000000..ace89f45a9de --- /dev/null +++ b/.kokoro/common.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +function retry_with_backoff { + attempts_left=$1 + sleep_seconds=$2 + shift 2 + command=$@ + + + # store current flag state + flags=$- + + # allow a failures to continue + set +e + ${command} + exit_code=$? + + # restore "e" flag + if [[ ${flags} =~ e ]] + then set -e + else set +e + fi + + if [[ $exit_code == 0 ]] + then + return 0 + fi + + # failure + if [[ ${attempts_left} > 0 ]] + then + echo "failure (${exit_code}), sleeping ${sleep_seconds}..." + sleep ${sleep_seconds} + new_attempts=$((${attempts_left} - 1)) + new_sleep=$((${sleep_seconds} * 2)) + retry_with_backoff ${new_attempts} ${new_sleep} ${command} + fi + + return $exit_code +} + +## Helper functionss +function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } +function msg() { println "$*" >&2; } +function println() { printf '%s\n' "$(now) $*"; } \ No newline at end of file diff --git a/.kokoro/create_commits_from_googleapis_commits.sh b/.kokoro/create_commits_from_googleapis_commits.sh new file mode 100755 index 000000000000..142effbf1e01 --- /dev/null +++ b/.kokoro/create_commits_from_googleapis_commits.sh @@ -0,0 +1,138 @@ +#!/bin/bash + +# This script takes 2 commit hash of googleapis/googleapis repository. +# The 1st commit is the last commit that has already been applied +# to google-cloud-java monorepo. +# The 2nd commit is the commit you want to apply to google-cloud-java +# monorepo (usually "origin/master"). +# This script creates Git commits to this google-cloud-java monorepo that +# correspond to the googleapis commits in between the two commits. + +# The following environment variables are needed (values below are examples): +# export GOOGLE_CLOUD_JAVA_DIR=$HOME/google-cloud-java-subject +# export GOOGLEAPIS_DIR=$HOME/googleapis +# export GOOGLEAPIS_COMMIT_FILE=googleapis_commit.txt + +set -ef + +start_commit=$1 +end_commit=$2 + +if [ -z "$end_commit" ]; then + echo "Please provide 2 commit hashes" + exit 1 +fi + +if [ -z "$GOOGLEAPIS_DIR" ]; then + export GOOGLEAPIS_DIR=$HOME/googleapis +fi + +if [ -z "$GOOGLE_CLOUD_JAVA_DIR" ]; then + echo 'Please specify GOOGLE_CLOUD_JAVA_DIR environment variable' + echo "When developing this script, it's a good practice to clone" + echo "github.com/googleapis/google-cloud-java" + echo "as 'google-cloud-java-subject' and specify it as:" + # shellcheck disable=SC2016 + echo 'export GOOGLE_CLOUD_JAVA_DIR=$HOME/google-cloud-java-subject' + exit 1 +fi + +if [ ! -d "$GOOGLE_CLOUD_JAVA_DIR" ]; then + echo "$GOOGLE_CLOUD_JAVA_DIR is not a directory" + exit 1 +fi + +if [ -z "${GOOGLEAPIS_COMMIT_FILE}" ]; then + echo "GOOGLEAPIS_COMMIT_FILE is not set" + exit 1 +fi + +echo "Operating in ${GOOGLE_CLOUD_JAVA_DIR}" + +cd "$GOOGLE_CLOUD_JAVA_DIR" + +OWLBOT_VERSION=latest + +if [ ! -d "$GOOGLEAPIS_DIR" ]; then + echo "GOOGLEAPIS_DIR: $GOOGLEAPIS_DIR does not exist" + exit 1 +fi + +pushd "$GOOGLEAPIS_DIR" + +git checkout master +git pull + +commit_range="${start_commit}..${end_commit}" + +googleapis_commits=$(git log --format=%H "$commit_range" |tac) + +if [ -z "${googleapis_commits}" ]; then + echo "Ensure the commit exists in ${GOOGLEAPIS_DIR}" + exit 1 +fi + +commit_message_dir=$(mktemp -d -t commit-messages-XXXXX) +for googleapis_commit in ${googleapis_commits}; do + echo "$(date): writing commit log: ${googleapis_commit}" + commit_message_file="${commit_message_dir}/${googleapis_commit}.message.txt" + git log -1 --format=%B "${googleapis_commit}" > "${commit_message_file}" + echo >> "$commit_message_file" + echo "Source-Link: https://github.com/googleapis/googleapis/commit/${googleapis_commit}" >> $commit_message_file + echo "$(date): wrote ${commit_message_file}" +done + +popd + +module_list=$(ls |grep java-) +total=$(echo "${module_list}" | wc -l) + +function generate_gapic_libraries() { + local googleapis_commit=$1 + pushd "$GOOGLEAPIS_DIR" + git checkout "$googleapis_commit" + + # This may take few minutes + bazel query $BAZEL_FLAGS 'filter("-java$", kind("rule", //...:*))' | xargs bazel build + + popd + + index=1 + for module in ${module_list}; do + echo + echo "$(date): Processing $module (${index}/${total})" + echo + + # Copy files from bazel-bin and saves to staging directory + docker run --rm --user "$(id -u):$(id -g)" \ + -v "$(pwd):/repo" \ + -v "${GOOGLEAPIS_DIR}/bazel-bin:/bazel-bin" \ + gcr.io/cloud-devrel-public-resources/owlbot-cli:${OWLBOT_VERSION} copy-bazel-bin \ + --config-file=.github/.OwlBot.yaml \ + --source-dir /bazel-bin --dest "/repo/${module}" + + # Extracts files from staging directory and post-process + # the files via OwlBot. This includes templating, formatting, etc. + docker run --rm --user "$(id -u):$(id -g)" \ + -v "$(pwd)/${module}:/workspace" -w /workspace \ + gcr.io/cloud-devrel-public-resources/owlbot-java + + index=$((index+1)) + done +} + +commit_count=0 +# The list is sorted: the oldest comes first +for googleapis_commit in ${googleapis_commits}; do + echo "$(date): Generating GAPIC Java libraries (${commit_count}): $googleapis_commit" + generate_gapic_libraries "$googleapis_commit" + commit_message_file="${commit_message_dir}/${googleapis_commit}.message.txt" + + # Record the last commit this script run with + echo -n "${googleapis_commit}" > "${GOOGLEAPIS_COMMIT_FILE}" + git add --all + git commit --file="${commit_message_file}" --allow-empty + commit_count=$((commit_count + 1)) +done + +echo "$(date): Successfully added ${commit_count} commits from googleapis (${GOOGLEAPIS_DIR}) to ${GOOGLE_CLOUD_JAVA_DIR}" diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh new file mode 100755 index 000000000000..d7476cfe9727 --- /dev/null +++ b/.kokoro/dependencies.sh @@ -0,0 +1,110 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail +shopt -s nullglob + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Java +java -version +echo $JOB_TYPE + +function determineMavenOpts() { + local javaVersion=$( + # filter down to the version line, then pull out the version between quotes, + # then trim the version number down to its minimal number (removing any + # update or suffix number). + java -version 2>&1 | grep "version" \ + | sed -E 's/^.*"(.*?)".*$/\1/g' \ + | sed -E 's/^(1\.[0-9]\.0).*$/\1/g' + ) + + if [[ $javaVersion == 17* ]] + then + # MaxPermSize is no longer supported as of jdk 17 + echo -n "-Xmx1024m" + else + echo -n "-Xmx1024m -XX:MaxPermSize=128m" + fi +} + +export MAVEN_OPTS=$(determineMavenOpts) + +# this should run maven enforcer +retry_with_backoff 3 10 \ + mvn install -B -V -ntp \ + -DskipTests=true \ + -Dmaven.javadoc.skip=true \ + -Dclirr.skip=true + +mvn -B dependency:analyze -DfailOnWarning=true + +echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************" +## Run dependency list completeness check +function completenessCheck() { + # Output dep list with compile scope generated using the original pom + # Running mvn dependency:list on Java versions that support modules will also include the module of the dependency. + # This is stripped from the output as it is not present in the flattened pom. + # Only dependencies with 'compile' or 'runtime' scope are included from original dependency list. + msg "Generating dependency list using original pom..." + mvn dependency:list -f pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | sed -e 's/ --.*//' >.org-list.txt + + # Output dep list generated using the flattened pom (only 'compile' and 'runtime' scopes) + msg "Generating dependency list using flattened pom..." + mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt + + # Compare two dependency lists + msg "Comparing dependency lists..." + diff .org-list.txt .new-list.txt >.diff.txt + if [[ $? == 0 ]] + then + msg "Success. No diff!" + else + msg "Diff found. See below: " + msg "You can also check .diff.txt file located in $1." + cat .diff.txt + return 1 + fi +} + +# Allow failures to continue running the script +set +e + +error_count=0 +for path in **/.flattened-pom.xml +do + # Check flattened pom in each dir that contains it for completeness + dir=$(dirname "$path") + pushd "$dir" + completenessCheck "$dir" + error_count=$(($error_count + $?)) + popd +done + +if [[ $error_count == 0 ]] +then + msg "All checks passed." + exit 0 +else + msg "Errors found. See log statements above." + exit 1 +fi diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh new file mode 100755 index 000000000000..0fa3af706c14 --- /dev/null +++ b/.kokoro/populate-secrets.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright 2020 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} +function msg { println "$*" >&2 ;} +function println { printf '%s\n' "$(now) $*" ;} + + +# Populates requested secrets set in SECRET_MANAGER_KEYS from service account: +# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com +SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" +msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" +mkdir -p ${SECRET_LOCATION} +for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") +do + msg "Retrieving secret ${key}" + docker run --entrypoint=gcloud \ + --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ + gcr.io/google.com/cloudsdktool/cloud-sdk \ + secrets versions access latest \ + --project cloud-devrel-kokoro-resources \ + --secret ${key} > \ + "${SECRET_LOCATION}/${key}" + if [[ $? == 0 ]]; then + msg "Secret written to ${SECRET_LOCATION}/${key}" + else + msg "Error retrieving secret ${key}" + fi +done \ No newline at end of file diff --git a/.kokoro/presubmit/common.cfg b/.kokoro/presubmit/common.cfg new file mode 100644 index 000000000000..589e42ec258a --- /dev/null +++ b/.kokoro/presubmit/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "google-cloud-java/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-cloud-java/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "dpebot_codecov_token" + } + } +} diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg new file mode 100644 index 000000000000..b6a45882dc6e --- /dev/null +++ b/.kokoro/presubmit/graalvm-native-17.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/graalvm17" +} + +env_vars: { + key: "JOB_TYPE" + value: "graalvm17" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account, java-bigqueryconnection-samples-secrets" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg new file mode 100644 index 000000000000..40cfa131b7b1 --- /dev/null +++ b/.kokoro/presubmit/graalvm-native.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/graalvm" +} + +env_vars: { + key: "JOB_TYPE" + value: "graalvm" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account, java-bigqueryconnection-samples-secrets" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/common.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/common.cfg new file mode 100644 index 000000000000..d7a8dee258fb --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/common.cfg @@ -0,0 +1,68 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build configs are duplicated in native/ and native-17/ +# Build configs don't inherit the hierarchical common.cfg: qaqs/6158654898243108864 + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "google-cloud-java/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-cloud-java/.kokoro/build.sh" +} + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/graalvm17" +} + +env_vars: { + key: "JOB_TYPE" + value: "graalvm17" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account, java-bigqueryconnection-samples-secrets" +} + +env_vars: { + key: "NUM_JOBS" + value: "20" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "dpebot_codecov_token" + } + } +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-1.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-1.cfg new file mode 100644 index 000000000000..86ef6b19fe42 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-1.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "1" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-10.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-10.cfg new file mode 100644 index 000000000000..fed303d81e02 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-10.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "10" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-11.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-11.cfg new file mode 100644 index 000000000000..ac400eba729d --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-11.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "11" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-12.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-12.cfg new file mode 100644 index 000000000000..1956e10a026d --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-12.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "12" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-13.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-13.cfg new file mode 100644 index 000000000000..17a92327cc0b --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-13.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "13" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-14.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-14.cfg new file mode 100644 index 000000000000..9140ce7935dd --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-14.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "14" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-15.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-15.cfg new file mode 100644 index 000000000000..883b01f5cf20 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-15.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "15" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-16.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-16.cfg new file mode 100644 index 000000000000..49d1944d2198 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-16.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "16" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-17.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-17.cfg new file mode 100644 index 000000000000..d3dd6d20cfdf --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-17.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "17" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-18.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-18.cfg new file mode 100644 index 000000000000..feab164947d7 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-18.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "18" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-19.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-19.cfg new file mode 100644 index 000000000000..18338bf215a8 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-19.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "19" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-2.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-2.cfg new file mode 100644 index 000000000000..72d5a67b04b8 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-2.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "2" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-20.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-20.cfg new file mode 100644 index 000000000000..336a5ae36843 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-20.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "20" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-3.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-3.cfg new file mode 100644 index 000000000000..3966c5173681 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-3.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "3" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-4.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-4.cfg new file mode 100644 index 000000000000..4dd289835571 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-4.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "4" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-5.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-5.cfg new file mode 100644 index 000000000000..938765b37ff8 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-5.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "5" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-6.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-6.cfg new file mode 100644 index 000000000000..b55694fff4f6 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-6.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "6" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-7.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-7.cfg new file mode 100644 index 000000000000..b06f423d7d1d --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-7.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "7" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-8.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-8.cfg new file mode 100644 index 000000000000..cc278825f04d --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-8.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "8" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-9.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-9.cfg new file mode 100644 index 000000000000..e71a9d051d20 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native-17/graalvm-native-17-9.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "9" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/common.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/common.cfg new file mode 100644 index 000000000000..b379e72fd93c --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/common.cfg @@ -0,0 +1,68 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build configs are duplicated in native/ and native-17/ +# Build configs don't inherit the hierarchical common.cfg: qaqs/6158654898243108864 + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "google-cloud-java/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-cloud-java/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "graalvm" +} + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/graalvm" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account, java-bigqueryconnection-samples-secrets" +} + +env_vars: { + key: "NUM_JOBS" + value: "20" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "dpebot_codecov_token" + } + } +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-1.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-1.cfg new file mode 100644 index 000000000000..86ef6b19fe42 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-1.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "1" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-10.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-10.cfg new file mode 100644 index 000000000000..fed303d81e02 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-10.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "10" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-11.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-11.cfg new file mode 100644 index 000000000000..ac400eba729d --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-11.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "11" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-12.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-12.cfg new file mode 100644 index 000000000000..1956e10a026d --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-12.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "12" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-13.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-13.cfg new file mode 100644 index 000000000000..17a92327cc0b --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-13.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "13" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-14.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-14.cfg new file mode 100644 index 000000000000..9140ce7935dd --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-14.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "14" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-15.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-15.cfg new file mode 100644 index 000000000000..883b01f5cf20 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-15.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "15" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-16.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-16.cfg new file mode 100644 index 000000000000..49d1944d2198 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-16.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "16" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-17.cfg new file mode 100644 index 000000000000..d3dd6d20cfdf --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-17.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "17" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-18.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-18.cfg new file mode 100644 index 000000000000..feab164947d7 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-18.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "18" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-19.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-19.cfg new file mode 100644 index 000000000000..18338bf215a8 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-19.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "19" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-2.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-2.cfg new file mode 100644 index 000000000000..72d5a67b04b8 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-2.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "2" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-20.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-20.cfg new file mode 100644 index 000000000000..336a5ae36843 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-20.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "20" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-3.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-3.cfg new file mode 100644 index 000000000000..3966c5173681 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-3.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "3" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-4.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-4.cfg new file mode 100644 index 000000000000..4dd289835571 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-4.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "4" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-5.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-5.cfg new file mode 100644 index 000000000000..938765b37ff8 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-5.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "5" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-6.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-6.cfg new file mode 100644 index 000000000000..b55694fff4f6 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-6.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "6" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-7.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-7.cfg new file mode 100644 index 000000000000..b06f423d7d1d --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-7.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "7" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-8.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-8.cfg new file mode 100644 index 000000000000..cc278825f04d --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-8.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "8" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-9.cfg b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-9.cfg new file mode 100644 index 000000000000..e71a9d051d20 --- /dev/null +++ b/.kokoro/presubmit/graalvm-sub-jobs/native/graalvm-native-9.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "JOB_NUMBER" + value: "9" +} \ No newline at end of file diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg new file mode 100644 index 000000000000..f2ec5b907420 --- /dev/null +++ b/.kokoro/presubmit/integration.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account, java-bigqueryconnection-samples-secrets" +} \ No newline at end of file diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg new file mode 100644 index 000000000000..144e65070f55 --- /dev/null +++ b/.kokoro/release/common.cfg @@ -0,0 +1,49 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "google-cloud-java/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-keyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-passphrase" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-pubkeyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "sonatype-credentials" + } + } +} diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh new file mode 100755 index 000000000000..7f78ee414faf --- /dev/null +++ b/.kokoro/release/common.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +# Get secrets from keystore and set and environment variables +setup_environment_secrets() { + export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) + export GPG_TTY=$(tty) + export GPG_HOMEDIR=/gpg + mkdir $GPG_HOMEDIR + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg + export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') + export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') +} + +create_settings_xml_file() { + echo " + + + ossrh + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-staging + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-snapshots + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + +" > $1 +} \ No newline at end of file diff --git a/.kokoro/release/publish_javadoc11.cfg b/.kokoro/release/publish_javadoc11.cfg new file mode 100644 index 000000000000..bfeb2b05c7bd --- /dev/null +++ b/.kokoro/release/publish_javadoc11.cfg @@ -0,0 +1,31 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# cloud-rad production +# TODO: Change this to production bucket: docs-staging-v2 +env_vars: { + key: "STAGING_BUCKET_V2" + value: "docs-staging-v2-dev" +} + +# Configure the docker image for kokoro-trampoline +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-cloud-java/.kokoro/release/publish_javadoc11.sh" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} + +# Downloads docfx doclet resource. This will be in ${KOKORO_GFILE_DIR}/ +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/docfx" diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh new file mode 100755 index 000000000000..fbf205f43cbc --- /dev/null +++ b/.kokoro/release/publish_javadoc11.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +if [[ -z "${CREDENTIALS}" ]]; then + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account +fi + +if [[ -z "${STAGING_BUCKET_V2}" ]]; then + echo "Need to set STAGING_BUCKET_V2 environment variable" + exit 1 +fi + +# work from the git root directory +pushd $(dirname "$0")/../../ + +# install docuploader package +python3 -m pip install gcp-docuploader + +apt-get update +# install jq to extract field from json file +apt-get install -y jq + +doclet_name="java-docfx-doclet-1.7.0.jar" + +# compile all packages +#mvn clean install -B -q -DskipTests -Dcheckstyle.skip -Denforcer.skip=true -T 1C + +# Retrieve list of modules from aggregator pom +modules=$(mvn help:evaluate -Dexpression=project.modules | grep '<.*>.*' | sed -e 's/<.*>\(.*\)<\/.*>/\1/g') +excluded_modules=('CoverageAggregator' 'google-cloud-gapic-bom') + +for module in $modules +do + # Proceed if module is not excluded + if [[ ! "${excluded_modules[*]}" =~ $module ]]; then + pushd $module + # Extract Cloud RAD module name + NAME=$(jq -r '.distribution_name' .repo-metadata.json | cut -d ':' -f 2) + # Extract (current) version from versions.txt and remove `-SNAPSHOT` + VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3 | sed -e 's/-SNAPSHOT//g') + echo "Running for ${NAME}-${VERSION}" + + # cloud RAD generation + mvn clean javadoc:aggregate -B -P docFX -DdocletPath=${KOKORO_GFILE_DIR}/${doclet_name} + # include CHANGELOG + cp CHANGELOG.md target/docfx-yml/history.md + + pushd target/docfx-yml + + # create metadata + python3 -m docuploader create-metadata \ + --name ${NAME} \ + --version ${VERSION} \ + --xrefs devsite://java/gax \ + --xrefs devsite://java/google-cloud-core \ + --xrefs devsite://java/api-common \ + --xrefs devsite://java/proto-google-common-protos \ + --xrefs devsite://java/google-api-client \ + --xrefs devsite://java/google-http-client \ + --xrefs devsite://java/protobuf \ + --language java + + # upload yml to production bucket + python3 -m docuploader upload . \ + --credentials ${CREDENTIALS} \ + --staging-bucket ${STAGING_BUCKET_V2} \ + --destination-prefix docfx + + popd # out of target/docfx-yml + popd # out of $module + fi +done diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg new file mode 100644 index 000000000000..f631cc7c00c6 --- /dev/null +++ b/.kokoro/release/stage.cfg @@ -0,0 +1,19 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/google-cloud-java/.kokoro/release/stage.sh" +} + +# Need to save the properties file +action { + define_artifacts { + regex: "github/google-cloud-java/target/nexus-staging/staging/*.properties" + strip_prefix: "github/google-cloud-java" + } +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" +} \ No newline at end of file diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh new file mode 100644 index 000000000000..35ceb8f51359 --- /dev/null +++ b/.kokoro/release/stage.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +# Start the releasetool reporter +python3 -m pip install gcp-releasetool +python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script + +source $(dirname "$0")/common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn clean deploy -B \ + -DskipTests=true \ + --settings ${MAVEN_SETTINGS_FILE} \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} \ + -P release + +# During shadow-mode, do not release. +#if [[ -n "${AUTORELEASE_PR}" ]] +#then +# mvn nexus-staging:release -B \ +# -DperformRelease=true \ +# --settings=settings.xml +#fi + diff --git a/.kokoro/sync_with_googleapis.sh b/.kokoro/sync_with_googleapis.sh new file mode 100755 index 000000000000..f0a9df90adac --- /dev/null +++ b/.kokoro/sync_with_googleapis.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# This script reads the last googleapis (https://github.com/googleapis/googleapis) +# commit applied to the google-cloud-java repository. It then applies new GAPIC +# library changes to the repository between the commit and the latest master of +# the googleapis repository. (This script uses +# create_commits_from_googleapis_commits.sh to generate the Git commits). +# The caller of this script then can create a pull request to apply the changes +# to google-cloud-java repository. +# The location of google-cloud-java repository is specified by +# GOOGLE_CLOUD_JAVA_DIR environment variable. + +set -ef + +BASEDIR=$(dirname "$0") + +if [ -z "${WORKSPACE}" ]; then + export WORKSPACE=$(mktemp -d -t workspace-XXXXX) +fi + +if [ -z "${GOOGLE_CLOUD_JAVA_DIR}" ]; then + echo "GOOGLE_CLOUD_JAVA_DIR is not set" + exit 1 +fi + +export GOOGLEAPIS_DIR="${WORKSPACE}/googleapis" + +# TODO: It may be better to read the last googleapis's commit from the Git +# commit messages. +export GOOGLEAPIS_COMMIT_FILE=googleapis_commit.txt + +pushd "$WORKSPACE" + +BAZEL_VERSION=5.2.0 +BAZEL_DOWNLOAD_URL="https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-x86_64" +curl "${BAZEL_DOWNLOAD_URL}" --output bazel +chmod 755 bazel +export PATH=$WORKSPACE:$PATH +echo "$(date): Downloaded bazel: $(which bazel)" +bazel version + +git clone --quiet --branch master https://github.com/googleapis/googleapis + +pushd "${GOOGLE_CLOUD_JAVA_DIR}" +start_commit=$(cat "${GOOGLEAPIS_COMMIT_FILE}") + +if [ -z "${start_commit}" ]; then + echo "Couldn't read start_commit from ${GOOGLEAPIS_COMMIT_FILE}" + exit 1 +else + echo "$(date): start_commit: ${start_commit}" +fi + +echo "$(date): Creating commits based on googleapis's ${start_commit} to origin/master" + +"${BASEDIR}/create_commits_from_googleapis_commits.sh" "${start_commit}" origin/master + +echo "$(date): Finished creating commits in ${GOOGLE_CLOUD_JAVA_DIR}" diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh new file mode 100644 index 000000000000..8b69b793c9ec --- /dev/null +++ b/.kokoro/trampoline.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +set -eo pipefail +# Always run the cleanup script, regardless of the success of bouncing into +# the container. +function cleanup() { + chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + echo "cleanup"; +} +trap cleanup EXIT + +$(dirname $0)/populate-secrets.sh # Secret Manager secrets. +python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000000..46b2a08ea6d1 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,43 @@ +# Contributor Code of Conduct + +As contributors and maintainers of this project, +and in the interest of fostering an open and welcoming community, +we pledge to respect all people who contribute through reporting issues, +posting feature requests, updating documentation, +submitting pull requests or patches, and other activities. + +We are committed to making participation in this project +a harassment-free experience for everyone, +regardless of level of experience, gender, gender identity and expression, +sexual orientation, disability, personal appearance, +body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, +such as physical or electronic +addresses, without explicit permission +* Other unethical or unprofessional conduct. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct. +By adopting this Code of Conduct, +project maintainers commit themselves to fairly and consistently +applying these principles to every aspect of managing this project. +Project maintainers who do not follow or enforce the Code of Conduct +may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior +may be reported by opening an issue +or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000000..46e03b65db5b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,87 @@ +Contributing +============ + +1. **Please sign one of the contributor license agreements below.** +2. Fork the repo, develop and test your code changes, add docs. +3. Make sure that your commit messages clearly describe the changes. +4. Send a pull request. + + +Here are some guidelines for hacking on google-cloud-java. + + +Using maven for build/test +-------------------------- + +To run the tests, you must have application default credentials in a JSON file on your development machine. +[Generate a JSON service account key](https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts) +in the cloud console and download they key to a secure location on your development box. +Then set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the location of the JSON file. +For example: + + ```bash + export GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/key.json + ``` + +After you clone the repository, use Maven for building and running the tests. + +Integration tests run tests against real services and take a long time to run. +Consider `mvn install -DskipITs` to skip them when installing. +Maven 3.0+ is required. + +It's also important to test that changes don't break compatibility with App/Compute Engine and when running elsewhere. +To run tests on different platforms, try deploying the apps available on the [google-cloud-examples](https://github.com/googleapis/google-cloud-examples) repository. +End-to-end tests should ensure that google-cloud-java works when running on the + +* App Engine production environment (see the docs for [uploading your app to production App Engine](https://cloud.google.com/appengine/docs/java/tools/maven#uploading_your_app_to_production_app_engine)) +* App Engine development server (see the docs for [testing your app with the development server](https://cloud.google.com/appengine/docs/java/tools/maven#testing_your_app_with_the_development_server)) +* Compute Engine (see the [Getting Started Guide](https://cloud.google.com/compute/docs/quickstart), and be sure to [enable the appropriate APIs](https://github.com/googleapis/google-cloud-common/tree/master/authentication#on-google-compute-engine)) +* Your desktop (using `mvn exec:java`, for example) + +When changes are made to authentication and project ID-related code, authentication and project ID inference should be tested using all relevant methods detailed in the [authentication docs](https://github.com/googleapis/google-cloud-java#authentication) and [project ID docs](https://github.com/googleapis/google-cloud-java#specifying-a-project-id). + +Known issue: If you have installed the Google Cloud SDK, be sure to log in (using `gcloud auth login`) before running tests. Though the Datastore tests use a local Datastore emulator that doesn't require authentication, they will not run if you have the Google Cloud SDK installed but aren't authenticated. + +**Please, do not use your production projects for executing integration tests.** While we do our best to make our tests independent of your project's state and content, they do perform create, modify and deletes, and you do not want to have your production data accidentally modified. + +Adding Features +--------------- +In order to add a feature to google-cloud-java: + +The feature must be fully documented using Javadoc and examples should be provided. +The feature must work fully on Java 7 and above. +The feature must not add unnecessary dependencies (where "unnecessary" is of course subjective, +but new dependencies should be discussed). + +Adding Support for a New Service +-------------------------------- +See [SUPPORTING_NEW_SERVICES](./SUPPORTING_NEW_SERVICES.md) for guidelines on how to add support for a new Google Cloud service to `google-cloud-java`. + +Coding Style +------------ +Maintain the coding style in the project and in particular the modified files. +Follow the Google Java [style](https://google.github.io/styleguide/javaguide.html). + +In pull requests, please run `mvn com.coveo:fmt-maven-plugin:format` to format your code diff. + +## Contributor License Agreements + +Before we can accept your pull requests you'll need to sign a Contributor +License Agreement (CLA): + +- **If you are an individual writing original source code** and **you own the intellectual property**, +then you'll need to sign an [individual CLA][indvcla]. +- **If you work for a company that wants to allow you to contribute your work**, +then you'll need to sign a [corporate CLA][corpcla]. + +You can sign these electronically (just scroll to the bottom). After that, +we'll be able to accept your pull requests. + +## Code of Conduct + +Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more information. + +[gcloudcli]: https://developers.google.com/cloud/sdk/gcloud/ +[indvcla]: https://developers.google.com/open-source/cla/individual +[corpcla]: https://developers.google.com/open-source/cla/corporate +[code-of-conduct]:https://github.com/googleapis/google-cloud-java/blob/master/CODE_OF_CONDUCT.md diff --git a/README.md b/README.md new file mode 100644 index 000000000000..dddf748d5d0d --- /dev/null +++ b/README.md @@ -0,0 +1,510 @@ +# Google Cloud Java Client Libraries + +> Java idiomatic client for [Google Cloud Platform][cloud-platform] services. + +* [Java on Google Cloud][cloud-java] + +## Supported APIs + +Libraries are available on GitHub and Maven Central for developing Java applications that interact with individual Google Cloud services: + +[//]: # (API_TABLE_START) + +| Client | Release Level | Version | +| ------ | ------------- | ------- | +| [AI Platform Notebooks](https://github.com/googleapis/java-notebooks) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-notebooks.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-notebooks&core=gav) | +| [API Gateway](https://github.com/googleapis/java-api-gateway) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-api-gateway.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-api-gateway&core=gav) | +| [Access Approval](https://github.com/googleapis/java-accessapproval) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-accessapproval.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-accessapproval&core=gav) | +| [Apigee Connect](https://github.com/googleapis/java-apigee-connect) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-apigee-connect.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-apigee-connect&core=gav) | +| [App Engine Admin API](https://github.com/googleapis/java-appengine-admin) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-appengine-admin.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-appengine-admin&core=gav) | +| [Artifact Registry](https://github.com/googleapis/java-artifact-registry) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-artifact-registry.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-artifact-registry&core=gav) | +| [Asset Inventory](https://github.com/googleapis/java-asset) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-asset.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-asset&core=gav) | +| [Assured Workloads for Government](https://github.com/googleapis/java-assured-workloads) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-assured-workloads.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-assured-workloads&core=gav) | +| [Auto ML](https://github.com/googleapis/java-automl) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-automl.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-automl&core=gav) | +| [BigQuery](https://github.com/googleapis/java-bigquery) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquery.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-bigquery&core=gav) | +| [BigQuery Connection](https://github.com/googleapis/java-bigqueryconnection) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigqueryconnection.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-bigqueryconnection&core=gav) | +| [BigQuery Data Transfer Service](https://github.com/googleapis/java-bigquerydatatransfer) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquerydatatransfer.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-bigquerydatatransfer&core=gav) | +| [BigQuery Reservation](https://github.com/googleapis/java-bigqueryreservation) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigqueryreservation.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-bigqueryreservation&core=gav) | +| [BigQuery Storage](https://github.com/googleapis/java-bigquerystorage) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquerystorage.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-bigquerystorage&core=gav) | +| [Bigtable](https://github.com/googleapis/java-bigtable) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigtable.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-bigtable&core=gav) | +| [Bigtable Hbase Client](https://github.com/googleapis/java-bigtable-hbase) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud.bigtable/bigtable-client-parent.svg)](https://search.maven.org/search?q=g:com.google.cloud.bigtable%20AND%20a:bigtable-client-parent&core=gav) | +| [Billing](https://github.com/googleapis/java-billing) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-billing.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-billing&core=gav) | +| [Billing Budgets](https://github.com/googleapis/java-billingbudgets) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-billingbudgets.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-billingbudgets&core=gav) | +| [Binary Authorization](https://github.com/googleapis/java-binary-authorization) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-binary-authorization.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-binary-authorization&core=gav) | +| [Build](https://github.com/googleapis/java-cloudbuild) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-build.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-build&core=gav) | +| [CCAI Insights](https://github.com/googleapis/java-contact-center-insights) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-contact-center-insights.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-contact-center-insights&core=gav) | +| [Certificate Authority Service](https://github.com/googleapis/java-security-private-ca) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-security-private-ca.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-security-private-ca&core=gav) | +| [Channel Services](https://github.com/googleapis/java-channel) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-channel.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-channel&core=gav) | +| [Composer](https://github.com/googleapis/java-orchestration-airflow) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-orchestration-airflow.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-orchestration-airflow&core=gav) | +| [Compute Engine](https://github.com/googleapis/java-compute) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-compute.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-compute&core=gav) | +| [Container Analysis](https://github.com/googleapis/java-containeranalysis) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-containeranalysis.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-containeranalysis&core=gav) | +| [DNS](https://github.com/googleapis/java-dns) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-dns.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-dns&core=gav) | +| [Data Catalog](https://github.com/googleapis/java-datacatalog) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-datacatalog.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-datacatalog&core=gav) | +| [Data Fusion](https://github.com/googleapis/java-data-fusion) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-data-fusion.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-data-fusion&core=gav) | +| [Data Loss Prevention](https://github.com/googleapis/java-dlp) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-dlp.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-dlp&core=gav) | +| [Database Migration Service](https://github.com/googleapis/java-dms) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-dms.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-dms&core=gav) | +| [Dataplex](https://github.com/googleapis/java-dataplex) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-dataplex.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-dataplex&core=gav) | +| [Dataproc](https://github.com/googleapis/java-dataproc) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-dataproc.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-dataproc&core=gav) | +| [Dataproc Metastore](https://github.com/googleapis/java-dataproc-metastore) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-dataproc-metastore.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-dataproc-metastore&core=gav) | +| [Datastore](https://github.com/googleapis/java-datastore) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-datastore.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-datastore&core=gav) | +| [Datastream](https://github.com/googleapis/java-datastream) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-datastream.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-datastream&core=gav) | +| [Debugger](https://github.com/googleapis/java-debugger-client) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-debugger-client.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-debugger-client&core=gav) | +| [Deploy](https://github.com/googleapis/java-deploy) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-deploy.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-deploy&core=gav) | +| [Dialogflow API](https://github.com/googleapis/java-dialogflow) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-dialogflow.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-dialogflow&core=gav) | +| [Document AI](https://github.com/googleapis/java-document-ai) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-document-ai.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-document-ai&core=gav) | +| [Domains](https://github.com/googleapis/java-domains) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-domains.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-domains&core=gav) | +| [Essential Contacts API](https://github.com/googleapis/java-essential-contacts) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-essential-contacts.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-essential-contacts&core=gav) | +| [Eventarc](https://github.com/googleapis/java-eventarc) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-eventarc.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-eventarc&core=gav) | +| [Filestore API](https://github.com/googleapis/java-filestore) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-filestore.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-filestore&core=gav) | +| [Firestore](https://github.com/googleapis/java-firestore) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-firestore.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-firestore&core=gav) | +| [Fleet Routing](https://github.com/googleapis/java-optimization) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-optimization.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-optimization&core=gav) | +| [Functions](https://github.com/googleapis/java-functions) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-functions.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-functions&core=gav) | +| [GKE Hub API](https://github.com/googleapis/java-gkehub) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-gkehub.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-gkehub&core=gav) | +| [Gaming](https://github.com/googleapis/java-game-servers) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-game-servers.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-game-servers&core=gav) | +| [IAM Admin API](https://github.com/googleapis/java-iam-admin) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-iam-admin.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-iam-admin&core=gav) | +| [IAM Policy Troubleshooter API](https://github.com/googleapis/java-policy-troubleshooter) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-policy-troubleshooter.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-policy-troubleshooter&core=gav) | +| [IAM Service Account Credentials API](https://github.com/googleapis/java-iamcredentials) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-iamcredentials.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-iamcredentials&core=gav) | +| [Identity Access Context Manager](https://github.com/googleapis/java-accesscontextmanager) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-identity-accesscontextmanager.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-identity-accesscontextmanager&core=gav) | +| [Internet of Things (IoT) Core](https://github.com/googleapis/java-iot) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-iot.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-iot&core=gav) | +| [Intrusion Detection System](https://github.com/googleapis/java-ids) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-ids.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-ids&core=gav) | +| [Key Management Service](https://github.com/googleapis/java-kms) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-kms.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-kms&core=gav) | +| [Kubernetes Engine](https://github.com/googleapis/java-container) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-container.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-container&core=gav) | +| [Logging](https://github.com/googleapis/java-logging) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-logging.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-logging&core=gav) | +| [Managed Service for Microsoft Active Directory](https://github.com/googleapis/java-managed-identities) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-managed-identities.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-managed-identities&core=gav) | +| [Memcache](https://github.com/googleapis/java-memcache) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-memcache.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-memcache&core=gav) | +| [Monitoring Dashboards](https://github.com/googleapis/java-monitoring-dashboards) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-monitoring-dashboard.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-monitoring-dashboard&core=gav) | +| [Natural Language](https://github.com/googleapis/java-language) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-language.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-language&core=gav) | +| [Network Connectivity Center](https://github.com/googleapis/java-networkconnectivity) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-networkconnectivity.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-networkconnectivity&core=gav) | +| [Network Management API](https://github.com/googleapis/java-network-management) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-network-management.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-network-management&core=gav) | +| [OS Config API](https://github.com/googleapis/java-os-config) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-os-config.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-os-config&core=gav) | +| [OS Login](https://github.com/googleapis/java-os-login) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-os-login.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-os-login&core=gav) | +| [Organization Policy](https://github.com/googleapis/java-orgpolicy) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-orgpolicy.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-orgpolicy&core=gav) | +| [Profiler](https://github.com/googleapis/java-profiler) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-profiler.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-profiler&core=gav) | +| [Pub/Sub](https://github.com/googleapis/java-pubsub) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-pubsub.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-pubsub&core=gav) | +| [Pub/Sub Lite](https://github.com/googleapis/java-pubsublite) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-pubsublite.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-pubsublite&core=gav) | +| [Pub/Sub Lite Kafka Shim](https://github.com/googleapis/java-pubsublite-kafka) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/pubsublite-kafka.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:pubsublite-kafka&core=gav) | +| [Recommender](https://github.com/googleapis/java-recommender) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-recommender.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-recommender&core=gav) | +| [Redis](https://github.com/googleapis/java-redis) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-redis.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-redis&core=gav) | +| [Resource Manager API](https://github.com/googleapis/java-resourcemanager) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-resourcemanager.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-resourcemanager&core=gav) | +| [Resource Settings API](https://github.com/googleapis/java-resource-settings) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-resource-settings.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-resource-settings&core=gav) | +| [Retail](https://github.com/googleapis/java-retail) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-retail.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-retail&core=gav) | +| [Scheduler](https://github.com/googleapis/java-scheduler) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-scheduler.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-scheduler&core=gav) | +| [Secret Management](https://github.com/googleapis/java-secretmanager) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-secretmanager.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-secretmanager&core=gav) | +| [Security Command Center](https://github.com/googleapis/java-securitycenter) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-securitycenter.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-securitycenter&core=gav) | +| [Security Scanner](https://github.com/googleapis/java-websecurityscanner) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-websecurityscanner.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-websecurityscanner&core=gav) | +| [Serverless VPC Access](https://github.com/googleapis/java-vpcaccess) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-vpcaccess.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-vpcaccess&core=gav) | +| [Service Control API](https://github.com/googleapis/java-service-control) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-service-control.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-service-control&core=gav) | +| [Service Directory](https://github.com/googleapis/java-servicedirectory) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-servicedirectory.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-servicedirectory&core=gav) | +| [Service Management API](https://github.com/googleapis/java-service-management) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-service-management.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-service-management&core=gav) | +| [Service Usage](https://github.com/googleapis/java-service-usage) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-service-usage.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-service-usage&core=gav) | +| [Shell](https://github.com/googleapis/java-shell) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-shell.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-shell&core=gav) | +| [Spanner](https://github.com/googleapis/java-spanner) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-spanner.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-spanner&core=gav) | +| [Spanner JDBC](https://github.com/googleapis/java-spanner-jdbc) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-spanner-jdbc.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-spanner-jdbc&core=gav) | +| [Speech](https://github.com/googleapis/java-speech) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-speech.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-speech&core=gav) | +| [Stackdriver Monitoring](https://github.com/googleapis/java-monitoring) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-monitoring.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-monitoring&core=gav) | +| [Stackdriver Trace](https://github.com/googleapis/java-trace) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-trace.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-trace&core=gav) | +| [Storage](https://github.com/googleapis/java-storage) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-storage.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-storage&core=gav) | +| [Storage Transfer Service](https://github.com/googleapis/java-storage-transfer) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-storage-transfer.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-storage-transfer&core=gav) | +| [TPU](https://github.com/googleapis/java-tpu) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-tpu.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-tpu&core=gav) | +| [Talent Solution](https://github.com/googleapis/java-talent) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-talent.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-talent&core=gav) | +| [Tasks](https://github.com/googleapis/java-tasks) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-tasks.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-tasks&core=gav) | +| [Text-to-Speech](https://github.com/googleapis/java-texttospeech) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-texttospeech.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-texttospeech&core=gav) | +| [Translation](https://github.com/googleapis/java-translate) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-translate.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-translate&core=gav) | +| [VM Migration](https://github.com/googleapis/java-vmmigration) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-vmmigration.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-vmmigration&core=gav) | +| [Vertex AI](https://github.com/googleapis/java-aiplatform) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-aiplatform.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-aiplatform&core=gav) | +| [Video Intelligence](https://github.com/googleapis/java-video-intelligence) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-video-intelligence.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-video-intelligence&core=gav) | +| [Video Transcoder](https://github.com/googleapis/java-video-transcoder) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-video-transcoder.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-video-transcoder&core=gav) | +| [Vision](https://github.com/googleapis/java-vision) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-vision.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-vision&core=gav) | +| [Web Risk](https://github.com/googleapis/java-webrisk) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-webrisk.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-webrisk&core=gav) | +| [Workflow Executions](https://github.com/googleapis/java-workflow-executions) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-workflow-executions.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-workflow-executions&core=gav) | +| [Workflows](https://github.com/googleapis/java-workflows) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-workflows.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-workflows&core=gav) | +| [Workspace Add-ons API](https://github.com/googleapis/java-gsuite-addons) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-gsuite-addons.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-gsuite-addons&core=gav) | +| [reCAPTCHA Enterprise](https://github.com/googleapis/java-recaptchaenterprise) | [![stable][stable-stability]][stable-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-recaptchaenterprise.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-recaptchaenterprise&core=gav) | +| [Analytics Admin](https://github.com/googleapis/java-analytics-admin) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.analytics/google-analytics-admin.svg)](https://search.maven.org/search?q=g:com.google.analytics%20AND%20a:google-analytics-admin&core=gav) | +| [Analytics Data](https://github.com/googleapis/java-analytics-data) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.analytics/google-analytics-data.svg)](https://search.maven.org/search?q=g:com.google.analytics%20AND%20a:google-analytics-data&core=gav) | +| [Analytics Hub](https://github.com/googleapis/java-bigquery-data-exchange) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquery-data-exchange.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-bigquery-data-exchange&core=gav) | +| [Anthos Multicloud](https://github.com/googleapis/java-gke-multi-cloud) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-gke-multi-cloud.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-gke-multi-cloud&core=gav) | +| [Area 120 Tables](https://github.com/googleapis/java-area120-tables) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.area120/google-area120-tables.svg)](https://search.maven.org/search?q=g:com.google.area120%20AND%20a:google-area120-tables&core=gav) | +| [Backup for GKE](https://github.com/googleapis/java-gke-backup) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-gke-backup.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-gke-backup&core=gav) | +| [Bare Metal Solution](https://github.com/googleapis/java-bare-metal-solution) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bare-metal-solution.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-bare-metal-solution&core=gav) | +| [Batch](https://github.com/googleapis/java-batch) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-batch.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-batch&core=gav) | +| [BigQuery Migration](https://github.com/googleapis/java-bigquerymigration) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-bigquerymigration.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-bigquerymigration&core=gav) | +| [Certificate Manager](https://github.com/googleapis/java-certificate-manager) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-certificate-manager.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-certificate-manager&core=gav) | +| [Connect Gateway API](https://github.com/googleapis/java-gke-connect-gateway) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-gke-connect-gateway.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-gke-connect-gateway&core=gav) | +| [Data Labeling](https://github.com/googleapis/java-datalabeling) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-datalabeling.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-datalabeling&core=gav) | +| [Dataflow](https://github.com/googleapis/java-dataflow) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-dataflow.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-dataflow&core=gav) | +| [Dialogflow CX](https://github.com/googleapis/java-dialogflow-cx) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-dialogflow-cx.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-dialogflow-cx&core=gav) | +| [Error Reporting](https://github.com/googleapis/java-errorreporting) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-errorreporting.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-errorreporting&core=gav) | +| [Eventarc Publishing](https://github.com/googleapis/java-eventarc-publishing) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-eventarc-publishing.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-eventarc-publishing&core=gav) | +| [Life Sciences](https://github.com/googleapis/java-life-sciences) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-life-sciences.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-life-sciences&core=gav) | +| [Live Stream API](https://github.com/googleapis/java-video-live-stream) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-live-stream.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-live-stream&core=gav) | +| [Logging Logback Appender](https://github.com/googleapis/java-logging-logback) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-logging-logback.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-logging-logback&core=gav) | +| [Logging Servlet Initializer](https://github.com/googleapis/java-logging-servlet-initializer) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-logging-servlet-initializer.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-logging-servlet-initializer&core=gav) | +| [Media Translation API](https://github.com/googleapis/java-mediatranslation) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-mediatranslation.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-mediatranslation&core=gav) | +| [NIO Filesystem Provider for Storage](https://github.com/googleapis/java-storage-nio) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-nio.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-nio&core=gav) | +| [Network Security API](https://github.com/googleapis/java-network-security) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-network-security.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-network-security&core=gav) | +| [Phishing Protection](https://github.com/googleapis/java-phishingprotection) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-phishingprotection.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-phishingprotection&core=gav) | +| [Private Catalog](https://github.com/googleapis/java-private-catalog) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-private-catalog.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-private-catalog&core=gav) | +| [Pub/Sub Lite Flink Connector](https://github.com/googleapis/java-pubsublite-flink) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-pubsublite-flink.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-pubsublite-flink&core=gav) | +| [Pub/Sub Lite Spark Connector](https://github.com/googleapis/java-pubsublite-spark) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/pubsublite-spark-sql-streaming.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:pubsublite-spark-sql-streaming&core=gav) | +| [Recommendations AI](https://github.com/googleapis/java-recommendations-ai) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-recommendations-ai.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-recommendations-ai&core=gav) | +| [Registry API](https://github.com/googleapis/java-apigee-registry) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-apigee-registry.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-apigee-registry&core=gav) | +| [Run](https://github.com/googleapis/java-run) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-run.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-run&core=gav) | +| [Security Command Center Settings API](https://github.com/googleapis/java-securitycenter-settings) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-securitycenter-settings.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-securitycenter-settings&core=gav) | +| [Video Stitcher API](https://github.com/googleapis/java-video-stitcher) | [![preview][preview-stability]][preview-description] | [![Maven](https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-video-stitcher.svg)](https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-video-stitcher&core=gav) | + +[//]: # (API_TABLE_END) + +If the service is not listed, [google-api-java-client][google-api-java-client-services] interfaces with additional Google Cloud APIs using a legacy REST interface. + +*When building Java applications, preference should be given to the libraries listed in the table.* + + + +## Specifying a Project ID + +Most `google-cloud` libraries require a project ID. There are multiple ways to specify this project ID. + +1. When using `google-cloud` libraries from within Compute/App Engine, there's no need to specify a project ID. It is automatically inferred from the production environment. +2. When using `google-cloud` elsewhere, you can do one of the following: +* Supply the project ID when building the service options. For example, to use Datastore from a project with ID "PROJECT_ID", you can write: + + ```java + Datastore datastore = DatastoreOptions.newBuilder().setProjectId("PROJECT_ID").build().getService(); + ``` +* Specify the environment variable `GOOGLE_CLOUD_PROJECT` to be your desired project ID. +* Set the project ID using the [Google Cloud SDK](https://cloud.google.com/sdk/?hl=en). To use the SDK, [download the SDK](https://cloud.google.com/sdk/?hl=en) if you haven't already, and set the project ID from the command line. For example: + + ``` + gcloud config set project PROJECT_ID + ``` + +`google-cloud` determines the project ID from the following sources in the listed order, stopping once it finds a value: + +1. The project ID supplied when building the service options +2. Project ID specified by the environment variable `GOOGLE_CLOUD_PROJECT` +3. The App Engine / Compute Engine project ID +4. The project ID specified in the JSON credentials file pointed by the `GOOGLE_APPLICATION_CREDENTIALS` environment variable +5. The Google Cloud SDK project ID + +In cases where the library may expect a project ID explicitly, we provide a helper that can provide the inferred project ID: + ```java + import com.google.cloud.ServiceOptions; + ... + String projectId = ServiceOptions.getDefaultProjectId(); + ``` + +## Authentication + +`google-cloud-java` uses +[https://github.com/googleapis/google-auth-library-java](https://github.com/googleapis/google-auth-library-java) +to authenticate requests. `google-auth-library-java` supports a wide range of authentication types; +see the project's [README](https://github.com/google/google-auth-library-java/blob/main/README.md) +and [javadoc](http://googleapis.dev/java/google-auth-library/latest/) for more +details. + +### Google Cloud Platform environment + +When using Google Cloud libraries from a Google Cloud Platform environment such as Compute Engine, +Kubernetes Engine, or App Engine, no additional authentication steps are necessary. + +For example: + +```java +Storage storage = StorageOptions.getDefaultInstance().getService(); +``` + +or: + +```java +CloudTasksClient cloudTasksClient = CloudTasksClient.create(); +``` + +### Other environments + +#### Using a service account (recommended) + +1. [Generate a JSON service account key](https://cloud.google.com/storage/docs/authentication?hl=en#service_accounts). + +2. After downloading that key, you must do one of the following: + * Define the environment variable GOOGLE_APPLICATION_CREDENTIALS to be the location of the key. + For example: + ```bash + export GOOGLE_APPLICATION_CREDENTIALS=/path/to/my/key.json + ``` + * Supply the JSON credentials file when building the service options. For example, this Storage + object has the necessary permissions to interact with your Google Cloud Storage data: + ```java + Storage storage = StorageOptions.newBuilder() + .setCredentials(ServiceAccountCredentials.fromStream(new FileInputStream("/path/to/my/key.json"))) + .build() + .getService(); + ``` + +#### Local development/testing + +If running locally for development/testing, you can use the [Google Cloud SDK](https://cloud.google.com/sdk/). +Create Application Default Credentials with `gcloud auth application-default login`, and then +`google-cloud` will automatically detect such credentials. + +#### Existing OAuth2 access token + +If you already have an OAuth2 access token, you can use it to authenticate (notice that in this case, the +access token will not be automatically refreshed): + +```java +Credentials credentials = GoogleCredentials.create(new AccessToken(accessToken, expirationTime)); +Storage storage = StorageOptions.newBuilder() + .setCredentials(credentials) + .build() + .getService(); +``` + +or: + +```java +Credentials credentials = GoogleCredentials.create(new AccessToken(accessToken, expirationTime)); +CloudTasksSettings cloudTasksSettings = CloudTasksSettings.newBuilder() + .setCredentialProvider(FixedCredentialsProvider.create(credentials)) + .build(); +CloudTasksClient cloudTasksClient = CloudTasksClient.create(cloudTasksSettings); +``` + +### Application Default Credentials + +If no credentials are provided, `google-cloud` will attempt to detect them from the environment +using `GoogleCredentials.getApplicationDefault()` which will search for Application Default +Credentials in the following locations (in order): + +1. The credentials file pointed to by the `GOOGLE_APPLICATION_CREDENTIALS` environment variable +2. Credentials provided by the Google Cloud SDK `gcloud auth application-default login` command +3. Google App Engine built-in credentials +4. Google Cloud Shell built-in credentials +5. Google Compute Engine built-in credentials + +## Troubleshooting + +To get help, follow the instructions in the [Troubleshooting document](https://github.com/googleapis/google-cloud-java/blob/main/TROUBLESHOOTING.md). + +## Configuring a Proxy + +Google Cloud client libraries use HTTPS and gRPC in underlying communication +with the services. +In both protocols, you can configure a proxy using `https.proxyHost` +and (optional) `https.proxyPort` properties. + +### gRPC Custom Proxy Configuration + +For a more custom proxy with gRPC, you will need supply a `ProxyDetector` to +the `ManagedChannelBuilder`: + +```java +import com.google.api.core.ApiFunction; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.cloud.tasks.v2.CloudTasksClient; +import com.google.cloud.tasks.v2.CloudTasksSettings; +import com.google.cloud.tasks.v2.stub.CloudTasksStubSettings; +import io.grpc.HttpConnectProxiedSocketAddress; +import io.grpc.ManagedChannelBuilder; +import io.grpc.ProxiedSocketAddress; +import io.grpc.ProxyDetector; + +import javax.annotation.Nullable; +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.SocketAddress; + +public CloudTasksClient getService() throws IOException { + TransportChannelProvider transportChannelProvider = + CloudTasksStubSettings.defaultGrpcTransportProviderBuilder() + .setChannelConfigurator( + new ApiFunction() { + @Override + public ManagedChannelBuilder apply(ManagedChannelBuilder managedChannelBuilder) { + return managedChannelBuilder.proxyDetector( + new ProxyDetector() { + @Nullable + @Override + public ProxiedSocketAddress proxyFor(SocketAddress socketAddress) + throws IOException { + return HttpConnectProxiedSocketAddress.newBuilder() + .setUsername(PROXY_USERNAME) + .setPassword(PROXY_PASSWORD) + .setProxyAddress(new InetSocketAddress(PROXY_HOST, PROXY_PORT)) + .setTargetAddress((InetSocketAddress) socketAddress) + .build(); + } + }); + } + }) + .build(); + CloudTasksSettings cloudTasksSettings = + CloudTasksSettings.newBuilder() + .setTransportChannelProvider(transportChannelProvider) + .build(); + return CloudTasksClient.create(cloudTasksSettings); +} +``` + +## Long Running Operations + +Long running operations (LROs) are often used for API calls that are expected to +take a long time to complete (e.g. provisioning a GCE instance or a Dataflow pipeline). +The initial API call creates an "operation" on the server and returns an operation ID +to track its progress. + +Our generated gRPC clients provide a nice interface for starting the operation and +then waiting for the operation to complete. This is accomplished by returning an +[`OperationFuture`](https://googleapis.dev/java/gax/latest/index.html?com/google/api/gax/longrunning/OperationFuture.html). +When you call `get()` on the `OperationFuture` we poll the operation endpoint to +check on the operation. These polling operations have a default timeout that +varies from service to service and will throw a `java.util.concurrent.CancellationException` +with the message: `Task was cancelled.` after that timeout has been reached. + +### Configuring LRO Timeouts + +```java +ClusterControllerSettings.Builder settingsBuilder = ClusterControllerSettings.newBuilder(); +TimedRetryAlgorithm timedRetryAlgorithm = OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(500L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(5000L)) + .setInitialRpcTimeout(Duration.ZERO) // ignored + .setRpcTimeoutMultiplier(1.0) // ignored + .setMaxRpcTimeout(Duration.ZERO) // ignored + .setTotalTimeout(Duration.ofHours(24L)) // set polling timeout to 24 hours + .build()); +settingsBuilder.createClusterOperationSettings() + .setPollingAlgorithm(timedRetryAlgorithm); +ClusterControllerClient clusterControllerClient = ClusterControllerClient.create(settingsBuilder.build()); +``` + +## Managing Dependencies + +If you are using more than one Google Cloud client library, we recommend you use one of +our Bill of Material (BOM) artifacts to help manage dependency versions. For more information, +see https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM. + +## Java Versions + +Java 7 or above is required for using the clients in this repository. + +## Supported Platforms + +Clients in this repository use either HTTP or gRPC for the transport layer. All +HTTP-based clients should work in all environments. + +For clients that use gRPC, the supported platforms are constrained by the platforms +that [Forked Tomcat Native](http://netty.io/wiki/forked-tomcat-native.html) supports, +which for architectures means only x86_64, and for operating systems means Mac OS X, +Windows, and Linux. Additionally, gRPC constrains the use of platforms with +threading restrictions. + +Thus, the following are not supported: + +- Android + - Consider [Firebase](https://firebase.google.com), which includes many of these APIs. + - It is possible to use these libraries in many cases, although it is unsupported. + You can find examples, such as [this one](https://github.com/GoogleCloudPlatform/android-docs-samples/tree/main/speech/SpeechRecognitionClient), + in this [example repository](https://github.com/GoogleCloudPlatform/android-docs-samples) but consider the risks carefully before using these libraries in an application. +- Raspberry Pi (since it runs on the ARM architecture) +- Google App Engine Standard Java 7 + +The following environments should work (among others): + +- standalone Windows on x86_64 +- standalone Mac OS X on x86_64 +- standalone Linux on x86_64 +- Google Compute Engine (GCE) +- Google Container Engine (GKE) +- Google App Engine Standard Java 8 (GAE Std J8) +- Google App Engine Flex (GAE Flex) +- Alpine Linux (Java 11+) + +## Testing + +This library provides tools to help write tests for code that uses google-cloud services. + +See [TESTING] to read more about using our testing helpers. + +## Versioning + +This library follows [Semantic Versioning](http://semver.org/), with some +additional qualifications: + +1. Components marked with `@BetaApi` or `@Experimental` are considered to be "0.x" + features inside a "1.x" library. This means they can change between minor and + patch releases in incompatible ways. These features should not be used by any + library "B" that itself has consumers, unless the components of library B that + use `@BetaApi` features are also marked with `@BetaApi`. Features marked as + `@BetaApi` are on a path to eventually become "1.x" features with the marker + removed. + + **Special exception for google-cloud-java**: google-cloud-java is + allowed to depend on `@BetaApi` features in gax-java without declaring the consuming + code `@BetaApi`, because gax-java and google-cloud-java move in step + with each other. For this reason, gax-java should not be used + independently of google-cloud-java. + +1. Components marked with `@InternalApi` are technically public, but only + because of the limitations of Java's access + modifiers. For the purposes of semver, they should be considered private. + +1. Interfaces marked with `@InternalExtensionOnly` are public, but should only be + implemented by internal classes. For the purposes of semver, we reserve the right + to add to these interfaces without default implementations (for Java 7). + +Please note these clients are currently under active development. Any release versioned 0.x.y is +subject to backwards incompatible changes at any time. + +### Stable + +Libraries defined at a Stable quality level are expected to be stable and all updates in the +libraries are guaranteed to be backwards-compatible. Any backwards-incompatible changes will lead +to the major version increment (1.x.y -> 2.0.0). + +### Preview + +Libraries defined at a Preview quality level are still a work-in-progress and +are more likely to get backwards-incompatible updates. Additionally, it's possible for Preview +libraries to get deprecated and deleted before ever being promoted to Preview or Stable. + +## IDE Plugins + +If you're using IntelliJ or Eclipse, you can add client libraries to your project using these IDE plugins: +* [Cloud Tools for IntelliJ](https://cloud.google.com/tools/intellij/docs/client-libraries?utm_source=github&utm_medium=google-cloud-java&utm_campaign=ToolsforIntelliJ) +* [Cloud Tools for Eclipse](https://cloud.google.com/eclipse/docs/libraries?utm_source=github&utm_medium=google-cloud-java&utm_campaign=ToolsforEclipse) + +Besides adding client libraries, the plugins provide additional functionality, such as service account +key management. Refer to the documentation for each plugin for more details. + +These client libraries can be used on App Engine standard for Java 8 runtime and App Engine flexible +(including the Compat runtime). Most of the libraries do not work on the App Engine standard for Java 7 +runtime. However, Datastore, Storage, and Bigquery should work. + +## Contributing + +Contributions to this library are always welcome and highly encouraged. + +See `google-cloud`'s [CONTRIBUTING] documentation and the [shared documentation](https://github.com/googleapis/google-cloud-common/blob/main/contributing/readme.md#how-to-contribute-to-gcloud) for more information on how to get started. + +Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more information. + +## License + +Apache 2.0 - See [LICENSE] for more information. + +[cloud-java]: https://cloud.google.com/java +[stable-stability]: https://img.shields.io/badge/stability-stable-green +[stable-description]: #stable +[preview-stability]: https://img.shields.io/badge/stability-preview-yellow +[preview-description]: #preview +[google-api-java-client-services]: https://github.com/googleapis/google-api-java-client-services#supported-google-apis +[CONTRIBUTING]:https://github.com/googleapis/google-cloud-java/blob/main/CONTRIBUTING.md +[code-of-conduct]:https://github.com/googleapis/google-cloud-java/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[LICENSE]: https://github.com/googleapis/google-cloud-java/blob/main/LICENSE +[TESTING]: https://github.com/googleapis/google-cloud-java/blob/main/TESTING.md +[cloud-platform]: https://cloud.google.com/ +[cloud-platform-docs]: https://cloud.google.com/docs/ +[client-lib-docs]: https://googleapis.dev/java/google-cloud-clients/latest/index.html diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000000..39fe75a24fca --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,1485 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + google-cloud-java/SECURITY.md at main · googleapis/google-cloud-java · GitHub + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content + + + + + + + + + + + +
+ +
+ + + + + + + +
+ + + + +
+ + + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + +
+ + + + + + + + +Permalink + +
+ +
+
+ + + main + + + + +
+
+
+ Switch branches/tags + +
+ + + +
+ +
+ +
+ + +
+ +
+ + + + + + + + + + + + + + + +
+ + +
+
+
+
+ +
+ +
+ + + Go to file + + +
+ + + + + +
+
+
+ + + + + + + + + +
+ +
+
+ + @google-cloud-policy-bot + +
+ + + + + + + + + +
+
+ + Latest commit + 396a5d6 + Apr 30, 2021 + + + + + + History + + +
+
+
add a security policy
+ +
+ +
+
+ + + 1 + + contributor + + +
+ +

+ Users who have contributed to this file +

+
+ + + + + + +
+
+
+
+ + + + + + + + +
+ +
+ + +
+ + + 7 lines (4 sloc) + + 329 Bytes +
+ +
+ + + + + +
+ +
+
+
+
+ +
+
+
+
+
+ + + Open in GitHub Desktop +
+
+
+
+
+ + + +
+
+ + + +
+
+ +
+ +
+
+ + +
+

Security Policy

+

To report a security issue, please use g.co/vulnz.

+

The Google Security Team will respond within 5 working days of your report on g.co/vulnz.

+

We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.

+
+
+ + +
+ + + + +
+ + +
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md new file mode 100644 index 000000000000..ce8567194d2c --- /dev/null +++ b/TROUBLESHOOTING.md @@ -0,0 +1,171 @@ +# Troubleshooting + +## ALPN is not configured properly + +If you see exceptions related to `ALPN is not configured properly`, such as: + +``` +Caused by: java.lang.IllegalArgumentException: ALPN is not configured properly. See https://github.com/grpc/grpc-java/blob/master/SECURITY.md#troubleshooting for more information. +``` + +Please use the [compatibility checker](https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-util/google-cloud-compat-checker) to see if your environment is compatible with grpc-based clients. The incompatibility can mean that: +- You are not on a [supported platform](https://github.com/googleapis/google-cloud-java/#supported-platforms). +- There are classpath conflicts with `netty`. +- Or, you are seeing any of the conflicts specified in [gRPC Troubleshooting guide](https://github.com/grpc/grpc-java/blob/master/SECURITY.md#troubleshooting). + +## ClassNotFoundException, NoSuchMethodError, NoClassDefFoundError + +These errors are usually caused by having multiple versions or conflicting versions of the same dependency in the classpath. +Usually these dependency conflicts occur with `guava` or `protobuf-java`. + +There may be multiple sources for classpath conflicts: +- Multiple versions of the same transitive dependency in the dependency tree +- Your runtime classpath has different versions of dependencies than what you specified in the build + +For example, if you have a direct or a transitive dependency on Guava version 19.0, +and `google-cloud-java` uses Guava version 30.0, +then `google-cloud-java` could be using Guava methods that don't exist in Guava 19.0, +and cause `NoSuchMethodError`. + +Similarily, if your classpath has an older version of `protobuf-java`, +but `google-cloud-java` requires a newer version, + then you might see `NoClassDefFoundError` that fails to initialize `google-cloud-java` classes. For example: + +``` +java.lang.NoClassDefFoundError: Could not initialize class com.google.pubsub.v1.PubsubMessage$AttributesDefaultEntryHolder +``` + +### Validate the conflict + +Check the dependency tree to see if you have multiple versions of the same dependencies: + +``` +$ mvn dependency:tree +``` + +Look for versions of potentially conflicting dependencies like `guava`, `protobuf-java`, etc. + +If you experience the error only during runtime, then your runtime environment +might be introducing conflicting JARs into your runtime classpath. A typical case +is that Hadoop, Spark, or other server software that your application runs on +has conflicting versions `netty`, `guava`, or `protobuf-java` JARs in the classpath. + +### Detecting conflicts during build + +To detect dependency linkage errors at compile time, add the +[Linkage Checker Enforcer Rule](https://github.com/GoogleCloudPlatform/cloud-opensource-java/tree/master/enforcer-rules) +in your pom.xml: + +``` + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M3 + + + com.google.cloud.tools + linkage-checker-enforcer-rules + 1.5.7 + + + + + enforce-linkage-checker + + verify + + enforce + + + + + + + + + +``` + +There is no way to detect runtime classpath conflicts though. You need to be fully +aware of which JARs/classes are included in the runtime classpath +as every server environment is different. + +### Resolving the conflict + +There are different strategies to resolve conflicts, but you must understand the root cause of the conflicts. For example: + +- If you have control over the dependency tree, upgrade + offending dependencies (for example, upgrading Guava version). This is the + least hackish approach, but it is a lot of work that can require multiple releases + of multiple libraries to sync everything up. +- If you can't modify and push new versions of your dependencies, import + `com.google.cloud:libraries-bom:25.1.0` (or a more recent version) and use that to + select consistent dependency versions. This is the easiest route. + For example, this is how you can depend on consistent versions of Guava and + `com.google.cloud:google-cloud-storage` without explicitly setting the version of either one: + +``` + ... + + + + com.google.cloud + libraries-bom + 25.1.0 + pom + import + + + + ... + + + com.google.cloud + google-cloud-storage + + + com.google.guava + guava + + ... + + ... +``` + +- If changing dependency versions causes other failures, + consider [shading dependencies](https://maven.apache.org/plugins/maven-shade-plugin/) + that conflict with `google-cloud-java`. + + For example, to shade `guava` and `protobuf-java`: + +``` + + org.apache.maven.plugins + maven-shade-plugin + ... + + + package + + shade + + + false + + + + com.google.protobuf + myapp.shaded.com.google.protobuf + + + + com.google.common + myapp.shaded.com.google.common + + + + + + +``` diff --git a/generate-readme.py b/generate-readme.py new file mode 100644 index 000000000000..52af94fd4ef4 --- /dev/null +++ b/generate-readme.py @@ -0,0 +1,156 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +from typing import List, Optional +from glob import glob +import json +import requests + +class CloudClient: + repo: str = None + title: str = None + release_level: str = None + group_id: str = "com.google.cloud" + artifact_id: str = None + + def __init__(self, repo: dict): + self.repo = repo['repo'] + # For now, strip out "Google Cloud" to standardize the titles + self.title = repo['name_pretty'].replace("Google ", "").replace("Cloud ", "") + self.release_level = repo['release_level'] + artifact_parts = repo['distribution_name'].split(':') + if len(artifact_parts) > 1: + self.group_id = artifact_parts[0] + self.artifact_id = artifact_parts[1] + else: + self.artifact_id = repo['distribution_name'] + + # For sorting, we want to sort by release level, then API pretty_name + def __lt__(self, other): + if self.release_level == other.release_level: + return self.title < other.title + + return other.release_level < self.release_level + + def __repr__(self): + return repr((self.release_level, self.title)) + +def replace_content_in_readme(content_rows: List[str]) -> None: + START_MARKER = "[//]: # (API_TABLE_START)" + END_MARKER = "[//]: # (API_TABLE_END)" + newlines = [] + repl_open = False + with open("README.md", "r") as f: + for line in f: + if not repl_open: + newlines.append(line) + + if line.startswith(START_MARKER): + repl_open = True + newlines = newlines + content_rows + elif line.startswith(END_MARKER): + newlines.append("\n") + newlines.append(line) + repl_open = False + + with open("README.md", "w") as f: + for line in newlines: + f.write(line) + +RELEASE_LEVEL_CONTENT = { + "preview": "[![preview][preview-stability]][preview-description]", + "stable": "[![stable][stable-stability]][stable-description]" +} + +def client_row(client: CloudClient) -> str: + maven_badge = f"[![Maven](https://img.shields.io/maven-central/v/{client.group_id}/{client.artifact_id}.svg)](https://search.maven.org/search?q=g:{client.group_id}%20AND%20a:{client.artifact_id}&core=gav)" + return f"| [{client.title}](https://github.com/{client.repo}) | {RELEASE_LEVEL_CONTENT[client.release_level]} | {maven_badge} |\n" + +def generate_table_contents(clients: List[CloudClient]) -> List[str]: + content_rows = [ + "\n", + "| Client | Release Level | Version |\n", + "| ------ | ------------- | ------- |\n", + ] + return content_rows + [client_row(client) for client in clients] + + +REPO_METADATA_URL_FORMAT = "https://raw.githubusercontent.com/{repo_slug}/main/.repo-metadata.json" + +def client_for_repo(repo_slug) -> Optional[CloudClient]: + url = REPO_METADATA_URL_FORMAT.format(repo_slug=repo_slug) + response = requests.get(url) + if response.status_code != requests.codes.ok: + return + + return CloudClient(response.json()) + +def client_for_module(module) -> Optional[CloudClient]: + with open ('%s/.repo-metadata.json' % module, "r") as metadata_file: + data = json.load(metadata_file) + monorepo_module = data['repo'].replace('googleapis/', '') + data['repo'] = 'googleapis/google-cloud-java/tree/main/%s' % monorepo_module + return CloudClient(data) + +# These repositories are not meant as shown as Cloud SDK for Java +REPO_EXCLUSION = [ + 'java-bigtable-emulator', + 'java-cloud-bom', + 'java-conformance-tests', + 'java-common-protos', + 'java-core', + 'java-gcloud-maven-plugin', + 'java-grafeas', + 'java-iam', + 'java-notification', + 'java-shared-config', +] + +LIBRARIES_IN_MONOREPO = glob("java-*") + +def allowed_remote_repo(repo) -> bool: + return (repo['language'].lower() == 'java' + and repo['full_name'].startswith('googleapis/java-') + and repo['full_name'] not in + [ 'googleapis/%s' % repo for repo in (REPO_EXCLUSION + LIBRARIES_IN_MONOREPO)]) + +def _fetch_repo_list(page): + url = "https://api.github.com/search/repositories" + response = requests.get(url, params = { + 'q': 'org:googleapis is:public archived:false language:java', + 'per_page': 100, + 'page': page, + }) + return response.json()['items'] + +def all_clients() -> List[CloudClient]: + page = 1 + clients = [] + while (True): + repos = _fetch_repo_list(page) + if not repos: + break + clients.extend([client_for_repo(repo['full_name']) for repo in repos if allowed_remote_repo(repo)]) + page += 1 + clients.extend([client_for_module(module) for module in LIBRARIES_IN_MONOREPO if + module not in REPO_EXCLUSION]) + + return [client for client in clients if client] + + +clients = sorted(all_clients()) +table_contents = generate_table_contents(clients) +replace_content_in_readme(table_contents) diff --git a/generation/bom.pom.xml b/generation/bom.pom.xml new file mode 100644 index 000000000000..40d021639ac4 --- /dev/null +++ b/generation/bom.pom.xml @@ -0,0 +1,103 @@ + + + 4.0.0 + com.google.cloud + google-cloud-gapic-bom + pom + 0.0.1-SNAPSHOT + Google Cloud Java BOM + https://github.com/googleapis/java-cloud-bom + + BOM for the libraries in google-cloud-java repository. Users should not + depend on this artifact explicitly because this BOM is an implementation + detail of the Libraries BOM. + + + +BOM_ARTIFACT_LIST + + + + + + sonatype-nexus-snapshots + https://google.oss.sonatype.org/content/repositories/snapshots + + + sonatype-nexus-staging + https://google.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + true + + sonatype-nexus-staging + https://google.oss.sonatype.org/ + false + + + + org.apache.maven.plugins + maven-site-plugin + 3.12.0 + + true + + + + + + + + release + + + performRelease + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar-no-fork + + + + + + + + + \ No newline at end of file diff --git a/generation/coverage.pom.xml b/generation/coverage.pom.xml new file mode 100644 index 000000000000..b63b4fa2da6b --- /dev/null +++ b/generation/coverage.pom.xml @@ -0,0 +1,42 @@ + + + + google-cloud-java + com.google.api + 0.0.1-SNAPSHOT + + 4.0.0 + + CoverageAggregator + + + 11 + 11 + + + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.1.0 + + true + + + + org.codehaus.mojo + extra-enforcer-rules + 1.6.0 + + + + + + + \ No newline at end of file diff --git a/generation/gapic_bom_versions.txt b/generation/gapic_bom_versions.txt new file mode 100644 index 000000000000..2a3f9f57e87e --- /dev/null +++ b/generation/gapic_bom_versions.txt @@ -0,0 +1,5 @@ +# Format: +# module:released-version:current-version + +google-cloud-gapic-bom:0.0.0:0.0.1-SNAPSHOT + diff --git a/generation/generate_coverage_aggregator.sh b/generation/generate_coverage_aggregator.sh new file mode 100755 index 000000000000..c948b2589cd2 --- /dev/null +++ b/generation/generate_coverage_aggregator.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -e + +GENERATION_DIR=$(dirname -- "$0"); + +# generate coverage report +mkdir -p CoverageAggregator +cp "${GENERATION_DIR}/coverage.pom.xml" CoverageAggregator/pom.xml + +# create aggregator project for jacoco +mvn compile -Dexec.executable='echo' \ +-Dexec.args='${project.groupId}${project.artifactId}${project.version}' \ +exec:exec -q -B | grep -v 'CoverageAggregator\|bom\|parent\|proto\-\|grpc-\|google\-cloud\-java' > /tmp/coverage-modules.txt + +if grep -q ERROR /tmp/coverage-modules.txt; then + echo "There was an error in generating coverage-modules.txt" + exit 1 +fi + +# insert processed modules into coverage aggregator pom.xml +awk -v MODULES="`awk -v ORS='\\\\n' '1' /tmp/coverage-modules.txt`" '1;//{print MODULES}' "${GENERATION_DIR}/coverage.pom.xml" > CoverageAggregator/pom.xml + +sh "${GENERATION_DIR}/print_root_pom.sh" > pom.xml diff --git a/generation/generate_gapic_bom.sh b/generation/generate_gapic_bom.sh new file mode 100755 index 000000000000..621446e71a14 --- /dev/null +++ b/generation/generate_gapic_bom.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +set -e + +# Generate BOM of the artifacts in this repository + +bom_lines="" +# For modules that produce BOMs +for bom_directory in $(find . -name 'google-*-bom' | sort); do + if [[ "${bom_directory}" = *google-cloud-gapic-bom ]]; then + continue + fi + repo_metadata="${bom_directory}/../.repo-metadata.json" + + if ! grep --quiet '"release_level": "stable"' "${repo_metadata}"; then + # Not including non-GA libraries, except those that happened to be included + # already in google-cloud-bom. + if [[ $artifactId_line != *"google-cloud-datalabeling"* ]] \ + && [[ $artifactId_line != *"google-cloud-errorreporting"* ]] \ + && [[ $artifactId_line != *"google-cloud-logging-logback"* ]] \ + && [[ $artifactId_line != *"google-cloud-mediatranslation"* ]] \ + && [[ $artifactId_line != *"google-cloud-nio"* ]] \ + && [[ $artifactId_line != *"google-cloud-notification"* ]] \ + && [[ $artifactId_line != *"google-cloud-phishingprotection"* ]]; then + echo "Not adding ${pom_file} to the BOM because it's not stable." + continue + fi + fi + pom_file="${bom_directory}/pom.xml" + groupId_line=$(grep --max-count=1 'groupId' "${pom_file}") + artifactId_line=$(grep --max-count=1 'artifactId' "${pom_file}") + version_line=$(grep --max-count=1 'x-version-update' "${pom_file}") + + bom_lines+=" \n\ + ${groupId_line}\n\ + ${artifactId_line}\n\ + ${version_line}\n\ + pom\n\ + import\n\ + \n" +done + +# For originally-handwritten modules that do not produce a BOM +for module in $(find . -mindepth 2 -maxdepth 2 -name pom.xml |sort | xargs dirname); do + if ls ${module}/*-bom 1> /dev/null 2>&1; then + continue + fi + if [[ "${module}" = *google-cloud-gapic-bom ]] || [[ "${module}" = *CoverageAggregator ]]; then + continue + fi + + pom_file="${module}/pom.xml" + groupId_line=$(grep --max-count=1 'groupId' "${pom_file}") + artifactId_line=$(grep --max-count=1 'artifactId' "${pom_file}") + version_line=$(grep --max-count=1 'x-version-update' "${pom_file}") + bom_lines+=" \n\ + ${groupId_line}\n\ + ${artifactId_line}\n\ + ${version_line}\n\ + \n" +done + +mkdir -p google-cloud-gapic-bom + +GENERATION_DIR=$(dirname -- "$0"); +awk -v "dependencyManagements=$bom_lines" '{gsub(/BOM_ARTIFACT_LIST/,dependencyManagements)}1' \ + "${GENERATION_DIR}/bom.pom.xml" > google-cloud-gapic-bom/pom.xml diff --git a/generation/generate_release_please_config.sh b/generation/generate_release_please_config.sh new file mode 100644 index 000000000000..9022e12f3f82 --- /dev/null +++ b/generation/generate_release_please_config.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +set -e + +echo "{" > .release-please-manifest.json + +echo ""\""google-cloud-gapic-bom"\"": "\""0.0.0"\""," >> .release-please-manifest.json + +GENERATION_DIR=$(dirname -- "$0"); + +num_modules=$(find . -mindepth 2 -maxdepth 2 -name pom.xml | wc -l) + +rp_config_line="" +rp_manifest_line="" + +for module in $(find . -mindepth 2 -maxdepth 2 -name pom.xml |sort | xargs dirname); do + + if [[ "${module}" = *google-cloud-gapic-bom ]] || [[ "${module}" = *CoverageAggregator ]]; then + continue + fi + + version_file="${module}/versions.txt" + + module_name="${module:2}" + + module_released_version=$(grep google- ${version_file} |head -1 |awk -F: '{print $2}') + module_snapshot_version=$(grep google- ${version_file} |head -1 |awk -F: '{print $3}') + artifactName_config=$(grep google- ${version_file} |head -1 |awk -F: '{print $1}') + + #specific case + if [[ ${module_name} == "java-grafeas" ]]; then + module_released_version=$(grep grafeas ${version_file} |head -1 |awk -F: '{print $2}') + artifactName_config=$(grep grafeas ${version_file} |head -1 |awk -F: '{print $1}') + fi + + #concatenating module name and module version + rp_manifest_line=""\""${module_name}"\"": "\""${module_released_version}"\""" + + rp_config_line+=""\""${module_name}"\"": {\n\ + "\""component"\"": ""\""${artifactName_config}"\"","\n\ + "\""skip-github-release"\"": "true"\n\ + }" + + #adding " , " where it's necessary + if [[ ${num_modules} -gt 2 ]]; then + rp_manifest_line+="," + rp_config_line+=",\n " + num_modules=$((num_modules-1)) + fi + + #adding the line to manifest config file + echo "${rp_manifest_line}" >> .release-please-manifest.json + + #for multi-module libraries, sync the versions to released(non-snapshot):current(snapshot) type + cat ${version_file} | while read line + do + if [[ ${line} =~ [0-9] ]] && ! [[ ${line} == *"SNAPSHOT"* ]] ; then + artifact_name=$(echo "${line}" | awk -F':' '{print $1}') + old_version=$(echo "${line}" | awk -F':' '{print $3}') + new_version=$(echo ${old_version} | awk -F'.' '{print $1"."$2"."$3+1}' | sed s/[.]$//) + new_version="${new_version}-SNAPSHOT" + sed -i "s|${artifact_name}:${old_version}:${old_version}|${artifact_name}:${old_version}:${new_version}|" ${version_file} + artifact_directory="${module}/${artifact_name}" + mvn -B -ntp -f ${artifact_directory} -U versions:set -DnewVersion=${new_version} + mvn versions:commit + fi + done + + snapshot_version=$(echo ${module_released_version} | awk -F'.' '{print $1"."$2"."$3+1}' | sed s/[.]$//) + + #bumping to snapshot in module bom directory, if it exists + bom_directory="${module-name}/${artifactName_config}-bom" + if [ -d "${bom_directory}" ]; then + mvn -B -ntp -f ${bom_directory} -U versions:set -DnewVersion="${snapshot_version}-SNAPSHOT" + mvn versions:commit + fi + + #bumping to snapshot in module root pom + mvn -B -ntp -f ${module} -U versions:set -DnewVersion="${snapshot_version}-SNAPSHOT" + mvn versions:commit + + #specific case + if [[ ${module_name} == "java-notification" ]]; then + mvn -B -ntp -f ${module} -U versions:set -DnewVersion="${snapshot_version}-beta-SNAPSHOT" + mvn versions:commit + fi + +done + +echo "}" >> .release-please-manifest.json + +awk -v "packagesList=$rp_config_line" '{gsub(/ALL_PACKAGES/,packagesList)}1' \ + ${GENERATION_DIR}/release_please_config_raw.json > release-please-config.json diff --git a/generation/parent.pom.xml b/generation/parent.pom.xml new file mode 100644 index 000000000000..30d51a78da0b --- /dev/null +++ b/generation/parent.pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + google-cloud-java + com.google.api + 0.0.1-SNAPSHOT + pom + + com.google.cloud + google-cloud-shared-config + 1.5.1 + + + 11 + 11 + false + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.7 + + + + prepare-agent + + + + report + test + + report + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + ${skipUnitTests} + + + + org.apache.maven.plugins + maven-failsafe-plugin + + 1C + true + + + + + \ No newline at end of file diff --git a/generation/print_root_pom.sh b/generation/print_root_pom.sh new file mode 100755 index 000000000000..452121958526 --- /dev/null +++ b/generation/print_root_pom.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +GENERATION_DIR=$(dirname -- "$0"); + +# Find all Maven modules (a directory that contains pom.xml) +modules=$(find . -mindepth 2 -maxdepth 2 -name pom.xml |sort | xargs dirname \ + |sed -e 's|./||' | xargs -I '{}' echo " {}") + +awk -v MODULES="${modules}" '1;//{print MODULES}' "${GENERATION_DIR}/parent.pom.xml" diff --git a/generation/release_please_config_raw.json b/generation/release_please_config_raw.json new file mode 100644 index 000000000000..29a6f9658cf9 --- /dev/null +++ b/generation/release_please_config_raw.json @@ -0,0 +1,16 @@ +{ + "release-type": "java-yoshi", + "skip-github-release": true, + "separate-pull-requests": false, + "include-component-in-tag": true, + "packages": { + "google-cloud-gapic-bom": { + "component": "google-cloud-gapic-bom", + "skip-github-release": true + }, + ALL_PACKAGES + }, + "plugins": [ + "maven-workspace" + ] +} \ No newline at end of file diff --git a/googleapis_commit.txt b/googleapis_commit.txt new file mode 100644 index 000000000000..8ebaf41d6133 --- /dev/null +++ b/googleapis_commit.txt @@ -0,0 +1 @@ +dc5611c6820826fb46ca2ca1399cf8dc5b32f600 \ No newline at end of file diff --git a/java.header b/java.header new file mode 100644 index 000000000000..772004189ad5 --- /dev/null +++ b/java.header @@ -0,0 +1,15 @@ +^/\*$ +^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)$ +^ \*$ +^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\);$ +^ \* you may not use this file except in compliance with the License\.$ +^ \* You may obtain a copy of the License at$ +^ \*$ +^ \*[ ]+https?://www.apache.org/licenses/LICENSE-2\.0$ +^ \*$ +^ \* Unless required by applicable law or agreed to in writing, software$ +^ \* distributed under the License is distributed on an "AS IS" BASIS,$ +^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$ +^ \* See the License for the specific language governing permissions and$ +^ \* limitations under the License\.$ +^ \*/$ \ No newline at end of file diff --git a/license-checks.xml b/license-checks.xml new file mode 100644 index 000000000000..8f901ab6d3c9 --- /dev/null +++ b/license-checks.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/renovate.json b/renovate.json new file mode 100644 index 000000000000..e2e2b9709b8b --- /dev/null +++ b/renovate.json @@ -0,0 +1,29 @@ +{ + "extends": [ + "config:base" + ], + "ignoreDeps": [ + "com.google.api:gax-bom", + "com.google.guava:guava", + "com.google.guava:guava-testlib", + "com.google.protobuf:protobuf-java", + "com.google.protobuf:protobuf-java-util", + "io.opencensus:opencensus-api", + "io.opencensus:opencensus-contrib-grpc-util", + "io.opencensus:opencensus-contrib-http-util" + ], + "packageRules": [ + { + "packagePatterns": ["^io.grpc:grpc-"], + "groupName": "gRPC packages" + }, + { + "packagePatterns": ["^com.google.protobuf:protobuf-"], + "groupName": "Protobuf packages" + }, + { + "packagePatterns": ["^io.opencensus:opencensus-"], + "groupName": "OpenCensus packages" + } + ] +} diff --git a/settings.xml b/settings.xml new file mode 100644 index 000000000000..8b592f625d58 --- /dev/null +++ b/settings.xml @@ -0,0 +1,32 @@ + + + + + + + google-maven-central + GCS Maven Central mirror + https://maven-central.storage-download.googleapis.com/maven2/ + central + + +