Compare commits
31 Commits
v3.8.4-nat
...
v4.2.3-nat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e1ec6a761 | ||
|
|
7ebd4ba157 | ||
|
|
75d0f8d768 | ||
|
|
afa97145c1 | ||
|
|
2f39836963 | ||
|
|
d9807291ad | ||
|
|
27c3ab7b82 | ||
|
|
67ce2b5c86 | ||
|
|
be67a8fef0 | ||
|
|
6b47cfd5f8 | ||
|
|
d5ab5e6727 | ||
|
|
adcf60eeb6 | ||
|
|
5b20c46c5d | ||
|
|
472edfaabd | ||
|
|
e8ac7f9fbc | ||
|
|
cb418d8acd | ||
|
|
d4d6064bcd | ||
|
|
297ce02549 | ||
|
|
4f7cfe396a | ||
|
|
521ac4d3f6 | ||
|
|
095245b421 | ||
|
|
af390af277 | ||
|
|
3e55783c5f | ||
|
|
b2fba3cac7 | ||
|
|
26f6647a4d | ||
|
|
84b6f139b9 | ||
|
|
5e865ab425 | ||
|
|
6b4c1b6676 | ||
|
|
ff654bb606 | ||
|
|
8eaa9fd792 | ||
|
|
c7af2dd52c |
@@ -21,31 +21,40 @@ env:
|
|||||||
# 构建 Job
|
# 构建 Job
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-node22 # 如果host构建 :linux_amd64
|
runs-on: ubuntu-node22 # 如果host构建:linux_amd64
|
||||||
# container:
|
# container:
|
||||||
# image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/catthehacker/ubuntu:act-latest
|
# image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/catthehacker/ubuntu:act-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Print system info 1
|
- name: Print system info 1
|
||||||
run: echo " The job was automatically triggered by a ${{ gitea.event_name }} event."
|
run: echo " The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||||
|
|
||||||
- name: Print system info 2
|
- name: Print system info 2
|
||||||
run: echo " This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
run: echo " This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||||
|
|
||||||
- name: Print system info 3
|
- name: Print system info 3
|
||||||
run: echo " The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
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 coreutils &&
|
|
||||||
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add &&
|
|
||||||
cd /etc/apt/sources.list.d &&
|
|
||||||
touch docker.list &&
|
|
||||||
chmod 666 docker.list &&
|
|
||||||
echo "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" > docker.list &&
|
|
||||||
apt-get update && && apt upgrade &&
|
|
||||||
apt-get install -y docker-ce docker-ce-cli containerd.io
|
|
||||||
|
|
||||||
|
- name: Print env
|
||||||
|
run: env && blkid
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
apt-get update &&
|
||||||
|
apt-get install -y gettext &&
|
||||||
|
apt-get install -y maven &&
|
||||||
|
apt-get install -y sudo &&
|
||||||
|
apt-get install -y iptables
|
||||||
|
|
||||||
|
- name: Set up Docker
|
||||||
|
uses: http://139.9.216.111:3000/bamanker/setup-docker-action@v4.6.0
|
||||||
|
with:
|
||||||
|
version: type=archive,channel=stable,version=v27.4.0
|
||||||
|
daemon-config: |
|
||||||
|
{
|
||||||
|
"registry-mirrors":["https://docker.1ms.run"],
|
||||||
|
"dns": ["8.8.8.8", "114.114.114.114"]
|
||||||
|
}
|
||||||
- name: Generate maven config
|
- name: Generate maven config
|
||||||
uses: http://139.9.216.111:3000/bamanker/maven-settings-action@v3.1.0
|
uses: http://139.9.216.111:3000/bamanker/maven-settings-action@v3.1.0
|
||||||
with:
|
with:
|
||||||
@@ -77,9 +86,7 @@ jobs:
|
|||||||
id: set_envar
|
id: set_envar
|
||||||
run: |
|
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 }}" &&
|
echo "now workspace: ${{ github.workspace }}"
|
||||||
pwd &&
|
|
||||||
docker version
|
|
||||||
|
|
||||||
# 为其他配置文件注入环境变量
|
# 为其他配置文件注入环境变量
|
||||||
- name: Inject envVar
|
- name: Inject envVar
|
||||||
@@ -121,7 +128,12 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
TAG: ${{ steps.set_envar.outputs.tag }}
|
TAG: ${{ steps.set_envar.outputs.tag }}
|
||||||
run: |
|
run: |
|
||||||
docker buildx build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} --push .
|
ls &&
|
||||||
|
docker build --file Dockerfile --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} . &&
|
||||||
|
docker image ls
|
||||||
|
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
||||||
|
# ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} --push.
|
||||||
|
# uses: http://139.9.216.111:3000/bamanker/docker-build-push@v5
|
||||||
# with:
|
# with:
|
||||||
# context: .
|
# context: .
|
||||||
## platforms: linux/amd64
|
## platforms: linux/amd64
|
||||||
@@ -130,17 +142,36 @@ jobs:
|
|||||||
# tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
# tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
||||||
|
|
||||||
#发布到 k8s
|
#发布到 k8s
|
||||||
- name: Generate kubeconfig
|
|
||||||
uses: http://139.9.216.111:3000/bamanker/kubectl-action@v1.4.0
|
- name: Setup kubectl
|
||||||
with:
|
run: |
|
||||||
base64-kube-config: ${{ secrets.KUBE_CONFIG }}
|
curl -LO "http://10.10.0.5:9000/test/kubectl" &&
|
||||||
- name: Deploy k8s
|
chmod +x kubectl &&
|
||||||
run: kubectl apply -f ./deployment.yml
|
mv kubectl /usr/local/bin/ &&
|
||||||
# command: apply -f http://139.9.216.111:3000/bamanker/myk3sTest/raw/branch/master/.deploy/deployment-temp.yml
|
kubectl version
|
||||||
|
|
||||||
|
- name: Configure kubeconfig
|
||||||
|
# 假设您的 KUBE_CONFIG 秘密是 Base64 编码的 kubeconfig 文件内容
|
||||||
|
run: |
|
||||||
|
# 1. 创建 ~/.kube 目录
|
||||||
|
mkdir -p $HOME/.kube
|
||||||
|
|
||||||
|
# 2. 将 Base64 编码的 KUBE_CONFIG 秘密解码并写入默认配置文件
|
||||||
|
echo "${{ secrets.KUBE_CONFIG }}" | base64 -d > $HOME/.kube/config
|
||||||
|
|
||||||
|
# 3. 确保 kubectl 知道配置文件的位置 (可选, 但安全)
|
||||||
|
echo "KUBECONFIG=$HOME/.kube/config" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Deploy with kubectl
|
||||||
|
run: |
|
||||||
|
kubectl apply -f ./deployment.yml
|
||||||
|
#
|
||||||
- name: k8s Check Pods Health
|
- name: k8s Check Pods Health
|
||||||
run: kubectl get pod -n default -l app=${{ env.APP_NAME }}
|
run: |
|
||||||
|
args: get pod -n default -l app=${{ env.APP_NAME }}
|
||||||
|
|
||||||
- name: k8s Update Deployment
|
- name: k8s Update Deployment
|
||||||
run: kubectl rollout restart deployment ${{ env.APP_NAME }}
|
run: |
|
||||||
|
rollout restart deployment ${{ env.APP_NAME }}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# 基于 java25 构建
|
# 基于 java25 构建
|
||||||
FROM ubuntu:jammy
|
FROM swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/ubuntu:jammy
|
||||||
# 基于构建上下文 . 进行COPY 文件到 /root目录下
|
# 基于构建上下文 . 进行COPY 文件到 /root目录下
|
||||||
COPY target/myk3sTest /root/myk3sTest/
|
COPY target/myk3sTest /root/myk3sTest/
|
||||||
EXPOSE 9090
|
EXPOSE 9090
|
||||||
|
|||||||
Reference in New Issue
Block a user