Compare commits
26 Commits
v2.0.7
...
v3.6.0-nat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58ecbced00 | ||
|
|
d0457dc910 | ||
|
|
8359c9c4dd | ||
|
|
ac8aacbd63 | ||
|
|
969002ab42 | ||
|
|
1e1f1526fc | ||
|
|
e381ac36e1 | ||
|
|
009f6ae5b7 | ||
|
|
ea2d7d76af | ||
|
|
5dbb383d07 | ||
|
|
699d6cc5c3 | ||
|
|
499c3058fe | ||
|
|
00684cebf2 | ||
|
|
a29c9c1085 | ||
|
|
838e811619 | ||
|
|
e02119c1f3 | ||
|
|
dfe90c96b2 | ||
|
|
785488505a | ||
|
|
078fdf969e | ||
|
|
e428f7a05c | ||
|
|
d694d0f7ab | ||
|
|
2cc70877a0 | ||
|
|
44c6fab1f4 | ||
|
|
cf924d1ee7 | ||
|
|
d97d39e5c4 | ||
|
|
55f57f9085 |
@@ -21,12 +21,29 @@ env:
|
||||
# 构建 Job
|
||||
jobs:
|
||||
build:
|
||||
runs-on: host
|
||||
runs-on: ubuntu-node # 如果host构建 :linux_amd64
|
||||
steps:
|
||||
- name: Print system info 1
|
||||
run: echo " The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||
- name: Print system info 2
|
||||
run: echo " This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||
- name: Print system info 3
|
||||
run: echo " The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
- name: Print env
|
||||
run: env
|
||||
- name: Install dependencies
|
||||
run: apt-get update && apt-get install -y gettext
|
||||
|
||||
# - uses: http://localhost:3000/bamanker/setup-node@v6
|
||||
# with:
|
||||
# node-version: 24
|
||||
# cache: 'npm'
|
||||
# - run: node -v
|
||||
# 下载仓库源码,依赖node环境,因此构建服务器本地需要下载安装node并设置环境变量
|
||||
|
||||
- name: Checkout repository code
|
||||
#使用自定义仓库action
|
||||
uses: http://139.9.216.111:3000/bamanker/checkout@v6
|
||||
uses: http://139.9.216.111:3000/bamanker/checkout@v4
|
||||
|
||||
# 获取 TAG 并设置为环境变量
|
||||
- name: Get version
|
||||
@@ -50,9 +67,16 @@ jobs:
|
||||
cat ./deployment.yml
|
||||
|
||||
# 构建java项目
|
||||
- name: Set up Java
|
||||
uses: http://139.9.216.111:3000/bamanker/setup-java@v5
|
||||
with:
|
||||
distribution: 'graalvm'
|
||||
java-version: '25.0.1'
|
||||
cache: 'maven'
|
||||
|
||||
- name: Build with Maven
|
||||
#使用maven绝对路径执行打包命令
|
||||
run: /usr/local/maven/bin/mvn clean package -DskipTests -Pprod
|
||||
run: mvn clean native:compile -DskipTests -Pnative
|
||||
|
||||
# 登录镜像仓库,方便后续上传镜像
|
||||
- name: Login to Docker Registry
|
||||
@@ -83,23 +107,17 @@ jobs:
|
||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
||||
|
||||
#发布到 k8s
|
||||
- name: k8s Check and Apply New Deployment
|
||||
uses: http://139.9.216.111:3000/bamanker/steevchen-kubectl@master
|
||||
|
||||
- name: Generate kubeconfig
|
||||
uses: http://139.9.216.111:3000/bamanker/kubectl-action@v1.4.0
|
||||
with:
|
||||
config: ${{ secrets.KUBE_CONFIG }}
|
||||
command: apply -f ./deployment.yml
|
||||
base64-kube-config: ${{ secrets.KUBE_CONFIG }}
|
||||
- name: Deploy k8s
|
||||
run: kubectl apply -f ./deployment.yml
|
||||
# command: apply -f http://139.9.216.111:3000/bamanker/myk3sTest/raw/branch/master/.deploy/deployment-temp.yml
|
||||
- name: k8s Check Pods Health
|
||||
uses: http://139.9.216.111:3000/bamanker/steevchen-kubectl@master
|
||||
with:
|
||||
config: ${{ secrets.KUBE_CONFIG }}
|
||||
command: get pod -n default -l app=${{ env.APP_NAME }}
|
||||
run: kubectl get pod -n default -l app=${{ env.APP_NAME }}
|
||||
|
||||
- name: k8s Update Deployment
|
||||
uses: http://139.9.216.111:3000/bamanker/steevchen-kubectl@master
|
||||
env:
|
||||
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
|
||||
with:
|
||||
command: rollout restart deployment ${{ env.APP_NAME }}-${{ gitea.ref_name }}
|
||||
run: kubectl rollout restart deployment ${{ env.APP_NAME }}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 基于 java25 构建
|
||||
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/openjdk:25-jdk-slim
|
||||
FROM ubuntu:jammy
|
||||
# 基于构建上下文 . 进行COPY 文件到 /root目录下
|
||||
COPY target/myk3sTest.jar /root/myk3sTest/
|
||||
COPY target/myk3sTest /root/myk3sTest/
|
||||
EXPOSE 9090
|
||||
# 容器启动执行的命令
|
||||
CMD java -jar -Xms20m -Xmx20m -Dspring.profiles.active=test /root/myk3sTest/myk3sTest.jar
|
||||
CMD /root/myk3sTest/myk3sTest -XX:StartFlightRecording='filename=recording.jfr,dumponexit=true,duration=10s'
|
||||
|
||||
@@ -31,7 +31,7 @@ spec:
|
||||
imagePullPolicy: Always
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
path: /test
|
||||
port: 9090
|
||||
initialDelaySeconds: 1
|
||||
timeoutSeconds: 10
|
||||
@@ -56,6 +56,6 @@ spec:
|
||||
- name: http
|
||||
protocol: TCP
|
||||
port: 9090
|
||||
nodePort: 9090
|
||||
nodePort: 30909
|
||||
selector:
|
||||
app: $APP_NAME
|
||||
|
||||
33
pom.xml
33
pom.xml
@@ -11,7 +11,7 @@
|
||||
|
||||
<groupId>com.bamanker</groupId>
|
||||
<artifactId>myk3sTest</artifactId>
|
||||
<version>v1.1.9</version>
|
||||
<version>v3.1.0-native</version>
|
||||
<name>myk3sTest</name>
|
||||
<description>myk3sTest</description>
|
||||
<url/>
|
||||
@@ -70,11 +70,40 @@
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.graalvm.buildtools</groupId>
|
||||
<artifactId>native-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<mainClass>com.bamanker.myk3stest.Myk3sTestApplication</mainClass>
|
||||
<buildArgs>
|
||||
<!--开启dashboard-->
|
||||
<!-- <arg>-H:DashboardDump=dailylove -H:+DashboardAll</arg>-->
|
||||
<arg->-H:+ReportExceptionStackTraces</arg->
|
||||
<!--开启JFR-->
|
||||
<arg>--enable-monitoring=jfr</arg>
|
||||
<!-- <arg>--gc=G1</arg>-->
|
||||
<!-- <arg>--pgo</arg>-->
|
||||
<arg>-Ob</arg>
|
||||
<!-- <arg>-march=native</arg>-->
|
||||
<!-- <arg>-H:+BuildReport</arg>-->
|
||||
</buildArgs>
|
||||
<!--启动详细输出-->
|
||||
<verbose>true</verbose>
|
||||
<!--配置jvm参数-->
|
||||
<!-- <jvmArgs>
|
||||
</jvmArgs>-->
|
||||
<!--<agent>
|
||||
<enabled>true</enabled>
|
||||
<options>
|
||||
<option>experimental-class-loader-support</option>
|
||||
</options>
|
||||
</agent>-->
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<!--支持yaml读取pom的参数-->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<delimiters>
|
||||
|
||||
Reference in New Issue
Block a user