Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 调整example打包脚本 #163

Merged
merged 23 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0aa8b49
fix: optimize the discovery inject logic and fix nacos config not wor…
andrewshan Apr 13, 2024
b427ba8
Merge branch 'polarismesh:main' into main
andrewshan Apr 15, 2024
761549a
feat: 删除无用的导入
andrewshan Apr 15, 2024
8e5277b
feat: 增加actuator到demo中
andrewshan Apr 15, 2024
dae0a9e
fix: add lossless healthcheck for example
andrewshan Apr 15, 2024
33c84f1
fix: add configuration comments
andrewshan Apr 15, 2024
3bbc028
Merge branch 'polarismesh:main' into main
andrewshan Apr 15, 2024
4c1533d
fix: 修复事件日志不输出的问题
andrewshan Apr 15, 2024
53c0a44
Merge branch 'polarismesh:main' into main
andrewshan Apr 15, 2024
0adca0b
release: release version to 1.7.0-RC1
andrewshan Apr 15, 2024
02150bf
Merge branch 'polarismesh:main' into main
andrewshan Apr 29, 2024
0d37c12
feat: new add java agent for hoxton
andrewshan May 3, 2024
286d397
feat: support service registry and config
andrewshan May 4, 2024
6fa3d0b
feat: refrator all inject logics into BeanInjector
andrewshan May 6, 2024
fbd5fe6
Merge branch 'polarismesh:main' into main
andrewshan May 6, 2024
1604631
feat: add gray release example & dispatch bean register into plugins
andrewshan May 7, 2024
2c8c777
Merge branch 'polarismesh:main' into main
andrewshan May 7, 2024
cada831
feat: add environment parameter to obtain the configuration
andrewshan May 8, 2024
5c6c44c
Merge branch 'polarismesh:main' into main
andrewshan May 8, 2024
1be919f
feat: 增加元数据传输相关拦截器
andrewshan May 8, 2024
32a18c4
Merge branch 'polarismesh:main' into main
andrewshan May 9, 2024
0260fdd
feat: 调整example打包脚本
andrewshan May 9, 2024
4faef54
fix: 修复脚本没法跳转的问题
andrewshan May 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 39 additions & 32 deletions polaris-agent-build/bin/build_example_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,38 +46,45 @@ for docker_file in ${docker_files}; do

