Skip to content

Instantly share code, notes, and snippets.

@bshaffer
Last active October 11, 2023 16:38
Show Gist options
  • Save bshaffer/ab2faa3933ff0c083ea3ae025583c6a8 to your computer and use it in GitHub Desktop.
Save bshaffer/ab2faa3933ff0c083ea3ae025583c6a8 to your computer and use it in GitHub Desktop.
#!/bin/bash
COMPONENT_NAME=""
if [ "$#" -eq 1 ]; then
COMPONENT_NAME=" -name $1 "
elif [ "$#" -ne 0 ]; then
echo "usage: generate-gapic-services.sh [COMPONENT]"
exit 1;
fi
### IMPORTANT ###
# The following variables must be changed for your environment:
# Path to your checked out copy of https://github.com/googleapis/google-cloud-php
GOOGLE_CLOUD_PHP=~/Code/google-cloud-php
# Path to the directory which contains the output of googleapis/googleapis
# This will be a checked-out copy of https://github.com/googleapis/googleapis-gen (private repo)
# For public protos. For private protos, you will need to run the bazel job in your
# workspace (something like third_party/googleapis/preview/...) and untar the files there.
GOOGLEAPIS_GEN=~/Code/googleapis-gen
#################
IMAGE="gcr.io/cloud-devrel-public-resources/owlbot-php:latest"
find $GOOGLE_CLOUD_PHP -mindepth 1 -maxdepth 1 -type d $COMPONENT_NAME -printf '%f\n' | grep '^[A-Z]' | sort | while read DIR
do
echo "Updating $DIR";
docker run --rm --user $(id -u):$(id -g) \
-v $GOOGLE_CLOUD_PHP:/repo -v $GOOGLEAPIS_GEN:/googleapis-gen -w /repo \
--env HOME=/tmp \
gcr.io/cloud-devrel-public-resources/owlbot-cli:latest copy-code \
--source-repo=/googleapis-gen \
--config-file=$DIR/.OwlBot.yaml
docker run --rm --user $(id -u):$(id -g) \
-v $GOOGLE_CLOUD_PHP:/repo \
-v $GOOGLEAPIS_GEN/bazel-bin:/bazel-bin \
gcr.io/cloud-devrel-public-resources/owlbot-cli:latest copy-bazel-bin \
--config-file=$DIR/.OwlBot.yaml \
--source-dir /bazel-bin --dest /repo
done
echo "Run owlbot post processing for $DIR"
docker pull $IMAGE
docker run --user $(id -u):$(id -g) --rm -v $(pwd):/repo -w /repo $IMAGE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment