更新 .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
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:
parent
a8b21eeaa3
commit
ee0664c23b
@ -80,50 +80,50 @@ jobs:
|
||||
sleep 10
|
||||
done
|
||||
|
||||
# build-common-modules:
|
||||
# needs: build-parent-pom
|
||||
# runs-on: ubuntu
|
||||
# steps:
|
||||
# - name: 拉取代码仓库
|
||||
# uses: http://git.missmoc.top/mocheng/checkout@v4
|
||||
build-common-modules:
|
||||
needs: build-parent-pom
|
||||
runs-on: ubuntu
|
||||
steps:
|
||||
- name: 拉取代码仓库
|
||||
uses: http://git.missmoc.top/mocheng/checkout@v4
|
||||
|
||||
# - name: 配置环境变量
|
||||
# run: |
|
||||
# export JAVA_HOME="/java17/java17"
|
||||
# export MAVEN_HOME="/maven/apache-maven-3.9.11"
|
||||
# echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
|
||||
# echo "$JAVA_HOME/bin" >> $GITHUB_PATH
|
||||
# echo "MAVEN_HOME=$MAVEN_HOME" >> $GITHUB_ENV
|
||||
# echo "$MAVEN_HOME/bin" >> $GITHUB_PATH
|
||||
- name: 配置环境变量
|
||||
run: |
|
||||
export JAVA_HOME="/java17/java17"
|
||||
export MAVEN_HOME="/maven/apache-maven-3.9.11"
|
||||
echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
|
||||
echo "$JAVA_HOME/bin" >> $GITHUB_PATH
|
||||
echo "MAVEN_HOME=$MAVEN_HOME" >> $GITHUB_ENV
|
||||
echo "$MAVEN_HOME/bin" >> $GITHUB_PATH
|
||||
|
||||
# - name: 构建通用模块(仅本地使用,不上传)
|
||||
# run: |
|
||||
# COMMON_MODULES=(
|
||||
# "ruoyi-common"
|
||||
# "ruoyi-api"
|
||||
# "ruoyi-common-bom"
|
||||
# "ruoyi-common-alibaba-bom"
|
||||
# "ruoyi-api-bom"
|
||||
# )
|
||||
- name: 构建通用模块(仅本地使用,不上传)
|
||||
run: |
|
||||
COMMON_MODULES=(
|
||||
"ruoyi-common"
|
||||
"ruoyi-api"
|
||||
"ruoyi-common-bom"
|
||||
"ruoyi-common-alibaba-bom"
|
||||
"ruoyi-api-bom"
|
||||
)
|
||||
|
||||
# for module in "${COMMON_MODULES[@]}"; do
|
||||
# MODULE_POM_ABSOLUTE_PATH="${GITHUB_WORKSPACE}/${module}/pom.xml"
|
||||
# if [ ! -f "$MODULE_POM_ABSOLUTE_PATH" ]; then
|
||||
# echo "警告:模块 $module 不存在,跳过"
|
||||
# continue
|
||||
# fi
|
||||
for module in "${COMMON_MODULES[@]}"; do
|
||||
MODULE_POM_ABSOLUTE_PATH="${GITHUB_WORKSPACE}/${module}/pom.xml"
|
||||
if [ ! -f "$MODULE_POM_ABSOLUTE_PATH" ]; then
|
||||
echo "警告:模块 $module 不存在,跳过"
|
||||
continue
|
||||
fi
|
||||
|
||||
# retries=3
|
||||
# count=0
|
||||
# until "$MAVEN_HOME/bin/mvn" clean compile install -U -DskipTests -f "$MODULE_POM_ABSOLUTE_PATH"; do
|
||||
# count=$((count + 1))
|
||||
# if [ $count -ge $retries ]; then
|
||||
# echo "错误:模块 $module 构建失败"
|
||||
# exit 1
|
||||
# fi
|
||||
# sleep 10
|
||||
# done
|
||||
# done
|
||||
retries=3
|
||||
count=0
|
||||
until "$MAVEN_HOME/bin/mvn" clean compile install -U -DskipTests -f "$MODULE_POM_ABSOLUTE_PATH"; do
|
||||
count=$((count + 1))
|
||||
if [ $count -ge $retries ]; then
|
||||
echo "错误:模块 $module 构建失败"
|
||||
exit 1
|
||||
fi
|
||||
sleep 10
|
||||
done
|
||||
done
|
||||
|
||||
build-and-push-services:
|
||||
needs: build-common-modules
|
||||
@ -169,52 +169,44 @@ jobs:
|
||||
|
||||
"$MAVEN_HOME/bin/mvn" clean package -U -DskipTests -f "$SERVICE_POM_ABSOLUTE_PATH"
|
||||
|
||||
- name: 配置Docker Buildx
|
||||
uses: http://git.missmoc.top/mocheng/setup-buildx-action@v3
|
||||
- name: 配置Docker允许HTTP私有仓库
|
||||
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: 登录到容器仓库
|
||||
uses: http://git.missmoc.top/mocheng/login-action@v3
|
||||
with:
|
||||
registry: ${{ secrets.REGISTRY_URL }}
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_PASS }}
|
||||
- name: 登录到私有容器仓库
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_PASS }}" | docker login ${{ secrets.REGISTRY_URL }} -u ${{ secrets.REGISTRY_USER }} --password-stdin
|
||||
|
||||
- name: 确定Dockerfile路径
|
||||
id: dockerfile-path
|
||||
- name: 构建Docker镜像
|
||||
run: |
|
||||
SERVICE_NAME="${{ matrix.service }}"
|
||||
DOCKERFILE_ABSOLUTE_PATH="${GITHUB_WORKSPACE}/${SERVICE_NAME}/Dockerfile"
|
||||
|
||||
if [ -f "$DOCKERFILE_ABSOLUTE_PATH" ]; then
|
||||
echo "dockerfile_path=$DOCKERFILE_ABSOLUTE_PATH" >> $GITHUB_OUTPUT
|
||||
# 替换路径中的斜杠为连字符,避免镜像标签中的路径问题
|
||||
SANITIZED_SERVICE_NAME=$(echo "$SERVICE_NAME" | tr '/' '-')
|
||||
IMAGE_TAG="172.100.10.45:3000/by2025/smartparks/${SANITIZED_SERVICE_NAME}:latest"
|
||||
|
||||
# 确定Dockerfile路径
|
||||
if [ -f "${GITHUB_WORKSPACE}/${SERVICE_NAME}/Dockerfile" ]; then
|
||||
DOCKERFILE_PATH="${GITHUB_WORKSPACE}/${SERVICE_NAME}/Dockerfile"
|
||||
else
|
||||
echo "dockerfile_path=${GITHUB_WORKSPACE}/Dockerfile" >> $GITHUB_OUTPUT
|
||||
DOCKERFILE_PATH="${GITHUB_WORKSPACE}/Dockerfile"
|
||||
fi
|
||||
|
||||
# 使用原生docker build命令构建镜像
|
||||
docker build -t "$IMAGE_TAG" -f "$DOCKERFILE_PATH" "${GITHUB_WORKSPACE}"
|
||||
|
||||
# 保存镜像标签供后续步骤使用
|
||||
echo "IMAGE_TAG=$IMAGE_TAG" >> $GITHUB_ENV
|
||||
|
||||
- name: 构建并推送Docker镜像(仅推送镜像,不上传JAR)
|
||||
uses: http://git.missmoc.top/mocheng/build-push-action@v5
|
||||
with:
|
||||
context: "${{ github.workspace }}"
|
||||
file: "${{ github.workspace }}/${{ matrix.service }}/Dockerfile"
|
||||
tags: "172.100.10.45:3000/by2025/smartparks/${{ matrix.service }}:latest"
|
||||
push: true
|
||||
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
|
||||
- name: 推送Docker镜像到私有仓库
|
||||
run: |
|
||||
# 推送镜像
|
||||
docker push "$IMAGE_TAG"
|
||||
|
||||
# 登出仓库
|
||||
docker logout ${{ secrets.REGISTRY_URL }}
|
||||
|
Loading…
Reference in New Issue
Block a user