Compare commits
30 Commits
v3.5.0-nat
...
v3.7.3-nat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6b67b428b | ||
|
|
f3eeaf48fd | ||
|
|
46f1b7ca22 | ||
|
|
c7d1bedf79 | ||
|
|
8dc0e1f9d7 | ||
|
|
5cb44e596c | ||
|
|
2f9ff5f9c9 | ||
|
|
cfbd38a09d | ||
|
|
93a1aa6465 | ||
|
|
6adc7bc789 | ||
|
|
899beb46ff | ||
|
|
d78dd16a8d | ||
|
|
cefc01220d | ||
|
|
a9a18c13b6 | ||
|
|
b0e021e0a0 | ||
|
|
58ecbced00 | ||
|
|
d0457dc910 | ||
|
|
8359c9c4dd | ||
|
|
ac8aacbd63 | ||
|
|
969002ab42 | ||
|
|
1e1f1526fc | ||
|
|
e381ac36e1 | ||
|
|
009f6ae5b7 | ||
|
|
ea2d7d76af | ||
|
|
5dbb383d07 | ||
|
|
057cb5de38 | ||
|
|
bf1f52ad54 | ||
|
|
1696261450 | ||
|
|
5ca35df955 | ||
|
|
21bc585376 |
@@ -21,21 +21,52 @@ env:
|
||||
# 构建 Job
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-jammy # 如果host构建 :linux_amd64
|
||||
runs-on: ubuntu-node24 # 如果host构建 :linux_amd64
|
||||
# container:
|
||||
# image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/catthehacker/ubuntu:act-latest
|
||||
steps:
|
||||
- run: echo " The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||
- run: echo " This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||
- run: echo " The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
- run: env
|
||||
- uses: http://localhost:3000/bamanker/setup-node@v6
|
||||
- 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 &&
|
||||
apt-get update &&
|
||||
apt-get install ca-certificates curl &&
|
||||
install -m 0755 -d /etc/apt/keyrings &&
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc &&
|
||||
chmod a+r /etc/apt/keyrings/docker.asc &&
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
|
||||
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
|
||||
tee /etc/apt/sources.list.d/docker.list > /dev/null &&
|
||||
apt-get update &&
|
||||
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
- name: Generate maven config
|
||||
uses: http://139.9.216.111:3000/bamanker/maven-settings-action@v3.1.0
|
||||
with:
|
||||
node-version: 24
|
||||
cache: 'npm'
|
||||
- run: node -v
|
||||
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: Set up Docker Buildx
|
||||
# uses: http://139.9.216.111:3000/bamanker/setup-buildx-action@v3
|
||||
|
||||
- name: Checkout repository code
|
||||
#使用自定义仓库action
|
||||
uses: http://localhost:3000/bamanker/checkout@v6
|
||||
uses: http://139.9.216.111:3000/bamanker/checkout@v4
|
||||
|
||||
# 获取 TAG 并设置为环境变量
|
||||
- name: Get version
|
||||
@@ -50,7 +81,8 @@ jobs:
|
||||
run: |
|
||||
echo "The app version is $APP_TAG" && echo "tag=$APP_TAG" >> $GITHUB_OUTPUT &&
|
||||
echo "now workspace: ${{ github.workspace }}" &&
|
||||
pwd
|
||||
pwd &&
|
||||
docker version
|
||||
|
||||
# 为其他配置文件注入环境变量
|
||||
- name: Inject envVar
|
||||
@@ -60,7 +92,7 @@ jobs:
|
||||
|
||||
# 构建java项目
|
||||
- name: Set up Java
|
||||
uses: http://localhost:3000/bamanker/setup-java@v5
|
||||
uses: http://139.9.216.111:3000/bamanker/setup-graalvm@v1
|
||||
with:
|
||||
distribution: 'graalvm'
|
||||
java-version: '25.0.1'
|
||||
@@ -72,7 +104,7 @@ jobs:
|
||||
|
||||
# 登录镜像仓库,方便后续上传镜像
|
||||
- name: Login to Docker Registry
|
||||
uses: http://localhost:3000/bamanker/login-action@v3
|
||||
uses: http://139.9.216.111:3000/bamanker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
@@ -85,22 +117,24 @@ jobs:
|
||||
# run: |
|
||||
# echo "datetime=$(date '+%Y-%m-%d-%H-%M-%S')" >> $GITHUB_OUTPUT
|
||||
|
||||
# 构建并上传镜像
|
||||
# 构建并上传镜像 TODO 直接用docker命令操作
|
||||
- name: Build and push Docker image
|
||||
uses: http://localhost: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 }}
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: Dockerfile
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
||||
run: |
|
||||
docker buildx build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} --push .
|
||||
# with:
|
||||
# context: .
|
||||
## platforms: linux/amd64
|
||||
# file: Dockerfile
|
||||
# push: true
|
||||
# tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
||||
|
||||
#发布到 k8s
|
||||
- name: Generate kubeconfig
|
||||
uses: http://localhost:3000/bamanker/kubectl-action@v1.4.0
|
||||
uses: http://139.9.216.111:3000/bamanker/kubectl-action@v1.4.0
|
||||
with:
|
||||
base64-kube-config: ${{ secrets.KUBE_CONFIG }}
|
||||
- name: Deploy k8s
|
||||
|
||||
@@ -29,14 +29,15 @@ spec:
|
||||
- image: $REGISTRY/$IMAGE_NAMESPACE/$IMAGE_NAME:$APP_TAG
|
||||
name: $APP_NAME
|
||||
imagePullPolicy: Always
|
||||
readinessProbe:
|
||||
livenessProbe: # 存活探针:失败意味着应用彻底挂了,需要重启来恢复
|
||||
httpGet:
|
||||
path: /test
|
||||
port: 9090
|
||||
initialDelaySeconds: 1
|
||||
timeoutSeconds: 10
|
||||
failureThreshold: 30
|
||||
successThreshold: 5
|
||||
initialDelaySeconds: 10 # 延迟xx秒开始执行
|
||||
periodSeconds: 15 # 每隔15秒执行一次
|
||||
timeoutSeconds: 10 # 10秒未返回结果则超时
|
||||
failureThreshold: 10 # 探测失败后的重试次数,当达到这个次数后就判定结果为失败
|
||||
# successThreshold: 5
|
||||
ports:
|
||||
- containerPort: 9090
|
||||
imagePullSecrets:
|
||||
|
||||
Reference in New Issue
Block a user