Skip to content

Commit

Permalink
modify update script
Browse files Browse the repository at this point in the history
Signed-off-by: a3hadi <[email protected]>
  • Loading branch information
ayildirim21 committed Mar 6, 2024
1 parent 45a1df4 commit f774280
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 36 deletions.
14 changes: 0 additions & 14 deletions .github/scripts/traverse-examples.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/buid-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
username: ${{ env.QUAY_USERNAME }}
password: ${{ env.QUAY_PASSWORD }}
- name: Build and tag images
run: ./.github/scripts/traverse-examples.sh "make image"
run: ./update_examples --build
- name: Push images
env:
IMAGE_PREFIX: "quay.io/numaio/numaflow-go"
Expand Down
21 changes: 0 additions & 21 deletions update-sdk-version.sh

This file was deleted.

66 changes: 66 additions & 0 deletions update_examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

commit_sha=""

function show_help () {
echo "Usage: $0 [-h|--help] (-b|--build | -c|--commit-sha <commit_sha>)"
echo " -h, --help Display help message and exit"
echo " -b, --build Build the docker images of all the examples"
echo " -c, --commit-sha Update the numaflow-go version to the specified SHA"
}

function traverse_examples () {
find pkg -name "go.mod" | while read -r line;
do
dir="$(dirname "${line}")"
cd "$dir" || exit

for command in "$@"
do
if ! $command; then
echo "Error when running $command in $dir"
exit 1
fi
done

cd ~- || exit
done
}

handle_options() {
while [ $# -gt 0 ]; do
case "$1" in
-h | --help)
show_help
exit 0
;;
-b | --build)
traverse_examples "make clean"
;;
-c | --commit-sha)
if [ -z "$2" ]; then
echo "Commit SHA not specified." >&2
show_help
exit 1
fi

commit_sha=$2
traverse_examples "go get github.com/numaproj/numaflow-go@$commit_sha" "go mod tidy"
shift
;;
*)
echo "Invalid option: $1" >&2
show_help
exit 1
;;
esac
shift
done
}

echo "$#"
handle_options "$@"

if [ -n "$commit_sha" ]; then
echo "Commit SHA specified: $commit_sha"
fi

0 comments on commit f774280

Please sign in to comment.