diff --git a/TEST_STAND/LUCEE/lucee.tf b/TEST_STAND/LUCEE/lucee.tf index f2750f2..7117d58 100644 --- a/TEST_STAND/LUCEE/lucee.tf +++ b/TEST_STAND/LUCEE/lucee.tf @@ -27,6 +27,8 @@ resource "nubes_lucee" "applucee" { git_path = "https://gitea.services.ngcloud.ru/Nail/tfluceecrud.git" } + git_revision = "94ebf06" + json_env = jsonencode({ TABLE_NAME = "check_point" testds_class = "org.postgresql.Driver" diff --git a/TOOLS/config/dev/profile.env b/TOOLS/config/dev/profile.env index 627f2b5..27db4e8 100644 --- a/TOOLS/config/dev/profile.env +++ b/TOOLS/config/dev/profile.env @@ -4,7 +4,7 @@ TOKEN_FILE="secrets/dev.token" # Release versions # Version -VERSION="3.1.10" +VERSION="3.1.11" # Registry/S3 settings REGISTRY_HOST="registry.kube5s.ru" diff --git a/TOOLS/config/prod/profile.env b/TOOLS/config/prod/profile.env index 2d871a2..d0f8eb3 100644 --- a/TOOLS/config/prod/profile.env +++ b/TOOLS/config/prod/profile.env @@ -4,7 +4,7 @@ TOKEN_FILE="secrets/prod.token" # Release versions # Version -VERSION="2.1.9" +VERSION="2.1.10" # Registry/S3 settings REGISTRY_HOST="registry.kube5s.ru" diff --git a/TOOLS/config/test/profile.env b/TOOLS/config/test/profile.env index 81aa563..259b5db 100644 --- a/TOOLS/config/test/profile.env +++ b/TOOLS/config/test/profile.env @@ -3,7 +3,7 @@ NUBES_API_ENDPOINT="https://lk-api-gateway-test.ngcloud.ru/api/v1/svc" TOKEN_FILE="secrets/test.token" # Version -VERSION="5.1.12" +VERSION="5.1.13" # Docs generation — ONLY from docs_gen// (never from docs/) DOCS_GEN_DIR="provider/docs_gen/test" diff --git a/TOOLS/resource-generator/internal/loader/loader.go b/TOOLS/resource-generator/internal/loader/loader.go index ed2e4cb..9139d3b 100644 --- a/TOOLS/resource-generator/internal/loader/loader.go +++ b/TOOLS/resource-generator/internal/loader/loader.go @@ -120,6 +120,7 @@ func LoadSpecs(dir string) ([]types.GenResource, []types.GenSubresource, []types switch op.Action { case "redeploy": gr.HasRedeploy = true + gr.RedeployParams = ConvertParams(op.Params) case "restart", "recovery", "reconcile": // Исключены default: diff --git a/TOOLS/resource-generator/internal/templates/instance.go b/TOOLS/resource-generator/internal/templates/instance.go index 0ff26e1..12893d6 100644 --- a/TOOLS/resource-generator/internal/templates/instance.go +++ b/TOOLS/resource-generator/internal/templates/instance.go @@ -548,8 +548,20 @@ func (r *{{ToCamel .Name}}Resource) Update(ctx context.Context, req resource.Upd {{- if .HasRedeploy }} // --- Redeploy support (ARCHITECTURE.md) --- if redeployRequested { - // Вызываем redeploy — пустой params (операция не требует CFS-параметров) - if err := r.client.RunRedeployOperation(ctx, instanceID.ValueString(), operationTimeout); err != nil { + {{- if .RedeployParams }} + redeployParams := map[int]string{ + {{- range .RedeployParams }} + {{- if (IsNested .) }} + if plan.{{ToCamel .Code}} != nil { + redeployParams[{{.ID}}] = {{NestedJSONExpr . "plan"}} + } + {{- else }} + {{.ID}}: {{ParamFormat . (printf "plan.%s" (ToCamel .Code))}}, + {{- end }} + {{- end }} + } + {{- end }} + if err := r.client.RunRedeployOperation(ctx, instanceID.ValueString(), operationTimeout{{if .RedeployParams}}, redeployParams{{end}}); err != nil { resp.Diagnostics.AddError("Ошибка клиента", err.Error()) return } diff --git a/TOOLS/resource-generator/internal/types/types.go b/TOOLS/resource-generator/internal/types/types.go index 4942c32..9ebb5d8 100644 --- a/TOOLS/resource-generator/internal/types/types.go +++ b/TOOLS/resource-generator/internal/types/types.go @@ -88,6 +88,8 @@ type GenResource struct { // Правило из ARCHITECTURE.md: только redeploy включается как inline action. // restart, recovery, reconcile — исключены (ручные операции, только UI). HasRedeploy bool + // RedeployParams — параметры redeploy-операции (если есть). + RedeployParams []Param // NeedsJsonPlanMod: хотя бы один атрибут имеет data_type: json. // Управляет добавлением импорта planmodifier в сгенерированный файл. NeedsJsonPlanMod bool diff --git a/provider/internal/core/client.go b/provider/internal/core/client.go index a8e0367..020768e 100644 --- a/provider/internal/core/client.go +++ b/provider/internal/core/client.go @@ -534,9 +534,8 @@ func (c *UniversalClient) RunInstanceOperationUniversalWithDefaults(ctx context. } // RunRedeployOperation запускает redeploy для сервисов, поддерживающих пересборку из git. -// В отличие от modify, redeploy не требует CFS-параметров — операция запускается без них. -// Используется генератором (gen_v2) согласно ARCHITECTURE.md. -func (c *UniversalClient) RunRedeployOperation(ctx context.Context, instanceUid string, timeoutOverride string) error { +// Если params не nil — отправляет CFS-параметры перед запуском. +func (c *UniversalClient) RunRedeployOperation(ctx context.Context, instanceUid string, timeoutOverride string, params map[int]string) error { state, err := c.GetInstanceState(ctx, instanceUid) if err != nil { return err @@ -571,6 +570,17 @@ func (c *UniversalClient) RunRedeployOperation(ctx context.Context, instanceUid return fmt.Errorf("не удалось получить UID операции redeploy") } + for paramId, value := range params { + pPayload := genericParamReq{ + InstanceOperationUid: opUid, + SvcOperationCfsParamId: paramId, + ParamValue: value, + } + if _, _, err := c.doRequest(ctx, "POST", "/instanceOperationCfsParams", pPayload); err != nil { + return fmt.Errorf("не удалось установить параметр %d для redeploy: %w", paramId, err) + } + } + if _, _, err := c.doRequest(ctx, "POST", fmt.Sprintf("/instanceOperations/%s/run", opUid), map[string]interface{}{}); err != nil { return err }