├── .gitattributes ├── .github └── workflows │ └── test.yml ├── .gitignore ├── .kokoro ├── android │ ├── common.cfg │ ├── connectivity-samples.cfg │ └── media-samples.cfg ├── build-android.sh ├── build-dotnet.bat ├── build-dotnet.ps1 ├── build-flutter.sh ├── build-ios.sh ├── build-java-split-projects.sh ├── build-node.sh ├── build-php.sh ├── build-python.sh ├── common.cfg ├── firebase │ ├── FirebaseUI-iOS.cfg │ ├── appquality-codelab-ios.cfg │ ├── build-html.sh │ ├── build-node.sh │ ├── codelab-friendlychat-android.cfg │ ├── codelab-friendlychat-ios.cfg │ ├── codelab-friendlychat-web-html.cfg │ ├── codelab-friendlychat-web.cfg │ ├── common.cfg │ ├── firebase-js-sdk.cfg │ ├── friendlyeats-android.cfg │ ├── friendlyeats-ios.cfg │ ├── friendlyeats-web.cfg │ ├── friendlypix-ios.cfg │ ├── functions-samples-html.cfg │ ├── functions-samples.cfg │ ├── mlkit-material-android.cfg │ ├── mlkit-material-ios.cfg │ ├── quickstart-android.cfg │ ├── quickstart-flutter.cfg │ ├── quickstart-ios.cfg │ ├── quickstart-js-html.cfg │ ├── quickstart-js-node.cfg │ ├── quickstart-nodejs.cfg │ ├── quickstart-testing-html.cfg │ ├── quickstart-testing-node.cfg │ ├── snippets-android.cfg │ ├── snippets-ios.cfg │ ├── snippets-node.cfg │ ├── snippets-web-html.cfg │ └── snippets-web-node.cfg ├── getting-started-php.cfg ├── getting-started-python.cfg ├── java-repo-tools.cfg ├── php-docs-samples.cfg ├── python-docs-samples.cfg ├── python-runtime.cfg └── trampoline.sh ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── check.sh ├── clone-and-checkout.sh ├── commit-and-push.sh ├── fix_android_dependencies.py ├── java-versions-rules.xml ├── send-pr.sh ├── set-env.template.sh ├── use-latest-deps-android.sh ├── use-latest-deps-dotnet.sh ├── use-latest-deps-flutter.sh ├── use-latest-deps-html.sh ├── use-latest-deps-ios.sh ├── use-latest-deps-java.sh ├── use-latest-deps-js.sh ├── use-latest-deps-node.sh ├── use-latest-deps-php.sh ├── use-latest-deps-python.sh └── webhook-app ├── .gitignore ├── README.md ├── app.yaml ├── cron.yaml ├── github_helper.py ├── gunicorn.conf.py ├── invitations.py ├── main.py ├── main_test.py ├── requirements.txt ├── webhook_creator.py ├── webhook_helper.py └── webhooks.py /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sh text eol=lf -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: CI Tests 2 | 3 | on: 4 | - pull_request 5 | - push 6 | 7 | env: 8 | CI: true 9 | 10 | jobs: 11 | unit: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v1 15 | - name: Check Scripts 16 | run: ./check.sh 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | java-repo-tools 2 | set-env.sh 3 | repo-to-update 4 | .idea/ 5 | *.iml 6 | 7 | # Python 8 | venv/ 9 | -------------------------------------------------------------------------------- /.kokoro/android/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # The github token is stored here. 4 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/dpebot" 5 | 6 | # Common env vars for all repositories and builds. 7 | env_vars: { 8 | key: "DPEBOT_GITHUB_TOKEN_FILE" 9 | value: "github-token.txt" 10 | } 11 | env_vars: { 12 | key: "DPEBOT_GIT_USER_NAME" 13 | value: "DPE bot" 14 | } 15 | env_vars: { 16 | key: "DPEBOT_GIT_USER_EMAIL" 17 | value: "dpebot@google.com" 18 | } 19 | -------------------------------------------------------------------------------- /.kokoro/android/connectivity-samples.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-android.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "android/connectivity-samples" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/android/media-samples.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-android.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "android/media-samples" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/build-android.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build script for repositories with Android dependencies. 3 | 4 | set -eo pipefail 5 | 6 | cd ${KOKORO_ARTIFACTS_DIR}/github/repository-gardener 7 | 8 | # Kokoro should set the following environment variables. 9 | # - DPEBOT_REPO 10 | # - DPEBOT_GIT_USER_NAME 11 | # - DPEBOT_GIT_USER_EMAIL="dpebot@google.com" 12 | # Kokoro exposes this as a file, but the scripts expect just a plain variable. 13 | export DPEBOT_GITHUB_TOKEN=$(cat ${KOKORO_GFILE_DIR}/${DPEBOT_GITHUB_TOKEN_FILE}) 14 | 15 | chmod +x *.sh 16 | 17 | if [ -z ${DPEBOT_BRANCH+x} ]; then 18 | ./clone-and-checkout.sh "${DPEBOT_REPO}" 19 | else 20 | ./clone-and-checkout.sh -b "${DPEBOT_BRANCH}" "${DPEBOT_REPO}" 21 | fi 22 | 23 | # Accept Android SDK Licenses 24 | echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_HOME/licenses/android-sdk-license" 25 | 26 | ( 27 | cd repo-to-update 28 | ../use-latest-deps-android.sh "${DPEBOT_REPO}" 29 | ) 30 | -------------------------------------------------------------------------------- /.kokoro/build-dotnet.bat: -------------------------------------------------------------------------------- 1 | set /p DPEBOT_GITHUB_TOKEN= < %KOKORO_GFILE_DIR%/%DPEBOT_GITHUB_TOKEN_FILE% 2 | 3 | cd %KOKORO_ARTIFACTS_DIR%/github/repository-gardener 4 | 5 | powershell .\.kokoro\build-dotnet.ps1 6 | -------------------------------------------------------------------------------- /.kokoro/build-dotnet.ps1: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | get-command choco -ErrorAction Stop 16 | choco list -li | Tee-Object -Variable chocoList 17 | $chocoPackages = ($chocoList) -join ' ' 18 | 19 | # Install dotnet 20 | if (-not $chocoPackages.Contains('Microsoft .NET Core SDK - 2.1.4')) { 21 | choco install -y --sxs dotnetcore-sdk --version 2.1.401 22 | } 23 | 24 | dotnet --info 25 | 26 | if (-not $Dir) { 27 | $Dir = "$PSScriptRoot\..\env" 28 | } 29 | 30 | # Install dotnet-outdated and add it to PATH 31 | $installDir = Join-Path $Dir 'install' 32 | dotnet tool install --tool-path $installDir\dotnet-tools dotnet-outdated 33 | $env:Path = @("$installDir\dotnet-tools", $env:Path) -join ';' 34 | 35 | # Clone the target repo and checkout a new branch. 36 | if (-not $env:DPEBOT_BRANCH) { 37 | sh .\clone-and-checkout.sh $env:DPEBOT_REPO 38 | } else { 39 | sh .\clone-and-checkout.sh -b $env:DPEBOT_BRANCH $env:DPEBOT_REPO 40 | } 41 | 42 | # Update dependencies in the repo and send PR to github. 43 | cd repo-to-update 44 | sh ..\use-latest-deps-dotnet.sh "$env:DPEBOT_REPO" 45 | -------------------------------------------------------------------------------- /.kokoro/build-flutter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build script for repositories with Flutter dependencies. 3 | 4 | set -eo pipefail 5 | 6 | cd ${KOKORO_ARTIFACTS_DIR}/github/repository-gardener 7 | 8 | # Kokoro should set the following environment variables. 9 | # - DPEBOT_REPO 10 | # - DPEBOT_GIT_USER_NAME 11 | # - DPEBOT_GIT_USER_EMAIL="dpebot@google.com" 12 | # Kokoro exposes this as a file, but the scripts expect just a plain variable. 13 | export DPEBOT_GITHUB_TOKEN=$(cat ${KOKORO_GFILE_DIR}/${DPEBOT_GITHUB_TOKEN_FILE}) 14 | 15 | chmod +x *.sh 16 | 17 | if [ -z ${DPEBOT_BRANCH+x} ]; then 18 | ./clone-and-checkout.sh "${DPEBOT_REPO}" 19 | else 20 | ./clone-and-checkout.sh -b "${DPEBOT_BRANCH}" "${DPEBOT_REPO}" 21 | fi 22 | 23 | # Accept Android SDK Licenses - This might not be necessary. 24 | echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_HOME/licenses/android-sdk-license" 25 | 26 | ( 27 | cd repo-to-update 28 | ../use-latest-deps-flutter.sh "${DPEBOT_REPO}" 29 | ) 30 | -------------------------------------------------------------------------------- /.kokoro/build-ios.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build script for repositories with iOS Cocoapods dependencies. 3 | 4 | set -eo pipefail 5 | 6 | cd ${KOKORO_ARTIFACTS_DIR}/github/repository-gardener 7 | 8 | # Kokoro should set the following environment variables. 9 | # - DPEBOT_REPO 10 | # - DPEBOT_GIT_USER_NAME 11 | # - DPEBOT_GIT_USER_EMAIL="dpebot@google.com" 12 | # Kokoro exposes this as a file, but the scripts expect just a plain variable. 13 | export DPEBOT_GITHUB_TOKEN=$(cat ${KOKORO_GFILE_DIR}/${DPEBOT_GITHUB_TOKEN_FILE}) 14 | 15 | chmod +x *.sh 16 | 17 | if [ -z ${DPEBOT_BRANCH+x} ]; then 18 | ./clone-and-checkout.sh "${DPEBOT_REPO}" 19 | else 20 | ./clone-and-checkout.sh -b "${DPEBOT_BRANCH}" "${DPEBOT_REPO}" 21 | fi 22 | 23 | ( 24 | cd repo-to-update 25 | ../use-latest-deps-ios.sh "${DPEBOT_REPO}" 26 | ) 27 | -------------------------------------------------------------------------------- /.kokoro/build-java-split-projects.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Same as build-java, but works for repos that don't have a central pom 3 | 4 | set -eo pipefail 5 | # Enables `**` to include files nested inside sub-folders 6 | shopt -s globstar 7 | 8 | cd ${KOKORO_ARTIFACTS_DIR}/github/repository-gardener 9 | 10 | # Kokoro should set the following environment variables. 11 | # - DPEBOT_REPO 12 | # - DPEBOT_GIT_USER_NAME 13 | # - DPEBOT_GIT_USER_EMAIL="dpebot@google.com" 14 | # Kokoro exposes this as a file, but the scripts expect just a plain variable. 15 | export DPEBOT_GITHUB_TOKEN=$(cat ${KOKORO_GFILE_DIR}/${DPEBOT_GITHUB_TOKEN_FILE}) 16 | 17 | # Install some extra packages needed by java-docs-samples 18 | sudo apt-get install -y expect shellcheck 19 | 20 | # Install Maven 21 | wget https://www-eu.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz 22 | tar -xvzf apache-maven-3.6.1-bin.tar.gz 23 | export MAVEN_HOME="$(pwd)/apache-maven-3.6.1-bin.tar.gz" 24 | export PATH="${MAVEN_HOME}/bin:${PATH}" 25 | mvn -v 26 | 27 | chmod +x *.sh 28 | 29 | # Get the dpebot project root 30 | DPEBOT_ROOT="$(pwd)" 31 | 32 | if [ -z ${DPEBOT_BRANCH+x} ]; then 33 | ./clone-and-checkout.sh "${DPEBOT_REPO}" 34 | else 35 | ./clone-and-checkout.sh -b "${DPEBOT_BRANCH}" "${DPEBOT_REPO}" 36 | fi 37 | 38 | cd "repo-to-update" 39 | REPO_ROOT="$(pwd)" 40 | # Find projects by pom and use maven to find each one 41 | for file in **/pom.xml; do 42 | cd "$REPO_ROOT" 43 | # Navigate to the project folder. 44 | file=$(dirname "$file") 45 | cd "$file" 46 | 47 | # Update dependencies and plugins that use properties for version numbers. 48 | RULES_URI="file://$DPEBOT_ROOT/java-versions-rules.xml" 49 | mvn -U versions:use-latest-releases "-Dmaven.version.rules=$RULES_URI" 50 | mvn -U versions:update-properties "-Dmaven.version.rules=$RULES_URI" 51 | 52 | done 53 | 54 | cd "$REPO_ROOT" 55 | 56 | # If there were any changes, test them and then push and send a PR. 57 | set +e 58 | if ! git diff --quiet; then 59 | set -e 60 | "${DPEBOT_ROOT}/commit-and-push.sh" 61 | "${DPEBOT_ROOT}/send-pr.sh" "$DPEBOT_REPO" 62 | fi 63 | -------------------------------------------------------------------------------- /.kokoro/build-node.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build script for repositories with NodeJS dependencies. 3 | 4 | set -eo pipefail 5 | 6 | cd ${KOKORO_ARTIFACTS_DIR}/github/repository-gardener 7 | 8 | # Kokoro should set the following environment variables. 9 | # - DPEBOT_REPO 10 | # - DPEBOT_GIT_USER_NAME 11 | # - DPEBOT_GIT_USER_EMAIL="dpebot@google.com" 12 | # Kokoro exposes this as a file, but the scripts expect just a plain variable. 13 | export DPEBOT_GITHUB_TOKEN=$(cat ${KOKORO_GFILE_DIR}/${DPEBOT_GITHUB_TOKEN_FILE}) 14 | 15 | chmod +x *.sh 16 | 17 | if [ -z ${DPEBOT_BRANCH+x} ]; then 18 | ./clone-and-checkout.sh "${DPEBOT_REPO}" 19 | else 20 | ./clone-and-checkout.sh -b "${DPEBOT_BRANCH}" "${DPEBOT_REPO}" 21 | fi 22 | 23 | ( 24 | cd repo-to-update 25 | ../use-latest-deps-node.sh "${DPEBOT_REPO}" 26 | ) 27 | -------------------------------------------------------------------------------- /.kokoro/build-php.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build script for repositories with Python dependencies. 3 | 4 | set -eo pipefail 5 | 6 | cd ${KOKORO_ARTIFACTS_DIR}/github/repository-gardener 7 | 8 | # Kokoro should set the following environment variables. 9 | # - DPEBOT_REPO 10 | # - DPEBOT_GIT_USER_NAME 11 | # - DPEBOT_GIT_USER_EMAIL="dpebot@google.com" 12 | # Kokoro exposes this as a file, but the scripts expect just a plain variable. 13 | export DPEBOT_GITHUB_TOKEN=$(cat ${KOKORO_GFILE_DIR}/${DPEBOT_GITHUB_TOKEN_FILE}) 14 | 15 | # Install jq 16 | apt-get install -y jq 17 | 18 | chmod +x *.sh 19 | 20 | if [ -z ${DPEBOT_BRANCH+x} ]; then 21 | ./clone-and-checkout.sh "${DPEBOT_REPO}" 22 | else 23 | ./clone-and-checkout.sh -b "${DPEBOT_BRANCH}" "${DPEBOT_REPO}" 24 | fi 25 | 26 | ( 27 | cd repo-to-update 28 | ../use-latest-deps-php.sh "${DPEBOT_REPO}" 29 | ) 30 | -------------------------------------------------------------------------------- /.kokoro/build-python.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build script for repositories with Python dependencies. 3 | 4 | set -eo pipefail 5 | 6 | cd ${KOKORO_ARTIFACTS_DIR}/github/repository-gardener 7 | 8 | # Kokoro should set the following environment variables. 9 | # - DPEBOT_REPO 10 | # - DPEBOT_GIT_USER_NAME 11 | # - DPEBOT_GIT_USER_EMAIL="dpebot@google.com" 12 | # Kokoro exposes this as a file, but the scripts expect just a plain variable. 13 | export DPEBOT_GITHUB_TOKEN=$(cat ${KOKORO_GFILE_DIR}/${DPEBOT_GITHUB_TOKEN_FILE}) 14 | 15 | # Install some extra packages needed by python-docs-samples 16 | sudo apt-get install -y libmysqlclient-dev 17 | 18 | chmod +x *.sh 19 | 20 | if [ -z ${DPEBOT_BRANCH+x} ]; then 21 | ./clone-and-checkout.sh "${DPEBOT_REPO}" 22 | else 23 | ./clone-and-checkout.sh -b "${DPEBOT_BRANCH}" "${DPEBOT_REPO}" 24 | fi 25 | 26 | ( 27 | cd repo-to-update 28 | ../use-latest-deps-python.sh "${DPEBOT_REPO}" 29 | ) 30 | -------------------------------------------------------------------------------- /.kokoro/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # The github token is stored here. 4 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/dpebot" 5 | 6 | # Common env vars for all repositories and builds. 7 | env_vars: { 8 | key: "DPEBOT_GITHUB_TOKEN_FILE" 9 | value: "github-token.txt" 10 | } 11 | env_vars: { 12 | key: "DPEBOT_GIT_USER_NAME" 13 | value: "DPE bot" 14 | } 15 | env_vars: { 16 | key: "DPEBOT_GIT_USER_EMAIL" 17 | value: "dpebot@google.com" 18 | } 19 | -------------------------------------------------------------------------------- /.kokoro/firebase/FirebaseUI-iOS.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-ios.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/FirebaseUI-iOS" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_BRANCH_BASE" 12 | value: "main" 13 | } 14 | -------------------------------------------------------------------------------- /.kokoro/firebase/appquality-codelab-ios.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-ios.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/appquality-codelab-ios" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/firebase/build-html.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build script for repositories with NodeJS dependencies. 3 | 4 | set -eo pipefail 5 | 6 | cd ${KOKORO_ARTIFACTS_DIR}/github/repository-gardener 7 | 8 | # Kokoro should set the following environment variables. 9 | # - DPEBOT_REPO 10 | # - DPEBOT_GIT_USER_NAME 11 | # - DPEBOT_GIT_USER_EMAIL="dpebot@google.com" 12 | # Kokoro exposes this as a file, but the scripts expect just a plain variable. 13 | export DPEBOT_GITHUB_TOKEN=$(cat ${KOKORO_GFILE_DIR}/${DPEBOT_GITHUB_TOKEN_FILE}) 14 | 15 | chmod +x *.sh 16 | 17 | if [ -z ${DPEBOT_BRANCH+x} ]; then 18 | ./clone-and-checkout.sh "${DPEBOT_REPO}" 19 | else 20 | ./clone-and-checkout.sh -b "${DPEBOT_BRANCH}" "${DPEBOT_REPO}" 21 | fi 22 | 23 | # Get jq 24 | sudo apt-get install -y jq 25 | 26 | # Update npm itself 27 | sudo -E npm -E install -g npm@6.14.11 28 | 29 | # Get latest version of the Firebase SDK on NPM 30 | FIREBASE_SDK_VER=$(npm view firebase --json | jq -r '.["dist-tags"].latest') 31 | 32 | # Get latest version of FirebaseUI on NPM 33 | FIREBASEUI_VER=$(npm view firebaseui --json | jq -r '.["dist-tags"].latest') 34 | 35 | cd repo-to-update 36 | if [ -z ${DPEBOT_FILE_INCLUDE_PATTERN+x} ]; then 37 | ( 38 | # Updating local/firebase hosing served Firebase SDK dependencies. 39 | ../use-latest-deps-html.sh "firebase/[0-9]*\.[0-9]*\.[0-9]*/" "firebase/${FIREBASE_SDK_VER}/" "${DPEBOT_REPO}" 40 | ../use-latest-deps-js.sh "firebase/[0-9]*\.[0-9]*\.[0-9]*/" "firebase/${FIREBASE_SDK_VER}/" "${DPEBOT_REPO}" 41 | # Updating CDN Firebase SDK dependencies. 42 | ../use-latest-deps-html.sh "firebasejs/[0-9]*\.[0-9]*\.[0-9]*/" "firebasejs/${FIREBASE_SDK_VER}/" "${DPEBOT_REPO}" 43 | ../use-latest-deps-js.sh "firebasejs/[0-9]*\.[0-9]*\.[0-9]*/" "firebasejs/${FIREBASE_SDK_VER}/" "${DPEBOT_REPO}" 44 | # Updating CDN FirebaseUI dependencies. 45 | ../use-latest-deps-html.sh "firebaseui/[0-9]*\.[0-9]*\.[0-9]*/" "firebaseui/${FIREBASEUI_VER}/" "${DPEBOT_REPO}" 46 | ) 47 | else 48 | ( 49 | # Updating local/firebase hosing served Firebase SDK dependencies. 50 | ../use-latest-deps-html.sh -i "$DPEBOT_FILE_INCLUDE_PATTERN" "firebase/[0-9]*\.[0-9]*\.[0-9]*/" "firebase/${FIREBASE_SDK_VER}/" "${DPEBOT_REPO}" 51 | ../use-latest-deps-js.sh -i "$DPEBOT_FILE_INCLUDE_PATTERN" "firebase/[0-9]*\.[0-9]*\.[0-9]*/" "firebase/${FIREBASE_SDK_VER}/" "${DPEBOT_REPO}" 52 | # Updating CDN Firebase SDK dependencies. 53 | ../use-latest-deps-html.sh -i "$DPEBOT_FILE_INCLUDE_PATTERN" "firebasejs/[0-9]*\.[0-9]*\.[0-9]*/" "firebasejs/${FIREBASE_SDK_VER}/" "${DPEBOT_REPO}" 54 | ../use-latest-deps-js.sh -i "$DPEBOT_FILE_INCLUDE_PATTERN" "firebasejs/[0-9]*\.[0-9]*\.[0-9]*/" "firebasejs/${FIREBASE_SDK_VER}/" "${DPEBOT_REPO}" 55 | # Updating CDN FirebaseUI dependencies. 56 | ../use-latest-deps-html.sh -i "$DPEBOT_FILE_INCLUDE_PATTERN" "firebaseui/[0-9]*\.[0-9]*\.[0-9]*/" "firebaseui/${FIREBASEUI_VER}/" "${DPEBOT_REPO}" 57 | ) 58 | fi 59 | 60 | -------------------------------------------------------------------------------- /.kokoro/firebase/build-node.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build script for repositories with NodeJS dependencies. 3 | 4 | set -eo pipefail 5 | 6 | cd ${KOKORO_ARTIFACTS_DIR}/github/repository-gardener 7 | 8 | # Kokoro should set the following environment variables. 9 | # - DPEBOT_REPO 10 | # - DPEBOT_GIT_USER_NAME 11 | # - DPEBOT_GIT_USER_EMAIL="dpebot@google.com" 12 | # Kokoro exposes this as a file, but the scripts expect just a plain variable. 13 | export DPEBOT_GITHUB_TOKEN=$(cat ${KOKORO_GFILE_DIR}/${DPEBOT_GITHUB_TOKEN_FILE}) 14 | 15 | chmod +x *.sh 16 | 17 | if [ -z ${DPEBOT_BRANCH+x} ]; then 18 | ./clone-and-checkout.sh "${DPEBOT_REPO}" 19 | else 20 | ./clone-and-checkout.sh -b "${DPEBOT_BRANCH}" "${DPEBOT_REPO}" 21 | fi 22 | 23 | ( 24 | cd repo-to-update 25 | if [ -z ${DPEBOT_NODE_REGEX+x} ]; then 26 | if [ -z ${DPEBOT_FILE_INCLUDE_PATTERN+x} ]; then 27 | ../use-latest-deps-node.sh "${DPEBOT_REPO}" 28 | else 29 | ../use-latest-deps-node.sh -i "$DPEBOT_FILE_INCLUDE_PATTERN" "${DPEBOT_REPO}" 30 | fi 31 | else 32 | if [ -z ${DPEBOT_FILE_INCLUDE_PATTERN+x} ]; then 33 | ../use-latest-deps-node.sh -p "${DPEBOT_NODE_REGEX}" "${DPEBOT_REPO}" 34 | else 35 | ../use-latest-deps-node.sh -i "$DPEBOT_FILE_INCLUDE_PATTERN" -p "${DPEBOT_NODE_REGEX}" "${DPEBOT_REPO}" 36 | fi 37 | fi 38 | ) 39 | -------------------------------------------------------------------------------- /.kokoro/firebase/codelab-friendlychat-android.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-android.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/codelab-friendlychat-android" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/firebase/codelab-friendlychat-ios.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-ios.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/codelab-friendlychat-ios" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/firebase/codelab-friendlychat-web-html.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/firebase/build-html.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/codelab-friendlychat-web" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_BRANCH_HEAD" 12 | value: "dpebot-repositorygardener-html" 13 | } 14 | -------------------------------------------------------------------------------- /.kokoro/firebase/codelab-friendlychat-web.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/firebase/build-node.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/codelab-friendlychat-web" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_NODE_REGEX" 12 | value: "/firebase.*/" 13 | } -------------------------------------------------------------------------------- /.kokoro/firebase/common.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # The github token is stored here. 4 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/dpebot" 5 | 6 | # Copy a JDK 17 installation from x20 7 | gfile_resources: "/x20/projects/java-platform/linux-amd64/jdk-17-latest" 8 | 9 | # Common env vars for all repositories and builds. 10 | env_vars: { 11 | key: "DPEBOT_GITHUB_TOKEN_FILE" 12 | value: "github-token.txt" 13 | } 14 | env_vars: { 15 | key: "DPEBOT_GIT_USER_NAME" 16 | value: "DPE bot" 17 | } 18 | env_vars: { 19 | key: "DPEBOT_GIT_USER_EMAIL" 20 | value: "dpebot@google.com" 21 | } 22 | 23 | # UTF-8 is required for CocoaPods. 24 | env_vars: { 25 | key: "LANG" 26 | value: "en_US.UTF-8" 27 | } 28 | env_vars: { 29 | key: "LANGUAGE" 30 | value: "en_US.UTF-8" 31 | } 32 | env_vars: { 33 | key: "LC_ALL" 34 | value: "en_US.UTF-8" 35 | } 36 | -------------------------------------------------------------------------------- /.kokoro/firebase/firebase-js-sdk.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Trampoline: 4 | # https://g3doc.corp.google.com/company/teams/cloud-devrel/dpe/reference/kokoro/index.md?cl=head#trampoline-strategy 5 | 6 | # Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} 7 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 8 | 9 | # Node 8 Docker image 10 | # https://github.com/googleapis/testing-infra-docker/tree/master/node 11 | env_vars: { 12 | key: "TRAMPOLINE_IMAGE" 13 | value: "gcr.io/cloud-devrel-kokoro-resources/node:8-user" 14 | } 15 | 16 | env_vars: { 17 | key: "TRAMPOLINE_BUILD_FILE" 18 | value: "github/repository-gardener/.kokoro/build-node.sh" 19 | } 20 | 21 | env_vars: { 22 | key: "DPEBOT_REPO" 23 | value: "firebase/firebase-js-sdk" 24 | } 25 | 26 | build_file: "repository-gardener/.kokoro/trampoline.sh" -------------------------------------------------------------------------------- /.kokoro/firebase/friendlyeats-android.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-android.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/friendlyeats-android" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/firebase/friendlyeats-ios.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-ios.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/friendlyeats-ios" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/firebase/friendlyeats-web.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/firebase/build-html.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/friendlyeats-web" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/firebase/friendlypix-ios.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-ios.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/friendlypix-ios" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/firebase/functions-samples-html.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/firebase/build-html.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/functions-samples" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_BRANCH_HEAD" 12 | value: "dpebot-repositorygardener-html" 13 | } 14 | 15 | env_vars: { 16 | key: "DPEBOT_BRANCH_BASE" 17 | value: "main" 18 | } 19 | -------------------------------------------------------------------------------- /.kokoro/firebase/functions-samples.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/firebase/build-node.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/functions-samples" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_NODE_REGEX" 12 | value: "/firebase.*/" 13 | } 14 | 15 | env_vars: { 16 | key: "DPEBOT_BRANCH_BASE" 17 | value: "main" 18 | } 19 | -------------------------------------------------------------------------------- /.kokoro/firebase/mlkit-material-android.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-android.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/mlkit-material-android" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/firebase/mlkit-material-ios.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-ios.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/mlkit-material-ios" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/firebase/quickstart-android.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-android.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/quickstart-android" 8 | } -------------------------------------------------------------------------------- /.kokoro/firebase/quickstart-flutter.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-flutter.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/quickstart-flutter" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_BRANCH_BASE" 12 | value: "main" 13 | } 14 | -------------------------------------------------------------------------------- /.kokoro/firebase/quickstart-ios.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-ios.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/quickstart-ios" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_BRANCH_BASE" 12 | value: "main" 13 | } 14 | -------------------------------------------------------------------------------- /.kokoro/firebase/quickstart-js-html.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/firebase/build-html.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/quickstart-js" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_BRANCH_HEAD" 12 | value: "dpebot-repositorygardener-html" 13 | } 14 | -------------------------------------------------------------------------------- /.kokoro/firebase/quickstart-js-node.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/firebase/build-node.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/quickstart-js" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_NODE_REGEX" 12 | value: "/firebase.*/" 13 | } -------------------------------------------------------------------------------- /.kokoro/firebase/quickstart-nodejs.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/firebase/build-node.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/quickstart-nodejs" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_NODE_REGEX" 12 | value: "/firebase.*/" 13 | } 14 | -------------------------------------------------------------------------------- /.kokoro/firebase/quickstart-testing-html.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/firebase/build-html.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/quickstart-testing" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_BRANCH_HEAD" 12 | value: "dpebot-repositorygardener-html" 13 | } 14 | 15 | env_vars: { 16 | key: "DPEBOT_GITHUB_LABEL" 17 | value: "automerge" 18 | } 19 | -------------------------------------------------------------------------------- /.kokoro/firebase/quickstart-testing-node.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/firebase/build-node.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/quickstart-testing" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_NODE_REGEX" 12 | value: "/firebase.*/" 13 | } 14 | 15 | env_vars: { 16 | key: "DPEBOT_GITHUB_LABEL" 17 | value: "automerge" 18 | } 19 | -------------------------------------------------------------------------------- /.kokoro/firebase/snippets-android.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-android.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/snippets-android" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_GITHUB_LABEL" 12 | value: "automerge" 13 | } 14 | 15 | env_vars: { 16 | key: "DPEBOT_GITHUB_LABEL" 17 | value: "automerge" 18 | } 19 | -------------------------------------------------------------------------------- /.kokoro/firebase/snippets-ios.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-ios.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/snippets-ios" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_GITHUB_LABEL" 12 | value: "automerge" 13 | } 14 | -------------------------------------------------------------------------------- /.kokoro/firebase/snippets-node.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/firebase/build-node.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/snippets-node" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_NODE_REGEX" 12 | value: "/firebase.*/" 13 | } 14 | 15 | env_vars: { 16 | key: "DPEBOT_GITHUB_LABEL" 17 | value: "automerge" 18 | } 19 | -------------------------------------------------------------------------------- /.kokoro/firebase/snippets-web-html.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/firebase/build-html.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/snippets-web" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_BRANCH_HEAD" 12 | value: "dpebot-repositorygardener-html" 13 | } 14 | 15 | env_vars: { 16 | key: "DPEBOT_GITHUB_LABEL" 17 | value: "automerge" 18 | } 19 | 20 | # Pin everything that uses Firebase 8 21 | # https://github.com/firebase/snippets-web/pull/231#issuecomment-909010451 22 | env_vars: { 23 | key: "DPEBOT_FILE_INCLUDE_PATTERN" 24 | value: "*-next/*" 25 | } 26 | 27 | 28 | -------------------------------------------------------------------------------- /.kokoro/firebase/snippets-web-node.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/firebase/build-node.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "firebase/snippets-web" 8 | } 9 | 10 | env_vars: { 11 | key: "DPEBOT_NODE_REGEX" 12 | value: "/firebase.*/" 13 | } 14 | 15 | env_vars: { 16 | key: "DPEBOT_GITHUB_LABEL" 17 | value: "automerge" 18 | } 19 | 20 | # Pin everything that uses Firebase 8 21 | # https://github.com/firebase/snippets-web/pull/231#issuecomment-909010451 22 | env_vars: { 23 | key: "DPEBOT_FILE_INCLUDE_PATTERN" 24 | value: "*-next/*" 25 | } 26 | -------------------------------------------------------------------------------- /.kokoro/getting-started-php.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} 4 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 5 | 6 | # All builds use the trampoline script to run in docker. 7 | build_file: "repository-gardener/.kokoro/trampoline.sh" 8 | 9 | # PHP 7.3 Docker image 10 | env_vars: { 11 | key: "TRAMPOLINE_IMAGE" 12 | value: "gcr.io/cloud-devrel-kokoro-resources/php73" 13 | } 14 | 15 | # Configure the docker image for kokoro-trampoline. 16 | env_vars: { 17 | key: "TRAMPOLINE_BUILD_FILE" 18 | value: "github/repository-gardener/.kokoro/build-php.sh" 19 | } 20 | env_vars: { 21 | key: "DPEBOT_REPO" 22 | value: "GoogleCloudPlatform/getting-started-php" 23 | } 24 | -------------------------------------------------------------------------------- /.kokoro/getting-started-python.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-python.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "GoogleCloudPlatform/getting-started-python" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/java-repo-tools.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-java.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "GoogleCloudPlatform/java-repo-tools" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/php-docs-samples.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | # Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} 4 | gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" 5 | 6 | # All builds use the trampoline script to run in docker. 7 | build_file: "repository-gardener/.kokoro/trampoline.sh" 8 | 9 | # PHP 7.3 Docker image 10 | env_vars: { 11 | key: "TRAMPOLINE_IMAGE" 12 | value: "gcr.io/cloud-devrel-kokoro-resources/php73" 13 | } 14 | 15 | # Configure the docker image for kokoro-trampoline. 16 | env_vars: { 17 | key: "TRAMPOLINE_BUILD_FILE" 18 | value: "github/repository-gardener/.kokoro/build-php.sh" 19 | } 20 | env_vars: { 21 | key: "DPEBOT_REPO" 22 | value: "GoogleCloudPlatform/php-docs-samples" 23 | } 24 | 25 | env_vars: { 26 | key: "DPEBOT_BRANCH_BASE" 27 | value: "main" 28 | } -------------------------------------------------------------------------------- /.kokoro/python-docs-samples.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-python.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "GoogleCloudPlatform/python-docs-samples" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/python-runtime.cfg: -------------------------------------------------------------------------------- 1 | # Format: //devtools/kokoro/config/proto/build.proto 2 | 3 | build_file: "repository-gardener/.kokoro/build-python.sh" 4 | 5 | env_vars: { 6 | key: "DPEBOT_REPO" 7 | value: "GoogleCloudPlatform/python-runtime" 8 | } 9 | -------------------------------------------------------------------------------- /.kokoro/trampoline.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2019 Google Inc. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to become a contributor and submit your own code 2 | 3 | Use [shellcheck](https://github.com/koalaman/shellcheck) to lint changes to this repository. 4 | 5 | ## Contributor License Agreements 6 | 7 | We'd love to accept your sample apps and patches! Before we can take them, we 8 | have to jump a couple of legal hurdles. 9 | 10 | Please fill out either the individual or corporate Contributor License Agreement 11 | (CLA). 12 | 13 | * If you are an individual writing original source code and you're sure you 14 | own the intellectual property, then you'll need to sign an [individual 15 | CLA](https://developers.google.com/open-source/cla/individual). 16 | * If you work for a company that wants to allow you to contribute your work, 17 | then you'll need to sign a [corporate 18 | CLA](https://developers.google.com/open-source/cla/corporate). 19 | 20 | Follow either of the two links above to access the appropriate CLA and 21 | instructions for how to sign and return it. Once we receive it, we'll be able to 22 | accept your pull requests. 23 | 24 | ## Contributing A Patch 25 | 26 | 1. Submit an issue describing your proposed change to the repo in question. 27 | 1. The repo owner will respond to your issue promptly. 28 | 1. If your proposed change is accepted, and you haven't already done so, sign a 29 | Contributor License Agreement (see details above). 30 | 1. Fork the desired repo, develop and test your code changes. 31 | 1. Ensure that your code adheres to the existing style in the sample to which 32 | you are contributing. Refer to the 33 | [Google Cloud Platform Samples Style 34 | Guide](https://github.com/GoogleCloudPlatform/Template/wiki/style.html) for the 35 | recommended coding standards for this organization. 36 | 1. Ensure that your code has an appropriate set of unit tests which all pass. 37 | 1. Submit a pull request. 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Repository Gardener 2 | 3 | [![Actions Status][gh-actions-badge]][gh-actions] 4 | 5 | The repository gardener maintains code samples by running some automatable 6 | tasks. For example, it can automatically update dependencies and then after 7 | running tests to ensure they still work, send a Pull Request for the update. 8 | 9 | ## Example 10 | 11 | The following commands will clone the dotnet-docs-samples repository and update 12 | its dependencies to the latest versions. 13 | 14 | ```shell 15 | source set-env.sh \ 16 | && git clone https://github.com/GoogleCloudPlatform/dotnet-repo-tools.git 17 | && ./clone-and-checkout.sh -b dpebot-updatedeps GoogleCloudPlatform/dotnet-docs-samples \ 18 | && ( \ 19 | cd repo-to-update \ 20 | && ../use-latest-deps-dotnet.sh -d GoogleCloudPlatform/dotnet-docs-samples 21 | ) 22 | ``` 23 | 24 | The `-d` option in `use-latest-deps-dotnet.sh` is to do a dry run (don't commit 25 | or push). Remove `-d` to actually push and send PR. 26 | 27 | ## Contributing changes 28 | 29 | * See [CONTRIBUTING.md](CONTRIBUTING.md) 30 | 31 | ## Licensing 32 | 33 | * See [LICENSE](LICENSE) 34 | 35 | ## Disclaimer 36 | 37 | This is not an official Google product or sample. 38 | 39 | ## Adding the bot to your repository (Googlers only) 40 | 41 | A hosted version of the bot is [available](https://goto.google.com/dpebot) for Googlers. 42 | 43 | [gh-actions]: https://github.com/GoogleCloudPlatform/repository-gardener/actions 44 | [gh-actions-badge]: https://github.com/GoogleCloudPlatform/repository-gardener/workflows/CI%20Tests/badge.svg 45 | -------------------------------------------------------------------------------- /check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2016 Google Inc. All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -e 17 | set -x 18 | shopt -s globstar 19 | 20 | # Check that all shell scripts in this repo (including this one) pass the 21 | # Shell Check linter. 22 | shellcheck ./**/*.sh 23 | -------------------------------------------------------------------------------- /clone-and-checkout.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2016 Google Inc. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | print_usage() { 18 | (>&2 echo "Usage:") 19 | (>&2 echo " $0 [-b branch-name] github-user/repository") 20 | } 21 | 22 | # If the DPEBOT_BRANCH_HEAD is not set, use dpebot-repositorygardener 23 | BRANCH=${DPEBOT_BRANCH_HEAD:-dpebot-repositorygardener} 24 | 25 | # Check for optional arguments. 26 | while getopts :b: opt; do 27 | case $opt in 28 | b) 29 | BRANCH=$OPTARG 30 | ;; 31 | \?) 32 | (>&2 echo "Got invalid option -$OPTARG.") 33 | print_usage 34 | exit 1 35 | ;; 36 | esac 37 | done 38 | shift $((OPTIND-1)) 39 | 40 | 41 | # Check that positional arguments are set. 42 | if [[ -z $1 ]] ; then 43 | (>&2 echo "Missing repo argument.") 44 | print_usage 45 | exit 1 46 | fi 47 | if [[ "$1" != *"/"* ]] ; then 48 | (>&2 echo "Repo argument needs to be of form username/repo-name.") 49 | print_usage 50 | exit 1 51 | fi 52 | REPO=$1 53 | 54 | 55 | # Check that environment variables are set. 56 | if [[ -z ${DPEBOT_GIT_USER_NAME} ]] ; then 57 | (>&2 echo "DPEBOT_GIT_USER_NAME environment variable must be set.") 58 | exit 1 59 | fi 60 | 61 | if [[ -z ${DPEBOT_GIT_USER_EMAIL} ]] ; then 62 | (>&2 echo "DPEBOT_GIT_USER_EMAIL environment variable must be set.") 63 | exit 1 64 | fi 65 | 66 | if [[ -z ${DPEBOT_GITHUB_TOKEN} ]] ; then 67 | (>&2 echo "DPEBOT_GITHUB_TOKEN environment variable must be set.") 68 | exit 1 69 | fi 70 | 71 | # If the DPEBOT_BRANCH_BASE is not set, use master 72 | BASE_BRANCH=${DPEBOT_BRANCH_BASE:-master} 73 | 74 | git clone "https://dpebot:${DPEBOT_GITHUB_TOKEN}@github.com/${REPO}.git" repo-to-update 75 | ( 76 | cd repo-to-update || exit 1 77 | git config user.name "${DPEBOT_GIT_USER_NAME}" 78 | git config user.email "${DPEBOT_GIT_USER_EMAIL}" 79 | 80 | git branch "$BRANCH" "origin/$BASE_BRANCH" 81 | git checkout "$BRANCH" 82 | ) 83 | 84 | -------------------------------------------------------------------------------- /commit-and-push.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2016 Google Inc. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # Get the current branch name. 18 | # http://stackoverflow.com/a/19585361/101923 19 | BRANCH=$(git symbolic-ref --short HEAD) 20 | 21 | git commit -a -m "Auto-update dependencies." 22 | git push --force-with-lease origin "$BRANCH" 23 | 24 | -------------------------------------------------------------------------------- /fix_android_dependencies.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import re 4 | 5 | # These will have to be updated manually over time, there's not an 6 | # easy way to determine the latest version. 7 | COMPILE_SDK_VERSION = 36 8 | TARGET_SDK_VERSION = 36 9 | BUILD_TOOLS_VERSION = '36.0.0' 10 | 11 | # build.gradle(.kts) files 12 | COMPILE_SDK_RE = r'compileSdk(?:Version)?\s*=?\s*[\w]+' 13 | TARGET_SDK_RE = r'targetSdk(?:Version)?\s*=?\s*[\w]+' 14 | BUILD_TOOLS_RE = r'buildTools(?:Version)?\s*=?\s*[\'\"\w\.]+' 15 | 16 | # *.versions.toml files 17 | VERSION_RE = r'(.*)\s*=\s*"(.*)"' 18 | DEPENDENCY_RE = r'(group|module|name|version|version.ref|id)\s*=' 19 | 20 | # Depends on https://github.com/ben-manes/gradle-versions-plugin 21 | # 22 | # Must run this command: 23 | # $ ./gradlew dependencyUpdates -Drevision=release -DoutputFormatter=json 24 | RELATIVE_PATH_TO_JSON_REPORT = 'build/dependencyUpdates/report.json' 25 | # Default Gradle Version Catalog location 26 | RELATIVE_PATH_TO_TOML = 'gradle/libs.versions.toml' 27 | 28 | 29 | def find_configuration_files(): 30 | """Finds all build configuration files, recursively.""" 31 | gradle_files = [] 32 | for root, dirs, files in os.walk('.'): 33 | for filename in files: 34 | if filename.endswith(('build.gradle', 'build.gradle.kts', 'versions.toml')): 35 | gradle_files.append(os.path.join(root, filename)) 36 | 37 | return gradle_files 38 | 39 | 40 | def get_android_replacements(): 41 | """Gets a dictionary of all android-specific replacements to be made.""" 42 | replacements = {} 43 | 44 | compile_sdk = f"compileSdk = {COMPILE_SDK_VERSION}" 45 | target_sdk = f"targetSdk = {TARGET_SDK_VERSION}" 46 | build_tools_version = f"buildToolsVersion = \"{BUILD_TOOLS_VERSION}\"" 47 | 48 | replacements[COMPILE_SDK_RE] = compile_sdk 49 | replacements[TARGET_SDK_RE] = target_sdk 50 | replacements[BUILD_TOOLS_RE] = build_tools_version 51 | 52 | return replacements 53 | 54 | 55 | def is_major_update(old_version, new_version): 56 | """Compares version strings to see if it's a major update.""" 57 | old_major = old_version.split('.')[0] 58 | new_major = new_version.split('.')[0] 59 | 60 | return old_major != new_major 61 | 62 | 63 | def get_dep_replacements(json_file, toml_deps): 64 | """Gets a dictionary of all dependency replacements to be made.""" 65 | replacements = {} 66 | with open(json_file, 'r') as f: 67 | json_data = json.loads(f.read()) 68 | 69 | outdated_deps = json_data['outdated']['dependencies'] 70 | for dep in outdated_deps: 71 | group = dep['group'] 72 | name = dep['name'] 73 | 74 | curr_version = dep['version'] 75 | new_version = dep['available']['release'] 76 | 77 | # For dependencies and classhpaths 78 | curr_dep = f"{group}:{name}:{curr_version}" 79 | new_dep = f"{group}:{name}:{new_version}" 80 | replacements[curr_dep] = new_dep 81 | 82 | # For the plugins block in .kts files 83 | curr_plugin = f'\("{group}"\) version "{curr_version}"' 84 | new_plugin = f'("{group}") version "{new_version}"' 85 | replacements[curr_plugin] = new_plugin 86 | 87 | # For the TOML dependencies 88 | module = group + ':' + name 89 | if module not in toml_deps: 90 | continue 91 | curr_dep = toml_deps[module] 92 | if 'original_line' in curr_dep: 93 | original_line = curr_dep['original_line'] 94 | new_line = original_line.replace(curr_version, new_version) 95 | replacements[original_line] = new_line 96 | 97 | return replacements 98 | 99 | 100 | def update_project(project_path, toml_path): 101 | """Runs through all build configuration files and performs replacements for individual android project.""" 102 | replacements = {} 103 | replacements.update(get_android_replacements()) 104 | # Open the Gradle Version Catalog file and fetch its dependencies 105 | toml_dependencies = get_toml_dependencies(toml_path) 106 | replacements.update(get_dep_replacements(project_path, toml_dependencies)) 107 | 108 | # Print all updates found 109 | print("Dependency updates:") 110 | for (k, v) in iter(replacements.items()): 111 | print(f"{k} --> {v}") 112 | 113 | # Iterate through each file and replace it 114 | for config_file in find_configuration_files(): 115 | print(f"Updating dependencies for: {config_file}") 116 | 117 | new_data = '' 118 | with open(config_file, 'r') as f: 119 | # Perform each replacement 120 | new_data = f.read() 121 | for (k, v) in iter(replacements.items()): 122 | new_data = re.sub(k, v, new_data) 123 | 124 | # Write the file 125 | with open(config_file, 'w') as f: 126 | f.write(new_data) 127 | 128 | 129 | def update_all(): 130 | """Runs through all build configuration files and performs replacements.""" 131 | 132 | project_root = os.getcwd() 133 | print(f"Repo root: {project_root}") 134 | 135 | top_level_report = os.path.join(project_root, RELATIVE_PATH_TO_JSON_REPORT) 136 | toml_path = os.path.join(project_root, RELATIVE_PATH_TO_TOML) 137 | 138 | if os.path.exists(top_level_report): 139 | print("Update dependencies via top-level report") 140 | update_project(top_level_report, toml_path) 141 | else: 142 | print("Update dependencies via child-level report(s)") 143 | first_level_subdirectories = get_immediate_subdirectories(project_root) 144 | print(f"List of subdirectories: {first_level_subdirectories}") 145 | 146 | for subdirectory in first_level_subdirectories: 147 | print(f"subdirectory: {subdirectory}") 148 | subdirectory_report = os.path.join(project_root, subdirectory, RELATIVE_PATH_TO_JSON_REPORT) 149 | toml_path = os.path.join(project_root, subdirectory, RELATIVE_PATH_TO_TOML) 150 | 151 | if os.path.exists(subdirectory_report): 152 | print("\tUpdate dependencies in subdirectory") 153 | update_project(subdirectory_report, toml_path) 154 | else: 155 | print("\tNo report in subdirectory") 156 | 157 | 158 | def get_toml_dependency(line, versions): 159 | original_line = line 160 | # skip dependencies that don't specify a version 161 | if 'version' not in line: 162 | return {} 163 | # Turn it into a valid JSON 164 | line = re.sub(DEPENDENCY_RE, r'"\1" =', line) 165 | value = line.split("=", 1)[1].replace("=", ":") 166 | dep_json = json.loads(value) 167 | # unspecified version means it's an internal dependency 168 | # we can skip version bumps for those 169 | if 'version' in dep_json and dep_json['version'] == 'unspecified': 170 | return {} 171 | # Fill in the group and name 172 | if 'module' in dep_json: 173 | module = dep_json.pop('module') 174 | [group, name] = module.split(':') 175 | dep_json.update({'group': group, 'name': name}) 176 | if 'id' in dep_json: 177 | # 'id' indicates this is a plugin 178 | dep_json['group'] = dep_json.pop('id') 179 | dep_json['name'] = dep_json['group'] + '.gradle.plugin' 180 | 181 | # Fill in the current version 182 | if 'version.ref' in dep_json: 183 | dep_json['original_line'] = versions[dep_json.pop('version.ref')]['original_line'] 184 | # if the version is inlined 185 | if 'version' in dep_json: 186 | dep_json['original_line'] = original_line 187 | key = dep_json.pop('group') + ':' + dep_json.pop('name') 188 | return {key: dep_json} 189 | 190 | 191 | def get_toml_dependencies(toml_file): 192 | """Gets a dictionary of all TOML dependencies.""" 193 | # This code assumes the [versions] block will always be first 194 | # True = read [versions] block; False = read [libraries] or [plugins] block 195 | reading_versions = True 196 | versions = {} 197 | deps = {} 198 | try: 199 | with open(toml_file, 'r') as f: 200 | lines = f.readlines() 201 | for line in lines: 202 | # skip empty lines or comments 203 | if line.strip() == '' or line.startswith("#"): 204 | continue 205 | if '[versions]' in line: 206 | reading_versions = True 207 | continue 208 | if '[libraries]' in line or '[plugins]' in line: 209 | reading_versions = False 210 | continue 211 | # Versions 212 | if reading_versions: 213 | version_match = re.search(VERSION_RE, line) 214 | if version_match: 215 | key = version_match.group(1).strip() 216 | value = version_match.group(2) 217 | versions[key] = {'curr_version': value, 'original_line': line} 218 | # Libraries and Plugins 219 | else: 220 | deps.update(get_toml_dependency(line, versions)) 221 | except FileNotFoundError: 222 | print('This project does not contain a ' + RELATIVE_PATH_TO_TOML + ' file.') 223 | return deps 224 | 225 | 226 | def get_immediate_subdirectories(directory): 227 | return [name for name in os.listdir(directory) 228 | if os.path.isdir(os.path.join(directory, name)) and not name.startswith('.')] 229 | 230 | 231 | if __name__ == '__main__': 232 | update_all() 233 | -------------------------------------------------------------------------------- /java-versions-rules.xml: -------------------------------------------------------------------------------- 1 | 16 | 19 | 20 | 21 | .*-b[0-9]* 22 | .*-pre.* 23 | .*public_draft 24 | .*-rc(-)?[0-9]* 25 | .*jre7 26 | .*jre6 27 | 28 | 29 | 30 | 31 | 33 | 34 | 35 | .* 36 | 37 | 38 | 39 | 42 | 43 | 44 | .* 45 | 46 | 47 | 48 | 49 | 50 | 51 | .* 52 | 53 | 54 | 55 | 56 | 57 | 58 | .* 59 | 60 | 61 | 62 | 63 | 64 | 65 | .* 66 | 67 | 68 | 69 | 70 | 71 | 72 | .* 73 | 74 | 75 | 76 | 78 | 79 | 80 | .* 81 | 82 | 83 | 84 | 85 | 86 | 87 | .* 88 | 89 | 90 | 91 | 92 | 93 | 94 | .* 95 | 96 | 97 | 98 | 99 | 100 | 101 | .* 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | .* 110 | 111 | 112 | 113 | 114 | 115 | 116 | v2.* 117 | 118 | 119 | 120 | 121 | 122 | 123 | .*-beta.* 124 | 125 | 126 | 127 | 128 | 129 | 130 | .*-beta.* 131 | 132 | 133 | 134 | 135 | 136 | 137 | .*-beta.* 138 | 139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /send-pr.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2016 Google Inc. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | print_usage() { 18 | (>&2 echo "Usage:") 19 | (>&2 echo " $0 github-user-or-org/repository") 20 | } 21 | 22 | if [[ -z $1 ]] ; then 23 | (>&2 echo "Missing repo argument.") 24 | print_usage 25 | exit 1 26 | fi 27 | if [[ "$1" != *"/"* ]] ; then 28 | (>&2 echo "Repo argument needs to be of form username/repo-name.") 29 | print_usage 30 | exit 1 31 | fi 32 | REPO=$1 33 | 34 | if [[ -z ${DPEBOT_GITHUB_TOKEN} ]] ; then 35 | (>&2 echo "DPEBOT_GITHUB_TOKEN environment variable must be set.") 36 | exit 1 37 | fi 38 | 39 | # Get jq for JSON parsing 40 | sudo apt-get install -y jq 41 | 42 | # If the DPEBOT_BRANCH_BASE is not set, use master 43 | BASE_BRANCH=${DPEBOT_BRANCH_BASE:-master} 44 | 45 | # Get the current branch name. 46 | # http://stackoverflow.com/a/19585361/101923 47 | BRANCH=$(git symbolic-ref --short HEAD) 48 | 49 | # Create the pull request 50 | PR_JSON=$(curl -u "dpebot:${DPEBOT_GITHUB_TOKEN}" \ 51 | -X POST \ 52 | -H "Content-Type: application/json" \ 53 | -d "{ 54 | \"title\": \"Auto-update dependencies.\", 55 | \"body\": \"Brought to you by your friendly [Repository Gardener](https://github.com/GoogleCloudPlatform/repository-gardener).\", 56 | \"head\": \"${BRANCH}\", 57 | \"base\": \"${BASE_BRANCH}\" }" \ 58 | "https://api.github.com/repos/${REPO}/pulls") 59 | 60 | # Label the pull request (if required) 61 | if [[ -n "${DPEBOT_GITHUB_LABEL}" ]] ; then 62 | PR_NUMBER=$(echo "${PR_JSON}" | jq .number) 63 | echo "Adding label ${DPEBOT_GITHUB_LABEL} to PR ${PR_NUMBER}" 64 | 65 | curl -u "dpebot:${DPEBOT_GITHUB_TOKEN}" \ 66 | -X POST \ 67 | -H "Content-Type: application/json" \ 68 | -d "{ 69 | \"labels\": [\"${DPEBOT_GITHUB_LABEL}\"] }" \ 70 | "https://api.github.com/repos/${REPO}/issues/${PR_NUMBER}/labels" 71 | fi 72 | -------------------------------------------------------------------------------- /set-env.template.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2016 Google Inc. All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | export DPEBOT_GIT_USER_NAME="DPE bot" 17 | export DPEBOT_GIT_USER_EMAIL="bot@example.com" 18 | export DPEBOT_GITHUB_TOKEN=your-token-here 19 | -------------------------------------------------------------------------------- /use-latest-deps-android.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2018 Google Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | print_usage () { 18 | (>&2 echo "Usage:") 19 | (>&2 echo " $0 [-d] github-user/repository-name") 20 | (>&2 echo "Arguments:") 21 | (>&2 echo " -d: do a dry-run. Don't push or send a PR.") 22 | } 23 | 24 | generate_dependencies_report () { 25 | variables_passed=$# 26 | 27 | if [ "${variables_passed}" -gt 0 ]; then 28 | dir=$1 29 | 30 | (>&2 echo "=========================================================================") 31 | (>&2 echo "Push sample path to run gradle command locally (NEW PATH, PREVIOUS PATH):") 32 | pushd "$dir" 33 | 34 | # Generate JSON dependencies report 35 | ./gradlew dependencyUpdates -Drevision=release -DoutputFormatter=json 36 | 37 | gradle_exit_code="$?" 38 | 39 | (>&2 echo "Pop sample path off stack, back to original path:") 40 | popd 41 | 42 | return $gradle_exit_code 43 | 44 | else 45 | # Return invalid arguments exit code. 46 | return 128 47 | fi 48 | } 49 | 50 | update_dependencies () { 51 | variables_passed=$# 52 | 53 | if [ "${variables_passed}" -gt 0 ]; then 54 | dir=$1 55 | 56 | # Activate a virtualenv 57 | virtualenv --python python3.8 env 58 | # shellcheck disable=SC1091 59 | source env/bin/activate 60 | 61 | # Run Android fixer script 62 | python3 "${dir}/fix_android_dependencies.py" 63 | 64 | # Remove the virtualenv 65 | rm -rf env 66 | 67 | return 0 68 | else 69 | # Return invalid arguments exit code. 70 | return 128 71 | fi 72 | } 73 | 74 | # Use the version of Java specified in the build config 75 | export JAVA_HOME=${KOKORO_GFILE_DIR} 76 | export PATH="$JAVA_HOME/bin:$PATH" 77 | 78 | # Check for optional arguments. 79 | DRYRUN=0 80 | while getopts :d opt; do 81 | case $opt in 82 | d) 83 | (>&2 echo "Entered dry-run mode.") 84 | DRYRUN=1 85 | ;; 86 | \?) 87 | (>&2 echo "Got invalid option -$OPTARG.") 88 | print_usage 89 | exit 1 90 | ;; 91 | esac 92 | done 93 | shift $((OPTIND-1)) 94 | 95 | 96 | # Check that positional arguments are set. 97 | if [[ -z $1 ]] ; then 98 | (>&2 echo "Missing repo argument.") 99 | print_usage 100 | exit 1 101 | fi 102 | if [[ "$1" != *"/"* ]] ; then 103 | (>&2 echo "Repo argument needs to be of form username/repo-name.") 104 | print_usage 105 | exit 1 106 | fi 107 | REPO=$1 108 | 109 | 110 | # Get this script's directory. 111 | # http://stackoverflow.com/a/246128/101923 112 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 113 | 114 | set +e 115 | set -x 116 | 117 | generate_dependencies_report "${DIR}/" 118 | generate_dependencies_report_exit_code="$?" 119 | 120 | # Gradle doesn't exist at root (127 means command not found), check all child folders for android/gradle projects. 121 | if [ $generate_dependencies_report_exit_code -eq 127 ]; then 122 | (>&2 echo "No Gradle at root of repo, go one level deeper for samples.") 123 | 124 | # Allows us to skip the loop if there aren't any folders. 125 | shopt -s nullglob 126 | 127 | # Generate list of folders in current directory. 128 | child_dirs=(*/) 129 | 130 | for child_dir in "${child_dirs[@]}" 131 | do 132 | generate_dependencies_report "${DIR}/${child_dir}" 133 | done 134 | fi 135 | 136 | set -e 137 | update_dependencies "${DIR}" 138 | 139 | # If there were any changes, test them and then push and send a PR. 140 | if ! git diff --quiet; then 141 | if [[ "$DRYRUN" -eq 0 ]] ; then 142 | set -e 143 | "${DIR}/commit-and-push.sh" 144 | "${DIR}/send-pr.sh" "$REPO" 145 | fi 146 | fi 147 | -------------------------------------------------------------------------------- /use-latest-deps-dotnet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright 2018 Google LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | print_usage () { 18 | (>&2 echo "Usage:") 19 | (>&2 echo " $0 [-d] github-user/repository-name") 20 | (>&2 echo "Arguments:") 21 | (>&2 echo " -d: do a dry-run. Don't push or send a PR.") 22 | } 23 | 24 | # Check for optional arguments. 25 | DRYRUN=0 26 | while getopts :d opt; do 27 | case $opt in 28 | d) 29 | (>&2 echo "Entered dry-run mode.") 30 | DRYRUN=1 31 | ;; 32 | \?) 33 | (>&2 echo "Got invalid option -$OPTARG.") 34 | print_usage 35 | exit 1 36 | ;; 37 | esac 38 | done 39 | shift $((OPTIND-1)) 40 | 41 | 42 | # Check that positional arguments are set. 43 | if [[ -z $1 ]] ; then 44 | (>&2 echo "Missing repo argument.") 45 | print_usage 46 | exit 1 47 | fi 48 | if [[ "$1" != *"/"* ]] ; then 49 | (>&2 echo "Repo argument needs to be of form username/repo-name.") 50 | print_usage 51 | exit 1 52 | fi 53 | REPO=$1 54 | 55 | # Get this script's directory. 56 | # http://stackoverflow.com/a/246128/101923 57 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 58 | 59 | set -x 60 | 61 | # Find list of all csproj files, then cycle through them updating version numbers. 62 | shopt -s globstar 63 | for i in **/*.csproj; do 64 | dotnet outdated "$i" -u --include "Google" 65 | dotnet outdated "$i" -u --include "Grpc" 66 | done 67 | 68 | 69 | # If there were any changes, test them and then push and send a PR. 70 | if ! git diff --quiet; then 71 | if [[ "$DRYRUN" -eq 0 ]] ; then 72 | set -e 73 | "${DIR}/commit-and-push.sh" 74 | "${DIR}/send-pr.sh" "$REPO" 75 | fi 76 | fi 77 | -------------------------------------------------------------------------------- /use-latest-deps-flutter.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2016 Google Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | print_usage () { 18 | (>&2 echo "Usage:") 19 | (>&2 echo " $0 [-d] github-user/repository-name") 20 | (>&2 echo "Arguments:") 21 | (>&2 echo " -d: do a dry-run. Don't push or send a PR.") 22 | } 23 | 24 | # Check for optional arguments. 25 | DRYRUN=0 26 | while getopts :d opt; do 27 | case $opt in 28 | d) 29 | (>&2 echo "Entered dry-run mode.") 30 | DRYRUN=1 31 | ;; 32 | \?) 33 | (>&2 echo "Got invalid option -$OPTARG.") 34 | print_usage 35 | exit 1 36 | ;; 37 | esac 38 | done 39 | shift $((OPTIND-1)) 40 | 41 | 42 | # Check that positional arguments are set. 43 | if [[ -z $1 ]] ; then 44 | (>&2 echo "Missing repo argument.") 45 | print_usage 46 | exit 1 47 | fi 48 | if [[ "$1" != *"/"* ]] ; then 49 | (>&2 echo "Repo argument needs to be of form username/repo-name.") 50 | print_usage 51 | exit 1 52 | fi 53 | REPO=$1 54 | 55 | 56 | # Get this script's directory. 57 | # http://stackoverflow.com/a/246128/101923 58 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 59 | 60 | ## Install Flutter 61 | git clone https://github.com/flutter/flutter.git --depth 1 -b stable "${DIR}/_flutter" 62 | PATH="${PATH}:${DIR}/_flutter/bin" 63 | 64 | set -e 65 | set -x 66 | 67 | # Find and update each pubspec.yml 68 | find . -iname pubspec.yaml -execdir flutter pub upgrade \; 69 | 70 | # If there were any changes, test them and then push and send a PR. 71 | set +e 72 | if ! git diff --quiet; then 73 | if [[ "$DRYRUN" -eq 0 ]] ; then 74 | set -e 75 | "${DIR}/commit-and-push.sh" 76 | "${DIR}/send-pr.sh" "$REPO" 77 | fi 78 | fi 79 | -------------------------------------------------------------------------------- /use-latest-deps-html.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Copyright 2016 Google Inc. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | print_usage () { 18 | (>&2 echo "This script replaces strings matching a given regex with a given string in all HTML files.") 19 | (>&2 echo "This is typically used to update JS dependencies included using a