Skip to content

Commit

Permalink
fix: update failure
Browse files Browse the repository at this point in the history
Signed-off-by: 张启航 <[email protected]>
  • Loading branch information
ZhangSetSail committed Dec 19, 2024
1 parent 6f17356 commit fc82827
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/controller/apigateway/api_gateway_route.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ func (g Struct) CreateHTTPAPIRoute(w http.ResponseWriter, r *http.Request) {
httputil.ReturnBcodeError(r, w, bcode.ErrRouteNotFound)
return
}
if roueList != nil && len(roueList.Items) > 0 && r.URL.Query().Get("intID")+roueList.Items[0].Name != name && !defaultDomain {
parts := strings.Split(name, "-")
bName := strings.Join(parts[:len(parts)-1], "-")
if roueList != nil && len(roueList.Items) > 0 && r.URL.Query().Get("intID")+roueList.Items[0].Name != bName && !defaultDomain {
logrus.Errorf("list check route failure: %v", err)
httputil.ReturnBcodeError(r, w, bcode.ErrRouteExist)
return
Expand Down
39 changes: 39 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

# 检查是否提供了服务名称和镜像名称
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <service_name> <image_name>"
echo "Example: $0 api my-api-image:1.0"
exit 1
fi

# 获取输入参数
service_name=$1
image_name=$2

# 自动生成目标目录路径
base_dir="./hack/contrib/docker"
target_dir="$base_dir/$service_name"

# 检查服务目录是否存在
if [ ! -d "$target_dir" ]; then
echo "Error: Directory for service '$service_name' ('$target_dir') does not exist."
exit 1
fi

# 检查是否存在 Dockerfile
if [ ! -f "$target_dir/Dockerfile" ]; then
echo "Error: No Dockerfile found in '$target_dir'."
exit 1
fi

# 构建镜像
echo "Building Docker image '$image_name' for service '$service_name' from directory '$target_dir'..."
nerdctl build -f "$target_dir/Dockerfile" -t "$image_name" --namespace=k8s.io --address /var/run/k3s/containerd/containerd.sock ./

if [ $? -eq 0 ]; then
echo "Successfully built image: $image_name"
else
echo "Failed to build image: $image_name"
exit 1
fi

0 comments on commit fc82827

Please sign in to comment.