diff --git a/.github/workflows/build-push.yaml b/.github/workflows/build-push.yaml index fca2df48..4e27832d 100644 --- a/.github/workflows/build-push.yaml +++ b/.github/workflows/build-push.yaml @@ -9,6 +9,19 @@ on: jobs: docker_publish: runs-on: ubuntu-latest + + strategy: + max-parallel: 6 + matrix: + dockerfile_path: [ + "pkg/mapper/examples/even_odd", "pkg/mapper/examples/flatmap", "pkg/mapper/examples/forward_message", + "pkg/mapper/examples/retry", "pkg/mapper/examples/tickgen", "pkg/mapstreamer/examples/flatmap_stream", + "pkg/reducer/examples/counter", "pkg/reducer/examples/sum", "pkg/reducestreamer/examples/counter", + "pkg/reducestreamer/examples/sum", "pkg/sessionreducer/examples/counter", "pkg/sideinput/examples/simple-sideinput/udf", + "pkg/sideinput/examples/simple-sideinput", "pkg/sinker/examples/log", "pkg/sourcer/examples/simple_source", + "pkg/sourcetransformer/examples/assign_event_time", "pkg/sourcetransformer/examples/event_time_filter" + ] + steps: - name: Check out repository uses: actions/checkout@v3 @@ -23,4 +36,4 @@ jobs: username: ${{ secrets.NUMAIO_USERNAME }} password: ${{ secrets.NUMAIO_PASSWORD }} - name: Build, tag, and push images - run: ./update_examples.sh --build-push + run: ./update_examples.sh --build-push-example ${{ matrix.dockerfile_path }} diff --git a/update_examples.sh b/update_examples.sh index 893bd68a..39df34f4 100755 --- a/update_examples.sh +++ b/update_examples.sh @@ -1,10 +1,11 @@ #!/bin/bash function show_help () { - echo "Usage: $0 [-h|--help] (-bp|--build-push | -u|--update )" - echo " -h, --help Display help message and exit" - echo " -bp, --build-push Build the docker images of all the examples and push them to the quay.io registry (with tag: stable)" - echo " -u, --update Update all of the examples to depend on the numaflow-go version with the specified SHA or version" + echo "Usage: $0 [-h|--help] (-bp|--build-push | -bpe|--build-push-example | -u|--update )" + echo " -h, --help Display help message and exit" + echo " -bp, --build-push Build the Dockerfiles of all the examples and push them to the quay.io registry (with tag: stable)" + echo " -bpe, --build-push-example Build the Dockerfile of the given example directory path, and push it to the quay.io registry (with tag: stable)" + echo " -u, --update Update all of the examples to depend on the numaflow-go version with the specified SHA or version" } function traverse_examples () { @@ -33,8 +34,10 @@ fi usingHelp=0 usingBuildPush=0 +usingBuildPushExample=0 usingVersion=0 version="" +directoryPath="" function handle_options () { while [ $# -gt 0 ]; do @@ -45,6 +48,17 @@ function handle_options () { -bp | --build-push) usingBuildPush=1 ;; + -bpe | --build-push-example) + usingBuildPushExample=1 + if [ -z "$2" ]; then + echo "Directory path not specified." >&2 + show_help + exit 1 + fi + + directoryPath=$2 + shift + ;; -u | --update) usingVersion=1 if [ -z "$2" ]; then @@ -68,8 +82,8 @@ function handle_options () { handle_options "$@" -if (( usingBuildPush + usingVersion + usingHelp > 1 )); then - echo "Only one of '-h', '-bp', '-u' is allowed at a time" >&2 +if (( usingBuildPush + usingBuildPushExample + usingVersion + usingHelp > 1 )); then + echo "Only one of '-h', '-bp', '-bpe, or, '-u' is allowed at a time" >&2 show_help exit 1 fi @@ -78,8 +92,15 @@ if [ -n "$version" ]; then echo "Will update to: $version" fi +if [ -n "$directoryPath" ]; then + echo "Dockerfile path to use: $directoryPath" +fi + if (( usingBuildPush )); then traverse_examples "make image" +elif (( usingBuildPushExample )); then + cd "./$directoryPath" || exit + make image elif (( usingVersion )); then traverse_examples "go get github.com/numaproj/numaflow-go@$version" "go mod tidy" elif (( usingHelp )); then