dir_name=${folder_name##*/}

cp Dockerfile Dockerfile-${dir_name}
docker_tag="${version}-java8"

filename=$(find ./target -maxdepth 1 -name "*.jar" | grep -v "javadoc" | grep -v "sources" | head -n 1)
if [ -z "${filename}" ]; then
echo "jar file not found"
exit 1
fi
echo "jar file path is ${filename}"

filename=${filename##*/}
echo "jar sub file path is ${filename}"
if [ `grep -c "java_version" Dockerfile` -gt 0 ]
then
echo "docker repository java8: ${docker_repository}/${repo_name}, tag : ${docker_tag}"
docker buildx build -f Dockerfile-${dir_name} --no-cache -t ${docker_repository}/${repo_name}:${docker_tag} --build-arg file_name=${filename} --build-arg java_version=8 --platform ${platforms} --push ./

docker_tag="${version}-java11"
echo "docker repository java11: ${docker_repository}/${repo_name}, tag : ${docker_tag}"
docker buildx build -f Dockerfile-${dir_name} --no-cache -t ${docker_repository}/${repo_name}:${docker_tag} --build-arg file_name=${filename} --build-arg java_version=11 --platform ${platforms} --push ./

docker_tag="${version}-java17"
echo "docker repository java17: ${docker_repository}/${repo_name}, tag : ${docker_tag}"
docker buildx build -f Dockerfile-${dir_name} --no-cache -t ${docker_repository}/${repo_name}:${docker_tag} --build-arg file_name=${filename} --build-arg java_version=17 --platform ${platforms} --push ./
else
docker_tag="${version}-java17"
echo "docker repository java17: ${docker_repository}/${repo_name}, tag : ${docker_tag}"
docker buildx build -f Dockerfile-${dir_name} --no-cache -t ${docker_repository}/${repo_name}:${docker_tag} --build-arg file_name=${filename} --platform ${platforms} --push ./
fi

rm -f Dockerfile-${dir_name}
popd
cp Dockerfile Dockerfile-${dir_name}

filename=$(find ./target -maxdepth 1 -name "*.jar" | grep -v "javadoc" | grep -v "sources" | head -n 1)
if [ -z "${filename}" ]; then
echo "jar file not found"
exit 1
fi
echo "jar file path is ${filename}"

version=$(xmllint --xpath "//*[local-name()='project']/*[local-name()='version']/text()" pom.xml)
if [ -z "${version}" ]; then
echo "version not defined"
exit 1
fi

filename=${filename##*/}
echo "jar sub file path is ${filename}, version is ${version}"

if [ `grep -c "java_version" Dockerfile` -gt 0 ]
then
docker_tag="${version}-java8"
echo "docker repository java8: ${docker_repository}/${repo_name}, tag : ${docker_tag}"
docker buildx build -f Dockerfile-${dir_name} --no-cache -t ${docker_repository}/${repo_name}:${docker_tag} --build-arg file_name=${filename} --build-arg java_version=8 --platform ${platforms} --push ./

docker_tag="${version}-java11"
echo "docker repository java11: ${docker_repository}/${repo_name}, tag : ${docker_tag}"
docker buildx build -f Dockerfile-${dir_name} --no-cache -t ${docker_repository}/${repo_name}:${docker_tag} --build-arg file_name=${filename} --build-arg java_version=11 --platform ${platforms} --push ./

docker_tag="${version}-java17"
echo "docker repository java17: ${docker_repository}/${repo_name}, tag : ${docker_tag}"
docker buildx build -f Dockerfile-${dir_name} --no-cache -t ${docker_repository}/${repo_name}:${docker_tag} --build-arg file_name=${filename} --build-arg java_version=17 --platform ${platforms} --push ./
else
docker_tag="${version}-java17"
echo "docker repository java17: ${docker_repository}/${repo_name}, tag : ${docker_tag}"
docker buildx build -f Dockerfile-${dir_name} --no-cache -t ${docker_repository}/${repo_name}:${docker_tag} --build-arg file_name=${filename} --platform ${platforms} --push ./
fi

rm -f Dockerfile-${dir_name}
popd
fi
done
popd
4 changes: 2 additions & 2 deletions polaris-agent-examples/spring-cloud-plugins-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<module>spring-cloud-2021-examples</module>
<module>spring-cloud-2020-examples</module>
<module>spring-cloud-hoxton-examples</module>
<module>spring-cloud-2023-examples</module>
</modules>
<module>spring-cloud-2023-examples</module>
</modules>

</project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM alpine:3.19.1

ARG file_name
ARG java_version

COPY ./target/${file_name} /app/main.jar

Expand All @@ -9,7 +10,7 @@ WORKDIR /app
RUN sed -i 's!http://dl-cdn.alpinelinux.org/!https://mirrors.tencent.com/!g' /etc/apk/repositories

RUN set -eux && \
apk add openjdk17 && \
apk add openjdk${java_version} && \
apk add bind-tools && \
apk add busybox-extras && \
apk add findutils && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,26 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: service-a-2023
name: service-a-2023
app: service-a-hoxton
name: service-a-hoxton
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: service-a-2023
app: service-a-hoxton
template:
metadata:
labels:
app: service-a-2023
app: service-a-hoxton
annotations:
polarismesh.cn/javaagent: "true"
polarismesh.cn/javaagentVersion: "1.7.0-RC.0"
polarismesh.cn/javaagentVersion: "1.7.0-RC2"
polarismesh.cn/javaagentFrameworkName: "spring-cloud"
polarismesh.cn/javaagentFrameworkVersion: "2023"
polarismesh.cn/javaagentConfig: "{\"spring.cloud.polaris.namespace\": \"default\", \"spring.cloud.polaris.router.nearby-router.matchLevel\": \"campus\"}"
polarismesh.cn/javaagentFrameworkVersion: "hoxton"
spec:
containers:
- image: polarismesh/polaris-javaagent-demo-sc-gray-2023-service-a:1.7.0-RC.0-java17
- image: polarismesh/polaris-javaagent-demo-sc-gray-hoxton-service-a:1.7.0-java8
imagePullPolicy: Always
name: consumer
resources:
Expand All @@ -35,7 +34,7 @@ spec:
command:
- /bin/bash
- -c
- cd /app && java -Dspring.cloud.nacos.config.server-addr=127.0.0.1:8848 -Dspring.cloud.nacos.config.password=nacos -jar main.jar
- cd /app && java -Dserver.port=65203 -jar main.jar
lifecycle:
preStop:
exec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<name>2023-service-a</name>
<description>Demo Service-A Project For Spring Cloud Alibaba</description>
<artifactId>polaris-javaagent-demo-sc-gray-hoxton-service-a</artifactId>
<version>1.7.0</version>
<packaging>jar</packaging>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM alpine:3.19.1

ARG file_name
ARG java_version

COPY ./target/${file_name} /app/main.jar

Expand All @@ -9,7 +10,7 @@ WORKDIR /app
RUN sed -i 's!http://dl-cdn.alpinelinux.org/!https://mirrors.tencent.com/!g' /etc/apk/repositories

RUN set -eux && \
apk add openjdk17 && \
apk add openjdk${java_version} && \
apk add bind-tools && \
apk add busybox-extras && \
apk add findutils && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,26 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: service-b-2023
name: service-b-2023
app: service-b-hoxton
name: service-b-hoxton
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: service-b-2023
app: service-b-hoxton
template:
metadata:
labels:
app: service-b-2023
app: service-b-hoxton
annotations:
polarismesh.cn/javaagent: "true"
polarismesh.cn/javaagentVersion: "1.7.0-RC.0"
polarismesh.cn/javaagentVersion: "1.7.0-RC2"
polarismesh.cn/javaagentFrameworkName: "spring-cloud"
polarismesh.cn/javaagentFrameworkVersion: "2023"
polarismesh.cn/javaagentConfig: "{\"spring.cloud.polaris.namespace\": \"default\", \"spring.cloud.polaris.router.nearby-router.matchLevel\": \"campus\"}"
polarismesh.cn/javaagentFrameworkVersion: "hoxton"
spec:
containers:
- image: polarismesh/polaris-javaagent-demo-sc-gray-2023-service-b:1.7.0-RC.0-java17
- image: polarismesh/polaris-javaagent-demo-sc-gray-hoxton-service-b:1.7.0-java8
imagePullPolicy: Always
name: consumer
resources:
Expand All @@ -35,7 +34,7 @@ spec:
command:
- /bin/bash
- -c
- cd /app && java -Dspring.cloud.nacos.config.server-addr=127.0.0.1:8848 -Dspring.cloud.nacos.config.password=nacos -jar main.jar
- cd /app && java -Dserver.port=65202 -jar main.jar
lifecycle:
preStop:
exec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<description>Demo Service-B Project For Spring Cloud Alibaba</description>
<artifactId>polaris-javaagent-demo-sc-gray-hoxton-service-b</artifactId>
<packaging>jar</packaging>
<version>1.7.0</version>

<dependencyManagement>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM alpine:3.19.1

ARG file_name
ARG java_version

COPY ./target/${file_name} /app/main.jar

Expand All @@ -9,7 +10,7 @@ WORKDIR /app
RUN sed -i 's!http://dl-cdn.alpinelinux.org/!https://mirrors.tencent.com/!g' /etc/apk/repositories

RUN set -eux && \
apk add openjdk17 && \
apk add openjdk${java_version} && \
apk add bind-tools && \
apk add busybox-extras && \
apk add findutils && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,26 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: service-c-2023
name: service-c-2023
app: service-c-hoxton
name: service-c-hoxton
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: service-c-2023
app: service-c-hoxton
template:
metadata:
labels:
app: service-c-2023
app: service-c-hoxton
annotations:
polarismesh.cn/javaagent: "true"
polarismesh.cn/javaagentVersion: "1.7.0-RC.0"
polarismesh.cn/javaagentVersion: "1.7.0-RC2"
polarismesh.cn/javaagentFrameworkName: "spring-cloud"
polarismesh.cn/javaagentFrameworkVersion: "2023"
polarismesh.cn/javaagentConfig: "{\"spring.cloud.polaris.namespace\": \"default\", \"spring.cloud.polaris.router.nearby-router.matchLevel\": \"campus\"}"
polarismesh.cn/javaagentFrameworkVersion: "hoxton"
spec:
containers:
- image: polarismesh/polaris-javaagent-demo-sc-gray-2023-service-c:1.7.0-RC.0-java17
- image: polarismesh/polaris-javaagent-demo-sc-gray-hoxton-service-c:1.7.0-java8
imagePullPolicy: Always
name: consumer
resources:
Expand All @@ -35,7 +34,7 @@ spec:
command:
- /bin/bash
- -c
- cd /app && java -Dspring.cloud.nacos.config.server-addr=127.0.0.1:8848 -Dspring.cloud.nacos.config.password=nacos -jar main.jar
- cd /app && java -Dserver.port=65201 -jar main.jar
lifecycle:
preStop:
exec:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM alpine:3.19.1

ARG file_name
ARG java_version

COPY ./target/${file_name} /app/main.jar

Expand All @@ -9,7 +10,7 @@ WORKDIR /app
RUN sed -i 's!http://dl-cdn.alpinelinux.org/!https://mirrors.tencent.com/!g' /etc/apk/repositories

RUN set -eux && \
apk add openjdk17 && \
apk add openjdk${java_version} && \
apk add bind-tools && \
apk add busybox-extras && \
apk add findutils && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,26 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: sc-gateway-2023
name: sc-gateway-2023
app: sc-gateway-hoxton
name: sc-gateway-hoxton
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: sc-gateway-2023
app: sc-gateway-hoxton
template:
metadata:
labels:
app: sc-gateway-2023
app: sc-gateway-hoxton
annotations:
polarismesh.cn/javaagent: "true"
polarismesh.cn/javaagentVersion: "1.7.0-RC.0"
polarismesh.cn/javaagentVersion: "1.7.0-RC2"
polarismesh.cn/javaagentFrameworkName: "spring-cloud"
polarismesh.cn/javaagentFrameworkVersion: "2023"
polarismesh.cn/javaagentConfig: "{\"spring.cloud.polaris.namespace\": \"default\", \"spring.cloud.polaris.router.nearby-router.matchLevel\": \"campus\"}"
polarismesh.cn/javaagentFrameworkVersion: "hoxton"
spec:
containers:
- image: polarismesh/polaris-javaagent-demo-sc-gray-2023-service-gateway:1.7.0-RC.0-java17
- image: polarismesh/polaris-javaagent-demo-sc-gray-hoxton-service-gateway:1.7.0-java8
imagePullPolicy: Always
name: consumer
resources:
Expand All @@ -35,7 +34,7 @@ spec:
command:
- /bin/bash
- -c
- cd /app && java -Dspring.cloud.nacos.config.server-addr=127.0.0.1:8848 -Dspring.cloud.nacos.config.password=nacos -jar main.jar
- cd /app && java -Dserver.port=65200 -jar main.jar
lifecycle:
preStop:
exec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<name>hoxton-service-gateway</name>
<description>Demo Service-Gateway Project For Spring Cloud Alibaba 2023</description>
<packaging>jar</packaging>
<version>1.7.0</version>

<dependencyManagement>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server:

spring:
application:
name: service-gateway-hoxton
name: sc-gateway-hoxton
cloud:
gateway:
discovery:
Expand All @@ -22,7 +22,7 @@ spring:
password: 'nacos'
config:
import:
- nacos:sc-gateway-2023.properties?refreshEnabled=true
- nacos:sc-gateway-hoxton.properties?refreshEnabled=true
management:
endpoint:
health:
Expand Down
Loading