更新 .gitea/workflows/dev.yml
Some checks failed
/ build-parent-pom (push) Successful in 2m9s
/ build-common-modules (push) Successful in 1m48s
/ build-and-push-services (ruoyi-auth) (push) Failing after 48s
/ build-and-push-services (ruoyi-gateway) (push) Failing after 1m17s
/ build-and-push-services (ruoyi-modules/Property) (push) Failing after 1m30s
/ build-and-push-services (ruoyi-modules/Sis) (push) Failing after 26s
/ build-and-push-services (ruoyi-modules/ruoyi-gen) (push) Failing after 1m7s
/ build-and-push-services (ruoyi-modules/ruoyi-job) (push) Failing after 1m17s
/ build-and-push-services (ruoyi-modules/ruoyi-resource) (push) Failing after 1m10s
/ build-and-push-services (ruoyi-modules/ruoyi-system) (push) Failing after 1m18s
/ build-and-push-services (ruoyi-modules/ruoyi-workflow) (push) Failing after 1m19s
/ build-and-push-services (ruoyi-seata-server) (push) Failing after 17s
/ build-and-push-services (ruoyi-sentinel-dashboard) (push) Failing after 18s
/ build-and-push-services (ruoyi-snailjob-server) (push) Failing after 20s
/ build-and-push-services (ruoyi-visual/ruoyi-monitor) (push) Has been cancelled
/ build-and-push-services (ruoyi-visual/ruoyi-nacos) (push) Has been cancelled

This commit is contained in:
bichangxiong 2025-08-14 16:59:00 +08:00
parent a8b21eeaa3
commit ee0664c23b

View File

