From 25a56624fbc88a2c876170346f4e32ae7bba32e4 Mon Sep 17 00:00:00 2001 From: Zike Yang Date: Tue, 30 May 2023 10:37:58 +0800 Subject: [PATCH 01/10] [fix][build] Fix the pulsar-all image may use the wrong upstream image Signed-off-by: Zike Yang --- docker/pulsar-all/Dockerfile | 4 ++-- docker/pulsar-all/pom.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/pulsar-all/Dockerfile b/docker/pulsar-all/Dockerfile index 42431fc94a067..5bed449036230 100644 --- a/docker/pulsar-all/Dockerfile +++ b/docker/pulsar-all/Dockerfile @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # - +ARG PULSAR_IMAGE FROM busybox as pulsar-all ARG PULSAR_IO_DIR @@ -26,6 +26,6 @@ ADD ${PULSAR_IO_DIR} /connectors ADD ${PULSAR_OFFLOADER_TARBALL} / RUN mv /apache-pulsar-offloaders-*/offloaders /offloaders -FROM apachepulsar/pulsar:latest +FROM $PULSAR_IMAGE COPY --from=pulsar-all /connectors /pulsar/connectors COPY --from=pulsar-all /offloaders /pulsar/offloaders diff --git a/docker/pulsar-all/pom.xml b/docker/pulsar-all/pom.xml index 7a2f492632135..9575a139ce76e 100644 --- a/docker/pulsar-all/pom.xml +++ b/docker/pulsar-all/pom.xml @@ -143,12 +143,12 @@ ${project.basedir} - latest ${project.version} target/apache-pulsar-io-connectors-${project.version}-bin target/pulsar-offloader-distribution-${project.version}-bin.tar.gz + ${docker.organization}/pulsar:${project.version} From bbb48be468062cb01ba22ab180e736ff61e5c665 Mon Sep 17 00:00:00 2001 From: Zike Yang Date: Tue, 30 May 2023 11:35:47 +0800 Subject: [PATCH 02/10] Fix license header issue Signed-off-by: Zike Yang --- docker/pulsar-all/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/pulsar-all/Dockerfile b/docker/pulsar-all/Dockerfile index 5bed449036230..81ad74b65000f 100644 --- a/docker/pulsar-all/Dockerfile +++ b/docker/pulsar-all/Dockerfile @@ -16,6 +16,7 @@ # specific language governing permissions and limitations # under the License. # + ARG PULSAR_IMAGE FROM busybox as pulsar-all From 1e101e2f97966e52da6d92bc152c63a6327f2d3a Mon Sep 17 00:00:00 2001 From: Zike Yang Date: Tue, 30 May 2023 18:50:44 +0800 Subject: [PATCH 03/10] Inject github commit id to the image tag Signed-off-by: Zike Yang --- docker/pulsar-all/pom.xml | 27 +++++++++++++++++++++++++-- docker/pulsar/pom.xml | 26 ++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/docker/pulsar-all/pom.xml b/docker/pulsar-all/pom.xml index 9575a139ce76e..de582bb153401 100644 --- a/docker/pulsar-all/pom.xml +++ b/docker/pulsar-all/pom.xml @@ -125,6 +125,29 @@ + + pl.project13.maven + git-commit-id-plugin + ${git-commit-id-plugin.version} + + + git-info + + revision + + + + + true + git + true + false + + false + false + + + io.fabric8 docker-maven-plugin @@ -143,12 +166,12 @@ ${project.basedir} - ${project.version} + ${project.version}-${git.commit.id.abbrev} target/apache-pulsar-io-connectors-${project.version}-bin target/pulsar-offloader-distribution-${project.version}-bin.tar.gz - ${docker.organization}/pulsar:${project.version} + ${docker.organization}/pulsar:${project.version}-${git.commit.id.abbrev} diff --git a/docker/pulsar/pom.xml b/docker/pulsar/pom.xml index e1c1503a3f381..8f6cea2c24185 100644 --- a/docker/pulsar/pom.xml +++ b/docker/pulsar/pom.xml @@ -57,6 +57,29 @@ docker + + pl.project13.maven + git-commit-id-plugin + ${git-commit-id-plugin.version} + + + git-info + + revision + + + + + true + git + true + false + + false + false + + + io.fabric8 docker-maven-plugin @@ -81,8 +104,7 @@ ${project.basedir} - latest - ${project.version} + ${project.version}-${git.commit.id.abbrev} From 46bbfff8447fcc08cef3c3f9a93c562be72ac1ee Mon Sep 17 00:00:00 2001 From: Zike Yang Date: Mon, 5 Jun 2023 09:20:41 +0000 Subject: [PATCH 04/10] Move plugin `git-commit-id-plugin` to root `pom.xml` --- docker/pulsar-all/pom.xml | 23 ----------------------- docker/pulsar/pom.xml | 23 ----------------------- pom.xml | 24 ++++++++++++++++++++++++ 3 files changed, 24 insertions(+), 46 deletions(-) diff --git a/docker/pulsar-all/pom.xml b/docker/pulsar-all/pom.xml index de582bb153401..afbd3dbb51845 100644 --- a/docker/pulsar-all/pom.xml +++ b/docker/pulsar-all/pom.xml @@ -125,29 +125,6 @@ - - pl.project13.maven - git-commit-id-plugin - ${git-commit-id-plugin.version} - - - git-info - - revision - - - - - true - git - true - false - - false - false - - - io.fabric8 docker-maven-plugin diff --git a/docker/pulsar/pom.xml b/docker/pulsar/pom.xml index 8f6cea2c24185..a11af6a3d21a2 100644 --- a/docker/pulsar/pom.xml +++ b/docker/pulsar/pom.xml @@ -57,29 +57,6 @@ docker - - pl.project13.maven - git-commit-id-plugin - ${git-commit-id-plugin.version} - - - git-info - - revision - - - - - true - git - true - false - - false - false - - - io.fabric8 docker-maven-plugin diff --git a/pom.xml b/pom.xml index 6cd0a4fc5b9b3..d58da58ca9c97 100644 --- a/pom.xml +++ b/pom.xml @@ -1571,6 +1571,30 @@ flexible messaging model and an intuitive client API. + + pl.project13.maven + git-commit-id-plugin + ${git-commit-id-plugin.version} + + + git-info + + revision + + + + + true + git + true + false + + false + false + + + + com.mycila license-maven-plugin From ed822f2fd7614e5aa2e43f5837cd3b26d3da9447 Mon Sep 17 00:00:00 2001 From: Zike Yang Date: Mon, 5 Jun 2023 09:49:16 +0000 Subject: [PATCH 05/10] Add `latest` tag back and skip `git-commit-id-plugin` on other modules --- docker/pulsar-all/pom.xml | 1 + docker/pulsar/pom.xml | 8 ++++++++ pom.xml | 1 + 3 files changed, 10 insertions(+) diff --git a/docker/pulsar-all/pom.xml b/docker/pulsar-all/pom.xml index afbd3dbb51845..7486e3d32f90c 100644 --- a/docker/pulsar-all/pom.xml +++ b/docker/pulsar-all/pom.xml @@ -143,6 +143,7 @@ ${project.basedir} + latest ${project.version}-${git.commit.id.abbrev} diff --git a/docker/pulsar/pom.xml b/docker/pulsar/pom.xml index a11af6a3d21a2..1c6d7e074ab48 100644 --- a/docker/pulsar/pom.xml +++ b/docker/pulsar/pom.xml @@ -57,6 +57,13 @@ docker + + pl.project13.maven + git-commit-id-plugin + + false + + io.fabric8 docker-maven-plugin @@ -81,6 +88,7 @@ ${project.basedir} + latest ${project.version}-${git.commit.id.abbrev} diff --git a/pom.xml b/pom.xml index d58da58ca9c97..ae334282fb6a4 100644 --- a/pom.xml +++ b/pom.xml @@ -1584,6 +1584,7 @@ flexible messaging model and an intuitive client API. + true true git true From dbea6423847765dd2c1613fdf9e54dd53a009625 Mon Sep 17 00:00:00 2001 From: Zike Yang Date: Mon, 5 Jun 2023 09:59:56 +0000 Subject: [PATCH 06/10] Enable building the image wihout git repo --- docker/pulsar-all/pom.xml | 4 ++++ docker/pulsar/pom.xml | 5 +++-- pom.xml | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docker/pulsar-all/pom.xml b/docker/pulsar-all/pom.xml index 7486e3d32f90c..8ddd1f74a6bb3 100644 --- a/docker/pulsar-all/pom.xml +++ b/docker/pulsar-all/pom.xml @@ -65,6 +65,10 @@ + + no-git + + docker diff --git a/docker/pulsar/pom.xml b/docker/pulsar/pom.xml index 1c6d7e074ab48..ea99f53064cba 100644 --- a/docker/pulsar/pom.xml +++ b/docker/pulsar/pom.xml @@ -48,8 +48,9 @@ - mirror://mirrors.ubuntu.com/mirrors.txt - http://security.ubuntu.com/ubuntu/ + mirror://mirrors.ubuntu.com/mirrors.txt + http://security.ubuntu.com/ubuntu/ + no-git diff --git a/pom.xml b/pom.xml index ae334282fb6a4..1df14582ad734 100644 --- a/pom.xml +++ b/pom.xml @@ -1587,7 +1587,7 @@ flexible messaging model and an intuitive client API. true true git - true + false false false From 645fd8fcde4b418459765903ea2f2f89c232a533 Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Tue, 6 Jun 2023 09:28:08 +0300 Subject: [PATCH 07/10] Enable git-commit-id-plugin in docker/pom.xml and move default property to top level --- docker/pom.xml | 14 ++++++++++++++ docker/pulsar-all/pom.xml | 15 +++++++++++---- docker/pulsar/pom.xml | 19 +++++++++++-------- pom.xml | 2 +- pulsar-common/pom.xml | 3 ++- 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/docker/pom.xml b/docker/pom.xml index 882240925ef24..afe55f0fe57f0 100644 --- a/docker/pom.xml +++ b/docker/pom.xml @@ -60,6 +60,20 @@ pulsar pulsar-all + + + + pl.project13.maven + git-commit-id-plugin + + false + true + true + false + + + + diff --git a/docker/pulsar-all/pom.xml b/docker/pulsar-all/pom.xml index 8ddd1f74a6bb3..e616ac132d319 100644 --- a/docker/pulsar-all/pom.xml +++ b/docker/pulsar-all/pom.xml @@ -65,11 +65,18 @@ - - no-git - - + + git-commit-id-no-git + + + ${basedir}/../../.git/index + + + + no-git + + docker diff --git a/docker/pulsar/pom.xml b/docker/pulsar/pom.xml index ea99f53064cba..85d86cff12523 100644 --- a/docker/pulsar/pom.xml +++ b/docker/pulsar/pom.xml @@ -50,21 +50,24 @@ mirror://mirrors.ubuntu.com/mirrors.txt http://security.ubuntu.com/ubuntu/ - no-git + + git-commit-id-no-git + + + ${basedir}/../../.git/index + + + + no-git + + docker - - pl.project13.maven - git-commit-id-plugin - - false - - io.fabric8 docker-maven-plugin diff --git a/pom.xml b/pom.xml index 1df14582ad734..7515aaf6863d1 100644 --- a/pom.xml +++ b/pom.xml @@ -286,7 +286,7 @@ flexible messaging model and an intuitive client API. 1.1.0 1.5.0 3.1.2 - 4.0.2 + 4.9.10 3.5.3 1.7.0 0.8.8 diff --git a/pulsar-common/pom.xml b/pulsar-common/pom.xml index a7d4dcf6beeca..cfc9cba7ede7f 100644 --- a/pulsar-common/pom.xml +++ b/pulsar-common/pom.xml @@ -194,7 +194,7 @@ provided true - + com.google.protobuf protobuf-java @@ -296,6 +296,7 @@ + false true git false From a713f7906d37f142dbcbc8117f9717d2f1e98642 Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Tue, 6 Jun 2023 11:21:23 +0300 Subject: [PATCH 08/10] Fix ROOT_DIR to work without git directory --- docker/build.sh | 3 +-- docker/get-version.sh | 2 +- docker/publish.sh | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index d8ab4bea882c4..6fb5e62429478 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -17,8 +17,7 @@ # specific language governing permissions and limitations # under the License. # - -ROOT_DIR=$(git rev-parse --show-toplevel) +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. >/dev/null 2>&1 && pwd )" cd $ROOT_DIR/docker mvn package -Pdocker,-main diff --git a/docker/get-version.sh b/docker/get-version.sh index 07145e7cf0c18..0b736baf3b270 100755 --- a/docker/get-version.sh +++ b/docker/get-version.sh @@ -18,7 +18,7 @@ # under the License. # -ROOT_DIR=$(git rev-parse --show-toplevel) +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. >/dev/null 2>&1 && pwd )" pushd $ROOT_DIR > /dev/null diff --git a/docker/publish.sh b/docker/publish.sh index 45b338d85f8ef..4836726ea99ae 100755 --- a/docker/publish.sh +++ b/docker/publish.sh @@ -18,7 +18,7 @@ # under the License. # -ROOT_DIR=$(git rev-parse --show-toplevel) +ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. >/dev/null 2>&1 && pwd )" cd $ROOT_DIR/docker # We should only publish images that are made from official and approved releases From d24058efe6cf884f5f0a11580dfca1ec14959fa0 Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Tue, 6 Jun 2023 11:29:05 +0300 Subject: [PATCH 09/10] Revisit publish script --- docker/publish.sh | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/docker/publish.sh b/docker/publish.sh index 4836726ea99ae..651fefc1498e9 100755 --- a/docker/publish.sh +++ b/docker/publish.sh @@ -49,6 +49,9 @@ fi MVN_VERSION=`./get-version.sh` echo "Pulsar version: ${MVN_VERSION}" +GIT_COMMIT_ID_ABBREV=$(git rev-parse --short=7 HEAD 2>/dev/null || echo no-git) +GIT_BRANCH=$(git branch --show-current 2>/dev/null || echo no-git) +IMAGE_TAG="${MVN_VERSION}-${GIT_COMMIT_ID_ABBREV}" if [[ -z ${DOCKER_REGISTRY} ]]; then docker_registry_org=${DOCKER_ORG} @@ -62,16 +65,21 @@ set -x # Fail if any of the subsequent commands fail set -e -docker tag apachepulsar/pulsar:latest ${docker_registry_org}/pulsar:latest -docker tag apachepulsar/pulsar-all:latest ${docker_registry_org}/pulsar-all:latest +if [[ "$GIT_BRANCH" == "master" ]]; then + docker tag apachepulsar/pulsar:${IMAGE_TAG} ${docker_registry_org}/pulsar:latest + docker tag apachepulsar/pulsar-all:${IMAGE_TAG} ${docker_registry_org}/pulsar-all:latest +fi -docker tag apachepulsar/pulsar:latest ${docker_registry_org}/pulsar:$MVN_VERSION -docker tag apachepulsar/pulsar-all:latest ${docker_registry_org}/pulsar-all:$MVN_VERSION +docker tag apachepulsar/pulsar:${IMAGE_TAG} ${docker_registry_org}/pulsar:$MVN_VERSION +docker tag apachepulsar/pulsar-all:${IMAGE_TAG} ${docker_registry_org}/pulsar-all:$MVN_VERSION # Push all images and tags -docker push ${docker_registry_org}/pulsar:latest -docker push ${docker_registry_org}/pulsar-all:latest +if [[ "$GIT_BRANCH" == "master" ]]; then + docker push ${docker_registry_org}/pulsar:latest + docker push ${docker_registry_org}/pulsar-all:latest +fi + docker push ${docker_registry_org}/pulsar:$MVN_VERSION docker push ${docker_registry_org}/pulsar-all:$MVN_VERSION -echo "Finished pushing images to ${docker_registry_org}" +echo "Finished pushing images to ${docker_registry_org}" \ No newline at end of file From f46db28ec31be5222cbfbd418ee78f60513b576f Mon Sep 17 00:00:00 2001 From: Lari Hotari Date: Tue, 6 Jun 2023 11:44:36 +0300 Subject: [PATCH 10/10] Fix license check issue --- docker/build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/build.sh b/docker/build.sh index 6fb5e62429478..88be44f23e73f 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -17,6 +17,7 @@ # specific language governing permissions and limitations # under the License. # + ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. >/dev/null 2>&1 && pwd )" cd $ROOT_DIR/docker