feat: 🚛 完成了 client 资源创建
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"gitea.loveuer.com/yizhisec/pkg3/logger"
|
||||
"yizhisec.com/hsv2/forge/internal/opt"
|
||||
"yizhisec.com/hsv2/forge/pkg/archiver"
|
||||
"yizhisec.com/hsv2/forge/pkg/model"
|
||||
"yizhisec.com/hsv2/forge/pkg/resource"
|
||||
)
|
||||
|
||||
@@ -65,8 +66,8 @@ RUN chmod +x /data/create_index.sh
|
||||
var (
|
||||
err error
|
||||
output []byte
|
||||
location = filepath.Join(m.workdir, "dependency", "elastic")
|
||||
helperTarLocation = filepath.Join(m.workdir, "dependency", "image", "es-init-helper.alpine-3.22.2.tar")
|
||||
location = filepath.Join(m.workdir, "dependency", "elastic")
|
||||
helperTarLocation = filepath.Join(m.workdir, "dependency", "image", "es-init-helper.alpine-3.22.2.tar")
|
||||
)
|
||||
|
||||
opt := &elasticOpt{
|
||||
@@ -178,6 +179,28 @@ RUN chmod +x /data/create_index.sh
|
||||
}
|
||||
logger.Debug("✅ maker.Elastic: 写入 kibana.yaml 文件成功")
|
||||
|
||||
logger.Debug("☑️ maker.Elastic: 开始获取所需镜像...")
|
||||
|
||||
var images = []*model.Image{
|
||||
{Name: "hub.yizhisec.com/external/elasticsearch:7.17.28", Fallback: "", Save: "elasticsearch.7.17.28.tar"},
|
||||
{Name: "hub.yizhisec.com/external/kibana:7.17.28", Fallback: "", Save: "kibana.7.17.28.tar"},
|
||||
}
|
||||
|
||||
for _, image := range images {
|
||||
opts := []ImageOpt{
|
||||
WithImageFallback(image.Fallback),
|
||||
WithImageSave(filepath.Join(location, image.Save)),
|
||||
WithImageForcePull(image.Force),
|
||||
}
|
||||
|
||||
if err := m.Image(ctx, image.Name, opts...); err != nil {
|
||||
logger.Error("❌ maker.Elastic: 获取镜像失败: %s, 可以手动获取后重试", image.Name)
|
||||
logger.Debug("❌ maker.Elastic: 获取镜像失败: %s, %v", image.Name, err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
logger.Debug("✅ maker.Elastic: 获取所需镜像成功!!!")
|
||||
|
||||
logger.Info("✅ maker.Elastic: 构建 elastic(es) 依赖成功!!!")
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user