Skip to content

feat(hermetic-build): allow custom api definitions dir in generation action #3788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/scripts/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ inputs:
showcase_mode:
description: true if we need to download the showcase api definitions
required: false
api_def_dir:
description: Path to api definitions (e.g. googleapis). Used when a custom set of protos is needed.
required: false
token:
description: Personal Access Token
required: true
Expand Down Expand Up @@ -76,10 +79,12 @@ runs:
--target_branch "${BASE_REF}" \
--current_branch "${HEAD_REF}" \
--showcase_mode "${SHOWCASE_MODE}" \
--api_def_dir "${API_DEF_DIR}" \
--image_tag "${IMAGE_TAG}"
env:
BASE_REF: ${{ inputs.base_ref }}
HEAD_REF: ${{ inputs.head_ref }}
IMAGE_TAG: ${{ inputs.image_tag }}
SHOWCASE_MODE: ${{ inputs.showcase_mode }}
API_DEF_DIR: ${{ inputs.api_def_dir }}
GH_TOKEN: ${{ inputs.token }}
20 changes: 14 additions & 6 deletions .github/scripts/hermetic_library_generation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ case "${key}" in
showcase_mode="$2"
shift
;;
--api_def_dir)
api_def_dir="$2"
shift
;;
*)
echo "Invalid option: [$1]"
exit 1
Expand Down Expand Up @@ -92,12 +96,16 @@ git checkout "${current_branch}"
git show "${target_branch}":"${generation_config}" > "${baseline_generation_config}"

# download api definitions from googleapis repository
googleapis_commitish=$(grep googleapis_commitish "${generation_config}" | cut -d ":" -f 2 | xargs)
api_def_dir=$(mktemp -d)
git clone https://github.com/googleapis/googleapis.git "${api_def_dir}"
pushd "${api_def_dir}"
git checkout "${googleapis_commitish}"
popd
if [[ -z "${api_def_dir}" ]];then
googleapis_commitish=$(grep googleapis_commitish "${generation_config}" | cut -d ":" -f 2 | xargs)
api_def_dir=$(mktemp -d)
git clone https://github.com/googleapis/googleapis.git "${api_def_dir}"
pushd "${api_def_dir}"
git checkout "${googleapis_commitish}"
popd
else
ls "${api_def_dir}/google/cloud/vertexai/v1"
fi

# we also setup showcase
if [[ "${showcase_mode}" == "true" ]]; then
Expand Down
Loading