Compare commits

...

35 Commits

Author SHA1 Message Date
bamanker
6adc7bc789 fix bugs
Some checks failed
Build Push and Deploy Image / build (push) Failing after 19m36s
2025-12-30 17:15:17 +08:00
bamanker
899beb46ff 增加docker依赖
Some checks failed
Build Push and Deploy Image / build (push) Failing after 7s
2025-12-30 17:13:49 +08:00
bamanker
d78dd16a8d 增加maven依赖
Some checks failed
Build Push and Deploy Image / build (push) Failing after 22m48s
2025-12-30 16:44:45 +08:00
bamanker
cefc01220d 修改action graalvm
Some checks failed
Build Push and Deploy Image / build (push) Failing after 5m34s
2025-12-30 16:12:28 +08:00
bamanker
a9a18c13b6 修改action 版本
Some checks failed
Build Push and Deploy Image / build (push) Failing after 7m0s
2025-12-30 15:55:50 +08:00
bamanker
b0e021e0a0 修改node24镜像
Some checks failed
Build Push and Deploy Image / build (push) Failing after 1m6s
2025-12-30 15:45:53 +08:00
bamanker
58ecbced00 action checkout 修改为v4
Some checks failed
Build Push and Deploy Image / build (push) Failing after 2m21s
2025-12-30 15:37:39 +08:00
bamanker
d0457dc910 fix some bug 1
Some checks failed
Build Push and Deploy Image / build (push) Failing after 1m29s
2025-12-30 15:28:44 +08:00
bamanker
8359c9c4dd fix some bug
Some checks failed
Build Push and Deploy Image / build (push) Failing after 11s
2025-12-30 15:04:03 +08:00
bamanker
ac8aacbd63 修改了找不到命令的问题 6
Some checks failed
Build Push and Deploy Image / build (push) Failing after 1m10s
2025-12-30 14:15:52 +08:00
bamanker
969002ab42 修改了找不到命令的问题
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-30 13:17:22 +08:00
bamanker
1e1f1526fc 修改了runs on 镜像为ubuntu 5
Some checks failed
Build Push and Deploy Image / build (push) Failing after 8s
2025-12-30 13:15:31 +08:00
bamanker
e381ac36e1 修改了runs on 镜像为ubuntu 4
Some checks failed
Build Push and Deploy Image / build (push) Failing after 5m24s
2025-12-30 12:49:13 +08:00
bamanker
009f6ae5b7 修改了runs on 镜像为ubuntu 2
Some checks failed
Build Push and Deploy Image / build (push) Failing after 3s
2025-12-30 12:32:40 +08:00
bamanker
ea2d7d76af 修改了runs on 镜像为ubuntu 1
Some checks failed
Build Push and Deploy Image / build (push) Failing after 5s
2025-12-30 12:27:47 +08:00
bamanker
5dbb383d07 修改了runs on 镜像为ubuntu
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-30 12:25:06 +08:00
bamanker
699d6cc5c3 修改了runs on 镜像为ubuntu:jammy
Some checks failed
Build Push and Deploy Image / build (push) Failing after 36s
2025-12-30 12:04:00 +08:00
bamanker
499c3058fe 修改了runs on 镜像为node:22-alpine
Some checks failed
Build Push and Deploy Image / build (push) Failing after 55s
2025-12-30 11:32:54 +08:00
bamanker
00684cebf2 修改了runs-on镜像
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-29 21:45:52 +08:00
bamanker
a29c9c1085 修改了一些问题
Some checks failed
Build Push and Deploy Image / build (push) Failing after 24m59s
2025-12-29 17:43:49 +08:00
bamanker
838e811619 修改了无法找到node的问题
Some checks failed
Build Push and Deploy Image / build (push) Failing after 4m48s
2025-12-29 17:23:04 +08:00
bamanker
e02119c1f3 action环境切换到ubuntu镜像
Some checks failed
Build Push and Deploy Image / build (push) Failing after 7m56s
2025-12-29 16:34:10 +08:00
bamanker
dfe90c96b2 fix build文件
Some checks failed
Build Push and Deploy Image / build (push) Failing after 14s
2025-12-28 22:47:18 +08:00
bamanker
785488505a graalvm native 原生镜像版本
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-28 22:43:17 +08:00
bamanker
078fdf969e fix readinessProbe http path
All checks were successful
Build Push and Deploy Image / build (push) Successful in 4m35s
2025-12-28 17:08:44 +08:00
bamanker
e428f7a05c fix 2025-12-26 17:49:55 +08:00
bamanker
d694d0f7ab 修复端口号错误
Some checks failed
Build Push and Deploy Image / build (push) Failing after 36s
2025-12-26 17:07:01 +08:00
bamanker
2cc70877a0 直接用本地kubectl
Some checks failed
Build Push and Deploy Image / build (push) Failing after 1m7s
2025-12-26 17:04:07 +08:00
bamanker
44c6fab1f4 更换kubectl action,修复了bug3
Some checks failed
Build Push and Deploy Image / build (push) Failing after 1m17s
2025-12-26 16:37:45 +08:00
bamanker
cf924d1ee7 更换kubectl action,修复了bug1
Some checks failed
Build Push and Deploy Image / build (push) Failing after 47s
2025-12-26 16:04:13 +08:00
bamanker
d97d39e5c4 更换kubectl action,修复了bug
Some checks failed
Build Push and Deploy Image / build (push) Failing after 30s
2025-12-26 15:51:23 +08:00
bamanker
55f57f9085 更换kubectl action
All checks were successful
Build Push and Deploy Image / build (push) Successful in 2m7s
2025-12-26 15:42:05 +08:00
bamanker
0389942e4f debug22
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-26 15:00:39 +08:00
bamanker
bc853144b8 debug21
Some checks failed
Build Push and Deploy Image / build (push) Has been cancelled
2025-12-26 14:57:57 +08:00
bamanker
f5b1de075f add 显示注入后的deployment文件
Some checks failed
Build Push and Deploy Image / build (push) Failing after 1m14s
2025-12-26 12:50:09 +08:00
4 changed files with 81 additions and 26 deletions

