diff --git a/pkg/mapper/examples/even_odd/Makefile b/pkg/mapper/examples/even_odd/Makefile index 044a3713..048194ab 100644 --- a/pkg/mapper/examples/even_odd/Makefile +++ b/pkg/mapper/examples/even_odd/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/even-odd-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/map-even-odd:${TAG}" --platform linux/amd64,linux/arm64 --target even-odd . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/map-even-odd:${TAG}" --target even-odd . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/map-even-odd:${TAG}"; fi diff --git a/pkg/mapper/examples/flatmap/Makefile b/pkg/mapper/examples/flatmap/Makefile index 89991d19..c7cebf2c 100644 --- a/pkg/mapper/examples/flatmap/Makefile +++ b/pkg/mapper/examples/flatmap/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/flatmap-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/map-flatmap:${TAG}" --platform linux/amd64,linux/arm64 --target flatmap . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/map-flatmap:${TAG}" --target flatmap . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/map-flatmap:${TAG}"; fi diff --git a/pkg/mapper/examples/forward_message/Makefile b/pkg/mapper/examples/forward_message/Makefile index ee2e3894..8e82c0d0 100644 --- a/pkg/mapper/examples/forward_message/Makefile +++ b/pkg/mapper/examples/forward_message/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/forward-message-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/map-forward-message:${TAG}" --platform linux/amd64,linux/arm64 --target forward-message . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/map-forward-message:${TAG}" --target forward-message . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/map-forward-message:${TAG}"; fi diff --git a/pkg/mapper/examples/retry/Makefile b/pkg/mapper/examples/retry/Makefile index 805d6715..ab8a5a70 100644 --- a/pkg/mapper/examples/retry/Makefile +++ b/pkg/mapper/examples/retry/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/retry main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/map-retry:${TAG}" --platform linux/amd64,linux/arm64 --target retry . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/map-retry:${TAG}" --target map-retry . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/map-retry:${TAG}"; fi diff --git a/pkg/mapper/examples/tickgen/Makefile b/pkg/mapper/examples/tickgen/Makefile index 73fa9c06..78c78fbd 100644 --- a/pkg/mapper/examples/tickgen/Makefile +++ b/pkg/mapper/examples/tickgen/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/tickgen-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/map-tickgen:${TAG}" --platform linux/amd64,linux/arm64 --target tickgen . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/map-tickgen:${TAG}" --target tickgen . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/map-tickgen:${TAG}"; fi diff --git a/pkg/mapstreamer/examples/flatmap_stream/Makefile b/pkg/mapstreamer/examples/flatmap_stream/Makefile index 62ef0a3a..18945ac4 100644 --- a/pkg/mapstreamer/examples/flatmap_stream/Makefile +++ b/pkg/mapstreamer/examples/flatmap_stream/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/flatmap-stream-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/map-flatmap-stream:${TAG}" --platform linux/amd64,linux/arm64 --target flatmap_stream . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/map-flatmap-stream:${TAG}" --target flatmap_stream . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/map-flatmap-stream:${TAG}"; fi diff --git a/pkg/reducer/examples/counter/Makefile b/pkg/reducer/examples/counter/Makefile index 8475a91f..a30a6e61 100644 --- a/pkg/reducer/examples/counter/Makefile +++ b/pkg/reducer/examples/counter/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/counter-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/reduce-counter:${TAG}" --platform linux/amd64,linux/arm64 --target counter . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/reduce-counter:${TAG}" --target counter . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/reduce-counter:${TAG}"; fi diff --git a/pkg/reducer/examples/sum/Makefile b/pkg/reducer/examples/sum/Makefile index e298e097..5e8b01bc 100644 --- a/pkg/reducer/examples/sum/Makefile +++ b/pkg/reducer/examples/sum/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/sum-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/reduce-sum:${TAG}" --platform linux/amd64,linux/arm64 --target sum . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/reduce-sum:${TAG}" --target sum . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/reduce-sum:${TAG}"; fi diff --git a/pkg/reducestreamer/examples/counter/Makefile b/pkg/reducestreamer/examples/counter/Makefile index 865f725f..471e33c0 100644 --- a/pkg/reducestreamer/examples/counter/Makefile +++ b/pkg/reducestreamer/examples/counter/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/counter-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/reduce-stream-counter:${TAG}" --platform linux/amd64,linux/arm64 --target counter . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/reduce-stream-counter:${TAG}" --target counter . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/reduce-stream-counter:${TAG}"; fi diff --git a/pkg/reducestreamer/examples/sum/Makefile b/pkg/reducestreamer/examples/sum/Makefile index 6cb32d89..150e291b 100644 --- a/pkg/reducestreamer/examples/sum/Makefile +++ b/pkg/reducestreamer/examples/sum/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/sum-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/reduce-stream-sum:${TAG}" --platform linux/amd64,linux/arm64 --target sum . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/reduce-stream-sum:${TAG}" --target sum . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/reduce-stream-sum:${TAG}"; fi diff --git a/pkg/sessionreducer/examples/counter/Makefile b/pkg/sessionreducer/examples/counter/Makefile index 4d9ee60b..360b416c 100644 --- a/pkg/sessionreducer/examples/counter/Makefile +++ b/pkg/sessionreducer/examples/counter/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/counter-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/session-counter:${TAG}" --platform linux/amd64,linux/arm64 --target counter . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/session-counter:${TAG}" --target counter . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/session-counter:${TAG}"; fi diff --git a/pkg/sideinput/examples/simple-sideinput/Makefile b/pkg/sideinput/examples/simple-sideinput/Makefile index 746f1389..1f6173c9 100644 --- a/pkg/sideinput/examples/simple-sideinput/Makefile +++ b/pkg/sideinput/examples/simple-sideinput/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/sideinput-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/sideinput-example:${TAG}" --platform linux/amd64,linux/arm64 --target sideinput . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/sideinput-example:${TAG}" --target sideinput . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/sideinput-example:${TAG}"; fi diff --git a/pkg/sideinput/examples/simple-sideinput/udf/Makefile b/pkg/sideinput/examples/simple-sideinput/udf/Makefile index 43221ee6..22c3ba60 100644 --- a/pkg/sideinput/examples/simple-sideinput/udf/Makefile +++ b/pkg/sideinput/examples/simple-sideinput/udf/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/udf-sideinput-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/udf-sideinput-example:${TAG}" --platform linux/amd64,linux/arm64 --target udf-sideinput . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/udf-sideinput-example:${TAG}" --target udf-sideinput . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/udf-sideinput-example:${TAG}"; fi diff --git a/pkg/sinker/examples/log/Makefile b/pkg/sinker/examples/log/Makefile index 025a06a2..0850b8dc 100644 --- a/pkg/sinker/examples/log/Makefile +++ b/pkg/sinker/examples/log/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/log-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/sink-log:${TAG}" --platform linux/amd64,linux/arm64 --target log . --push .PHONY: image -test_image: build +imageimage: build docker build -t "quay.io/numaio/numaflow-go/sink-log:${TAG}" --target log . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/sink-log:${TAG}"; fi diff --git a/pkg/sourcer/examples/simple_source/Makefile b/pkg/sourcer/examples/simple_source/Makefile index 800bf256..47d803e5 100644 --- a/pkg/sourcer/examples/simple_source/Makefile +++ b/pkg/sourcer/examples/simple_source/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/simple-source-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/source-simple-source:${TAG}" --platform linux/amd64,linux/arm64 --target simple-source . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/source-simple-source:${TAG}" --target simple-source . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/source-simple-source:${TAG}"; fi diff --git a/pkg/sourcetransformer/examples/assign_event_time/Makefile b/pkg/sourcetransformer/examples/assign_event_time/Makefile index a86b96f8..969afea4 100644 --- a/pkg/sourcetransformer/examples/assign_event_time/Makefile +++ b/pkg/sourcetransformer/examples/assign_event_time/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/assign-event-time-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/mapt-assign-event-time:${TAG}" --platform linux/amd64,linux/arm64 --target assign-event-time . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/mapt-assign-event-time:${TAG}" --target assign-event-time . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/mapt-assign-event-time:${TAG}"; fi diff --git a/pkg/sourcetransformer/examples/event_time_filter/Makefile b/pkg/sourcetransformer/examples/event_time_filter/Makefile index 6356b058..b8e2c21f 100644 --- a/pkg/sourcetransformer/examples/event_time_filter/Makefile +++ b/pkg/sourcetransformer/examples/event_time_filter/Makefile @@ -6,11 +6,11 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o ./dist/event-time-filter-example main.go .PHONY: image-push -image: build +image-push: build docker buildx build -t "quay.io/numaio/numaflow-go/mapt-event-time-filter:${TAG}" --platform linux/amd64,linux/arm64 --target event-time-filter . --push .PHONY: image -test_image: build +image: build docker build -t "quay.io/numaio/numaflow-go/mapt-event-time-filter:${TAG}" --target event-time-filter . @if [ "$(PUSH)" = "true" ]; then docker push "quay.io/numaio/numaflow-go/mapt-event-time-filter:${TAG}"; fi diff --git a/update_examples.sh b/update_examples.sh index e4c6d147..044d388c 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 | -bpe|--build-push-example | -u|--update )" + echo "Usage: $0 [-h|--help | -t|--tag] (-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 " -bp, --build-push Build the Dockerfiles of all the examples and push them to the quay.io registry" + echo " -bpe, --build-push-example Build the Dockerfile of the given example directory path, and push it to the quay.io registry" + echo " -t, --tag To be optionally used with -bpe or -bp. Specify the tag to build with. Default tag: stable" echo " -u, --update Update all of the examples to depend on the numaflow-go version with the specified SHA or version" } @@ -36,8 +37,10 @@ usingHelp=0 usingBuildPush=0 usingBuildPushExample=0 usingVersion=0 +usingTag=0 version="" directoryPath="" +tag="stable" function handle_options () { while [ $# -gt 0 ]; do @@ -49,24 +52,35 @@ function handle_options () { usingBuildPush=1 ;; -bpe | --build-push-example) - usingBuildPushExample=1 if [ -z "$2" ]; then echo "Directory path not specified." >&2 show_help exit 1 fi + usingBuildPushExample=1 directoryPath=$2 shift ;; + -t | --tag) + if [ -z "$2" ]; then + echo "Tag not specified." >&2 + show_help + exit 1 + fi + + usingTag=1 + tag=$2 + shift + ;; -u | --update) - usingVersion=1 if [ -z "$2" ]; then echo "Commit SHA or version not specified." >&2 show_help exit 1 fi + usingVersion=1 version=$2 shift ;; @@ -96,11 +110,15 @@ if [ -n "$directoryPath" ]; then echo "Dockerfile path to use: $directoryPath" fi +if [ -n "$tag" ]; then + echo "Using tag: $tag" +fi + if (( usingBuildPush )); then - traverse_examples "make image-push" + traverse_examples "make image-push TAG=$tag" elif (( usingBuildPushExample )); then cd "./$directoryPath" || exit - if ! make image-push; then + if ! make image-push TAG="$tag"; then echo "Error: failed to run make image in $directoryPath" >&2 exit 1 fi