Skip to content

Commit

Permalink
add a connector sample (#541)
Browse files Browse the repository at this point in the history
* add a connector sample

* address comment
  • Loading branch information
freeznet authored Dec 5, 2022
1 parent 5cc1e8c commit 698546e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
8 changes: 4 additions & 4 deletions images/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,19 @@ KIND_PUSH=${KIND_PUSH:-false}
CI_TEST=${CI_TEST:-false}

echo "build runner base"
docker build -t ${RUNNER_BASE} images/pulsar-functions-base-runner --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --progress=plain
docker build --platform linux/amd64 -t ${RUNNER_BASE} images/pulsar-functions-base-runner --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --progress=plain
docker tag ${RUNNER_BASE} "${DOCKER_REPO}"/${RUNNER_BASE}:"${RUNNER_TAG}"

echo "build java runner"
docker build -t ${JAVA_RUNNER} images/pulsar-functions-java-runner --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --progress=plain
docker build --platform linux/amd64 -t ${JAVA_RUNNER} images/pulsar-functions-java-runner --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --progress=plain
docker tag ${JAVA_RUNNER} "${DOCKER_REPO}"/${JAVA_RUNNER}:"${RUNNER_TAG}"

echo "build python runner"
docker build -t ${PYTHON_RUNNER} images/pulsar-functions-python-runner --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --progress=plain
docker build --platform linux/amd64 -t ${PYTHON_RUNNER} images/pulsar-functions-python-runner --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --progress=plain
docker tag ${PYTHON_RUNNER} "${DOCKER_REPO}"/${PYTHON_RUNNER}:"${RUNNER_TAG}"

echo "build go runner"
docker build -t ${GO_RUNNER} images/pulsar-functions-go-runner --progress=plain # go runner is almost the same as runner base, so we no need to given build args for go runner
docker build --platform linux/amd64 -t ${GO_RUNNER} images/pulsar-functions-go-runner --progress=plain # go runner is almost the same as runner base, so we no need to given build args for go runner
docker tag ${GO_RUNNER} "${DOCKER_REPO}"/${GO_RUNNER}:"${RUNNER_TAG}"

if [ "$KIND_PUSH" = true ] ; then
Expand Down
2 changes: 1 addition & 1 deletion images/pulsar-functions-base-runner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RUN mkdir -p /pulsar/bin/ \

ARG PULSAR_IMAGE_TAG
ENV VERSION_TAG=${PULSAR_IMAGE_TAG}
RUN echo "VERSION_TAG=$(VERSION_TAG)" && \
RUN echo "VERSION_TAG=${VERSION_TAG}" && \
VERSION_MAJOR=$(echo $VERSION_TAG | cut -d. -f1) && \
VERSION_MINOR=$(echo $VERSION_TAG | cut -d. -f2) && \
VERSION_PATCH=$(echo $VERSION_TAG | cut -d. -f3) && \
Expand Down
14 changes: 10 additions & 4 deletions images/samples/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,32 @@
set -e

PULSAR_IMAGE_TAG=${PULSAR_IMAGE_TAG:-"2.7.1"}
PULSAR_IMAGE=${PULSAR_IMAGE:-"streamnative/pulsar-all"}
JAVA_RUNNER_IMAGE=${RUNNER_IMAGE:-"streamnative/pulsar-functions-java-runner"}
DOCKER_REPO=${DOCKER_REPO:-"streamnative"}
JAVA_SAMPLE="pulsar-functions-java-sample"
PYTHON_SAMPLE="pulsar-functions-python-sample"
GO_SAMPLE="pulsar-functions-go-sample"
CONNECTOR_ES_SAMPLE="pulsar-io-elasticsearch"
KIND_PUSH=${KIND_PUSH:-false}
CI_TEST=${CI_TEST:-false}


echo "build java sample"
docker build -t ${JAVA_SAMPLE} images/samples/java-function-samples --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG"
docker build --platform linux/amd64 -t ${JAVA_SAMPLE} images/samples/java-function-samples --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG"
docker tag ${JAVA_SAMPLE} "${DOCKER_REPO}"/${JAVA_SAMPLE}:"${PULSAR_IMAGE_TAG}"

echo "build python sample"
docker build -t ${PYTHON_SAMPLE} images/samples/python-function-samples --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG"
docker build --platform linux/amd64 -t ${PYTHON_SAMPLE} images/samples/python-function-samples --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG"
docker tag ${PYTHON_SAMPLE} "${DOCKER_REPO}"/${PYTHON_SAMPLE}:"${PULSAR_IMAGE_TAG}"

echo "build go sample"
docker build -t ${GO_SAMPLE} images/samples/go-function-samples --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG"
docker build --platform linux/amd64 -t ${GO_SAMPLE} images/samples/go-function-samples --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG"
docker tag ${GO_SAMPLE} "${DOCKER_REPO}"/${GO_SAMPLE}:"${PULSAR_IMAGE_TAG}"

echo "build connector sample"
docker build --platform linux/amd64 -t ${CONNECTOR_ES_SAMPLE} images/samples/pulsar-io-connector/pulsar-io-elasticsearch --build-arg PULSAR_IMAGE_TAG="$PULSAR_IMAGE_TAG" --build-arg PULSAR_IMAGE="$PULSAR_IMAGE" --build-arg RUNNER_IMAGE="$JAVA_RUNNER_IMAGE"
docker tag ${CONNECTOR_ES_SAMPLE} "${DOCKER_REPO}"/${CONNECTOR_ES_SAMPLE}:"${PULSAR_IMAGE_TAG}"

if [ "$KIND_PUSH" = true ] ; then
echo "push images to kind"
clusters=$(kind get clusters)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG PULSAR_IMAGE
ARG PULSAR_IMAGE_TAG
ARG RUNNER_IMAGE
FROM ${PULSAR_IMAGE}:${PULSAR_IMAGE_TAG} as pulsar-all
FROM ${RUNNER_IMAGE}:${PULSAR_IMAGE_TAG}
COPY --from=pulsar-all --chown=$UID:$GID /pulsar/connectors/pulsar-io-elastic-search*.nar /pulsar/connectors/

0 comments on commit 698546e

Please sign in to comment.