View File

@@ -21,12 +21,33 @@ env:
# 构建 Job
jobs:
build:
runs-on: host
runs-on: ubuntu-node24 # 如果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 && apt-get install -y maven && apt-get install -y docker.io
- name: Generate maven config
uses: http://139.9.216.111:3000/bamanker/maven-settings-action@v3.1.0
with:
mirrors: '[{"id": "alimaven", "name": "aliyun maven", "mirrorOf": "central", "url": "http://maven.aliyun.com/nexus/content/groups/public/"}]'
# - 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
@@ -39,17 +60,27 @@ jobs:
- name: Set envVar
id: set_envar
run: |
echo "The app version is $APP_TAG" && echo "tag=$APP_TAG" >> $GITHUB_OUTPUT
echo "The app version is $APP_TAG" && echo "tag=$APP_TAG" >> $GITHUB_OUTPUT &&
echo "now workspace: ${{ github.workspace }}" &&
pwd
# 为其他配置文件注入环境变量
- name: Inject envVar
run: |
envsubst < ./deployment-temp.yml > ./deployment.yml
envsubst < ./deployment-temp.yml > ./deployment.yml &&
cat ./deployment.yml
# 构建java项目
- name: Set up Java
uses: http://139.9.216.111:3000/bamanker/setup-graalvm@v1
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
@@ -68,7 +99,7 @@ jobs:
# 构建并上传镜像
- name: Build and push Docker image
uses: http://139.9.216.111:3000/bamanker/build-push-action@v6 # 获取上一步截取到的版本号,既 1.0.0
uses: http://139.9.216.111:3000/bamanker/build-push-action@v4 # 获取上一步截取到的版本号,既 1.0.0
#只能这样接收
env:
TAG: ${{ steps.set_envar.outputs.tag }}
@@ -80,22 +111,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 }}

View File

@@ -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'

View File

@@ -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
View File

@@ -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>&#45;&#45;gc=G1</arg>-->
<!-- <arg>&#45;&#45;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>