@ -80,50 +80,50 @@ jobs:
sleep 10 sleep 10
done done
# build-common-modules: build-common-modules:
# needs: build-parent-pom needs: build-parent-pom
# runs-on: ubuntu runs-on: ubuntu
# steps: steps:
# - name: 拉取代码仓库 - name: 拉取代码仓库
# uses: http://git.missmoc.top/mocheng/checkout@v4 uses: http://git.missmoc.top/mocheng/checkout@v4
# - name: 配置环境变量 - name: 配置环境变量
# run: | run: |
# export JAVA_HOME="/java17/java17" export JAVA_HOME="/java17/java17"
# export MAVEN_HOME="/maven/apache-maven-3.9.11" export MAVEN_HOME="/maven/apache-maven-3.9.11"
# echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
# echo "$JAVA_HOME/bin" >> $GITHUB_PATH echo "$JAVA_HOME/bin" >> $GITHUB_PATH
# echo "MAVEN_HOME=$MAVEN_HOME" >> $GITHUB_ENV echo "MAVEN_HOME=$MAVEN_HOME" >> $GITHUB_ENV
# echo "$MAVEN_HOME/bin" >> $GITHUB_PATH echo "$MAVEN_HOME/bin" >> $GITHUB_PATH
# - name: 构建通用模块(仅本地使用,不上传) - name: 构建通用模块(仅本地使用,不上传)
# run: | run: |
# COMMON_MODULES=( COMMON_MODULES=(
# "ruoyi-common" "ruoyi-common"
# "ruoyi-api" "ruoyi-api"
# "ruoyi-common-bom" "ruoyi-common-bom"
# "ruoyi-common-alibaba-bom" "ruoyi-common-alibaba-bom"
# "ruoyi-api-bom" "ruoyi-api-bom"
# ) )
# for module in "${COMMON_MODULES[@]}"; do for module in "${COMMON_MODULES[@]}"; do
# MODULE_POM_ABSOLUTE_PATH="${GITHUB_WORKSPACE}/${module}/pom.xml" MODULE_POM_ABSOLUTE_PATH="${GITHUB_WORKSPACE}/${module}/pom.xml"
# if [ ! -f "$MODULE_POM_ABSOLUTE_PATH" ]; then if [ ! -f "$MODULE_POM_ABSOLUTE_PATH" ]; then
# echo "警告:模块 $module 不存在,跳过" echo "警告:模块 $module 不存在,跳过"
# continue continue
# fi fi
# retries=3 retries=3
# count=0 count=0
# until "$MAVEN_HOME/bin/mvn" clean compile install -U -DskipTests -f "$MODULE_POM_ABSOLUTE_PATH"; do until "$MAVEN_HOME/bin/mvn" clean compile install -U -DskipTests -f "$MODULE_POM_ABSOLUTE_PATH"; do
# count=$((count + 1)) count=$((count + 1))
# if [ $count -ge $retries ]; then if [ $count -ge $retries ]; then
# echo "错误:模块 $module 构建失败" echo "错误:模块 $module 构建失败"
# exit 1 exit 1
# fi fi
# sleep 10 sleep 10
# done done
# done done
build-and-push-services: build-and-push-services:
needs: build-common-modules needs: build-common-modules
@ -169,52 +169,44 @@ jobs:
"$MAVEN_HOME/bin/mvn" clean package -U -DskipTests -f "$SERVICE_POM_ABSOLUTE_PATH" "$MAVEN_HOME/bin/mvn" clean package -U -DskipTests -f "$SERVICE_POM_ABSOLUTE_PATH"
- name: 配置Docker Buildx - name: 配置Docker允许HTTP私有仓库
uses: http://git.missmoc.top/mocheng/setup-buildx-action@v3 run: |
# 配置Docker守护进程接受HTTP私有仓库
sudo mkdir -p /etc/docker
echo '{ "insecure-registries": ["172.100.10.45:3000"] }' | sudo tee /etc/docker/daemon.json
# 重启Docker使配置生效
sudo systemctl restart docker
# 验证配置
docker info | grep -A 10 "Insecure Registries"
- name: 登录到容器仓库 - name: 登录到私有容器仓库
uses: http://git.missmoc.top/mocheng/login-action@v3 run: |
with: echo "${{ secrets.REGISTRY_PASS }}" | docker login ${{ secrets.REGISTRY_URL }} -u ${{ secrets.REGISTRY_USER }} --password-stdin
registry: ${{ secrets.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASS }}
- name: 确定Dockerfile路径 - name: 构建Docker镜像
id: dockerfile-path
run: | run: |
SERVICE_NAME="${{ matrix.service }}" SERVICE_NAME="${{ matrix.service }}"
DOCKERFILE_ABSOLUTE_PATH="${GITHUB_WORKSPACE}/${SERVICE_NAME}/Dockerfile" # 替换路径中的斜杠为连字符,避免镜像标签中的路径问题
SANITIZED_SERVICE_NAME=$(echo "$SERVICE_NAME" | tr '/' '-')
if [ -f "$DOCKERFILE_ABSOLUTE_PATH" ]; then IMAGE_TAG="172.100.10.45:3000/by2025/smartparks/${SANITIZED_SERVICE_NAME}:latest"
echo "dockerfile_path=$DOCKERFILE_ABSOLUTE_PATH" >> $GITHUB_OUTPUT
# 确定Dockerfile路径
if [ -f "${GITHUB_WORKSPACE}/${SERVICE_NAME}/Dockerfile" ]; then
DOCKERFILE_PATH="${GITHUB_WORKSPACE}/${SERVICE_NAME}/Dockerfile"
else else
echo "dockerfile_path=${GITHUB_WORKSPACE}/Dockerfile" >> $GITHUB_OUTPUT DOCKERFILE_PATH="${GITHUB_WORKSPACE}/Dockerfile"
fi fi
# 使用原生docker build命令构建镜像
docker build -t "$IMAGE_TAG" -f "$DOCKERFILE_PATH" "${GITHUB_WORKSPACE}"
# 保存镜像标签供后续步骤使用
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
- name: 构建并推送Docker镜像仅推送镜像不上传JAR - name: 推送Docker镜像到私有仓库
uses: http://git.missmoc.top/mocheng/build-push-action@v5 run: |
with: # 推送镜像
context: "${{ github.workspace }}" docker push "$IMAGE_TAG"
file: "${{ github.workspace }}/${{ matrix.service }}/Dockerfile"
tags: "172.100.10.45:3000/by2025/smartparks/${{ matrix.service }}:latest" # 登出仓库
push: true docker logout ${{ secrets.REGISTRY_URL }}
cache-from: type=gha
cache-to: type=gha,mode=max
# 关键配置允许该仓库使用HTTP
daemon-config: |
{
"insecure-registries": ["172.100.10.45:3000"]
}
# 确保buildx使用正确的网络配置
driver-opts: |
network=host
# context: "${{ github.workspace }}"
# file: ${{ github.workspace }}/${{ matrix.service }}/Dockerfile
# tags: 172.100.10.45:3000/by2025/smartparks/${{ matrix.service }}:latest
# # tags: ${{ secrets.REGISTRY_URL }}/by2025/$(echo ${{ matrix.service }} | tr 'A-Z' 'a-z'):${{ github.sha }}
# # tags: ${{ secrets.REGISTRY_URL }}/by2025/${{ matrix.service }}:2.0.4
# push: true
# cache-from: type=gha
# cache-to: type=gha,mode=max