You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2022/01/26 08:09:50 UTC

[skywalking-java] branch main updated: Migrate base images to Temurin and add images for ARM (#97)

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git


The following commit(s) were added to refs/heads/main by this push:
     new 75cc77d  Migrate base images to Temurin and add images for ARM (#97)
75cc77d is described below

commit 75cc77de10fa59e695dce535d1b966bd00bd0a06
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Wed Jan 26 16:09:44 2022 +0800

    Migrate base images to Temurin and add images for ARM (#97)
---
 .github/workflows/publish-docker.yaml |  2 +-
 CHANGES.md                            |  1 +
 Dockerfile                            |  4 +--
 Makefile                              | 47 +++++++++++++++++------------------
 docs/en/contribution/compiling.md     |  2 +-
 test/e2e/base/base-compose.yml        |  4 +--
 test/e2e/base/consumer/Dockerfile     |  4 +--
 test/e2e/base/provider/Dockerfile     |  4 +--
 test/e2e/case/kafka/e2e.yaml          |  6 +----
 9 files changed, 35 insertions(+), 39 deletions(-)

diff --git a/.github/workflows/publish-docker.yaml b/.github/workflows/publish-docker.yaml
index d92d878..ad6cb92 100644
--- a/.github/workflows/publish-docker.yaml
+++ b/.github/workflows/publish-docker.yaml
@@ -60,7 +60,7 @@ jobs:
     timeout-minutes: 60
     strategy:
       matrix:
-        java-version: [ 8, 11, 12, 13, 14, 15, 16, 17 ]
+        java-version: [ 8, 11, 17 ]
     env:
       TAG: ${{ github.sha }}
     steps:
diff --git a/CHANGES.md b/CHANGES.md
index 8133a36..bda8d71 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -22,6 +22,7 @@ Release Notes.
 * Follow protocol grammar fix `GCPhrase -> GCPhase`.
 * Support ZGC GC time and count metric collect. (Require 9.0.0 OAP)
 * Support configuration for collecting redis parameters for jedis-2.x and redisson-3.x plugin.
+* Migrate base images to Temurin and add images for ARM.
 
 #### Documentation
 
diff --git a/Dockerfile b/Dockerfile
index bbedf37..d5cecf3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-ARG BASE_IMAGE='adoptopenjdk/openjdk8:alpine-jre'
+ARG BASE_IMAGE='eclipse-temurin:8-jre'
 
 ARG SKYWALKING_CLI_VERSION
 
@@ -24,7 +24,7 @@ FROM $BASE_IMAGE
 
 ARG DIST=skywalking-agent
 
-RUN apk add --no-cache openssl
+RUN apk add --no-cache openssl || true
 
 LABEL maintainer="kezhenxu94@apache.org"
 
diff --git a/Makefile b/Makefile
index b3b3ffc..c7e4eb8 100644
--- a/Makefile
+++ b/Makefile
@@ -34,35 +34,34 @@ dist: build
 
 # Docker build
 
-base.adopt := java8 java11 java12 java13 java14 java15 java16
-base.temurin := java17
-
-base.all := alpine $(base.adopt) $(base.temurin)
+base.all := alpine java8 java11 java17
 base.each = $(word 1, $@)
 
 base.image.alpine := alpine:3
-base.image.java8 := adoptopenjdk/openjdk8:alpine-jre
-base.image.java11 := adoptopenjdk/openjdk11:alpine-jre
-base.image.java12 := adoptopenjdk/openjdk12:alpine-jre
-base.image.java13 := adoptopenjdk/openjdk13:alpine-jre
-base.image.java14 := adoptopenjdk/openjdk14:alpine-jre
-base.image.java15 := adoptopenjdk/openjdk15:alpine-jre
-base.image.java16 := adoptopenjdk/openjdk16:alpine-jre
-base.image.java17 := eclipse-temurin:17-alpine
+base.image.java8 := eclipse-temurin:8-jre
+base.image.java11 := eclipse-temurin:11-jre
+base.image.java17 := eclipse-temurin:17-jre
+
+docker.%: PLATFORMS =
+docker.%: LOAD_OR_PUSH = --load
+docker.push.%: PLATFORMS = --platform linux/amd64,linux/arm64
+docker.push.%: LOAD_OR_PUSH = --push
 
 .PHONY: $(base.all)
 $(base.all:%=docker.%): BASE_IMAGE=$($(base.each:docker.%=base.image.%))
-$(base.all:%=docker.%): docker.%: skywalking-agent
-	docker build --no-cache --build-arg BASE_IMAGE=$(BASE_IMAGE) --build-arg DIST=$(AGENT_PACKAGE) --build-arg SKYWALKING_CLI_VERSION=$(CLI_VERSION) . -t $(HUB)/$(NAME):$(TAG)-$(base.each:docker.%=%)
+$(base.all:%=docker.%): FINAL_TAG=$(TAG)-$(base.each:docker.%=%)
+$(base.all:%=docker.push.%): BASE_IMAGE=$($(base.each:docker.push.%=base.image.%))
+$(base.all:%=docker.push.%): FINAL_TAG=$(TAG)-$(base.each:docker.push.%=%)
+$(base.all:%=docker.%) $(base.all:%=docker.push.%): skywalking-agent
+	docker buildx create --use --driver docker-container --name skywalking_main > /dev/null 2>&1 || true
+	docker buildx build $(PLATFORMS) $(LOAD_OR_PUSH) \
+        --no-cache \
+        --build-arg BASE_IMAGE=$(BASE_IMAGE) \
+        --build-arg DIST=$(AGENT_PACKAGE) \
+        --build-arg SKYWALKING_CLI_VERSION=$(CLI_VERSION) \
+        . -t $(HUB)/$(NAME):$(FINAL_TAG)
+	docker buildx rm skywalking_main || true
 
-.PHONY: docker
+.PHONY: docker docker.push
 docker: $(base.all:%=docker.%)
-
-# Docker push
-
-.PHONY: $(base.all:%=docker.push.%)
-$(base.all:%=docker.push.%): docker.push.%: docker.%
-	docker push $(HUB)/$(NAME):$(TAG)-$(base.each:docker.push.%=%)
-
-.PHONY: docker.push
-docker.push: $(base.all:%=docker.%)
+docker.push: $(base.all:%=docker.push.%)
diff --git a/docs/en/contribution/compiling.md b/docs/en/contribution/compiling.md
index a166789..94d8d79 100644
--- a/docs/en/contribution/compiling.md
+++ b/docs/en/contribution/compiling.md
@@ -24,7 +24,7 @@ folders if you are using IntelliJ IDE.
 # Building Docker images
 
 After you have [compiled the project](#compiling-project) and have generated the `skywalking-agent` folder, you can
-build Docker images. [`make docker`] builds the agent Docker images based on `alpine` image and `java8 ~ java 17`
+build Docker images. [`make docker`] builds the agent Docker images based on `alpine` image, `java8`, `java11` and `java 17`
 images by default. If you want to only build part of the images, add suffix `.alpine` or `.java<x>` to the `make`
 target, for example:
 
diff --git a/test/e2e/base/base-compose.yml b/test/e2e/base/base-compose.yml
index af4578c..e6b4b70 100644
--- a/test/e2e/base/base-compose.yml
+++ b/test/e2e/base/base-compose.yml
@@ -49,7 +49,7 @@ services:
       JAVA_TOOL_OPTIONS: -javaagent:/skywalking/agent/skywalking-agent.jar=agent.instance_properties[org]=apache
       SW_INSTANCE_PROPERTIES_JSON: "{\"org\": \"apache-skywalking\"}"
     healthcheck:
-      test: [ "CMD", "sh", "-c", "nc -zn 127.0.0.1 9090"]
+      test: [ "CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9090" ]
       interval: 5s
       timeout: 60s
       retries: 120
@@ -70,7 +70,7 @@ services:
       SW_AGENT_INSTANCE_NAME: consumer1
       SW_LOGGING_OUTPUT: CONSOLE
     healthcheck:
-      test: [ "CMD", "sh", "-c", "nc -zn 127.0.0.1 9090"]
+      test: ["CMD", "bash", "-c", "cat < /dev/null > /dev/tcp/127.0.0.1/9090"]
       interval: 5s
       timeout: 60s
       retries: 120
diff --git a/test/e2e/base/consumer/Dockerfile b/test/e2e/base/consumer/Dockerfile
index a512311..61de752 100644
--- a/test/e2e/base/consumer/Dockerfile
+++ b/test/e2e/base/consumer/Dockerfile
@@ -17,11 +17,11 @@ FROM skywalking/skywalking-java:latest-java8
 
 ARG ENABLE_KAFKA_REPORTER
 
-RUN if [[ "${ENABLE_KAFKA_REPORTER}" == "true" ]]; then cp -rf /skywalking/agent/optional-reporter-plugins/* /skywalking/agent/plugins/ ; fi
+RUN if [ "${ENABLE_KAFKA_REPORTER}" = "true" ]; then cp -rf /skywalking/agent/optional-reporter-plugins/* /skywalking/agent/plugins/ ; fi
 
 VOLUME /services
 ADD target/e2e-service-consumer.jar /services/
 
 ENV JAVA_OPTS=""
 
-CMD ["sh", "-c", "java $JAVA_OPTS -jar /services/e2e-service-consumer.jar"]
+CMD ["bash", "-c", "java $JAVA_OPTS -jar /services/e2e-service-consumer.jar"]
diff --git a/test/e2e/base/provider/Dockerfile b/test/e2e/base/provider/Dockerfile
index 77acc42..addff56 100644
--- a/test/e2e/base/provider/Dockerfile
+++ b/test/e2e/base/provider/Dockerfile
@@ -17,11 +17,11 @@ FROM skywalking/skywalking-java:latest-java8
 
 ARG ENABLE_KAFKA_REPORTER
 
-RUN if [[ "${ENABLE_KAFKA_REPORTER}" == "true" ]]; then cp -rf /skywalking/agent/optional-reporter-plugins/* /skywalking/agent/plugins/ ; fi
+RUN if [ "${ENABLE_KAFKA_REPORTER}" = "true" ]; then cp -rf /skywalking/agent/optional-reporter-plugins/* /skywalking/agent/plugins/ ; fi
 
 VOLUME /services
 ADD target/e2e-service-provider.jar /services/
 
 ENV JAVA_OPTS=""
 
-CMD ["sh", "-c", "java $JAVA_OPTS -jar /services/e2e-service-provider.jar"]
+CMD ["bash", "-c", "java $JAVA_OPTS -jar /services/e2e-service-provider.jar"]
diff --git a/test/e2e/case/kafka/e2e.yaml b/test/e2e/case/kafka/e2e.yaml
index 159462a..3fc35c0 100644
--- a/test/e2e/case/kafka/e2e.yaml
+++ b/test/e2e/case/kafka/e2e.yaml
@@ -18,7 +18,7 @@
 setup:
   env: compose
   file: docker-compose.yml
-  timeout: 1200
+  timeout: 20m
   init-system-environment: ../../script/env
   steps:
     - name: install yq
@@ -26,10 +26,6 @@ setup:
     - name: install swctl
       command: bash test/e2e/script/prepare/install.sh swctl
 
-cleanup:
-  # always never success failure
-  on: always
-
 trigger:
   action: http
   interval: 3s