Compare commits

..

7 Commits

Author SHA1 Message Date
bamanker
4baa013d02 更改kubectl的action为手动下载1
Some checks failed
Build Push and Deploy Image / build (push) Failing after 22m5s
2026-01-04 22:43:23 +08:00
bamanker
6e1ec6a761 更改kubectl的action为手动下载
Some checks failed
Build Push and Deploy Image / build (push) Failing after 24m41s
2026-01-04 22:10:59 +08:00
bamanker
7ebd4ba157 更改kubectl的action2
Some checks failed
Build Push and Deploy Image / build (push) Failing after 21m41s
2026-01-04 18:01:36 +08:00
bamanker
75d0f8d768 更改kubectl的action1
Some checks failed
Build Push and Deploy Image / build (push) Failing after 24m48s
2026-01-04 17:15:47 +08:00
bamanker
afa97145c1 更改kubectl的action
Some checks failed
Build Push and Deploy Image / build (push) Failing after 21m57s
2026-01-04 16:13:16 +08:00
bamanker
2f39836963 修复mount source: "overlay" 错误的问题 5
Some checks failed
Build Push and Deploy Image / build (push) Failing after 21m14s
2026-01-04 15:19:05 +08:00
bamanker
d9807291ad 修复mount source: "overlay" 错误的问题 4
Some checks failed
Build Push and Deploy Image / build (push) Failing after 2m19s
2026-01-04 14:59:41 +08:00

View File

@@ -40,14 +40,14 @@ jobs:
- 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 &&
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
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: |
@@ -86,7 +86,7 @@ jobs:
id: set_envar
run: |
echo "The app version is $APP_TAG" && echo "tag=$APP_TAG" >> $GITHUB_OUTPUT &&
echo "now workspace: ${{ github.workspace }}" &&
echo "now workspace: ${{ github.workspace }}"
# 为其他配置文件注入环境变量
- name: Inject envVar
@@ -132,7 +132,7 @@ jobs:
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.
# ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }} --push.
# uses: http://139.9.216.111:3000/bamanker/docker-build-push@v5
# with:
# context: .
@@ -142,17 +142,36 @@ jobs:
# tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
#发布到 k8s
- name: Generate kubeconfig
uses: http://139.9.216.111:3000/bamanker/kubectl-action@v1.4.0
with:
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: Setup kubectl
run: |
curl -LO "https://dl.k8s.io/release/v1.33.0/bin/linux/amd64/kubectl" &&
chmod +x kubectl &&
mv kubectl /usr/local/bin/ &&
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
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
run: kubectl rollout restart deployment ${{ env.APP_NAME }}
run: |
rollout restart deployment ${{ env.APP_NAME }}