forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
filter_example_mirror.sh
executable file
·30 lines (23 loc) · 1.07 KB
/
filter_example_mirror.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
set -e
ENVOY_SRCDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/../" && pwd)
CHECKOUT_DIR=../envoy-filter-example
MAIN_BRANCH="refs/heads/main"
FILTER_EXAMPLE_MAIN_BRANCH="main"
if [[ "${AZP_BRANCH}" == "${MAIN_BRANCH}" ]]; then
echo "Cloning..."
git clone [email protected]:envoyproxy/envoy-filter-example "$CHECKOUT_DIR" -b "${FILTER_EXAMPLE_MAIN_BRANCH}"
git -C "$CHECKOUT_DIR" config user.name "envoy-filter-example(Azure Pipelines)"
git -C "$CHECKOUT_DIR" config user.email [email protected]
echo "Updating Submodule..."
# Update submodule to latest Envoy SHA
ENVOY_SHA=$(git rev-parse HEAD)
git -C "$CHECKOUT_DIR" submodule update --init
git -C "$CHECKOUT_DIR/envoy" checkout "$ENVOY_SHA"
echo "Updating Workspace file."
sed -e "s|{ENVOY_SRCDIR}|envoy|" "${ENVOY_SRCDIR}"/ci/WORKSPACE.filter.example > "${CHECKOUT_DIR}"/WORKSPACE
echo "Committing, and Pushing..."
git -C "$CHECKOUT_DIR" commit -a -m "Update Envoy submodule to $ENVOY_SHA"
git -C "$CHECKOUT_DIR" push origin "${FILTER_EXAMPLE_MAIN_BRANCH}"
echo "Done"
fi