From ee5df76662254b07f98cda3dd48d8ce8a3ca5b7f Mon Sep 17 00:00:00 2001 From: Sergey Kudasov Date: Mon, 16 Dec 2024 20:27:46 +0100 Subject: [PATCH] dlv from flag, fix promtail logs (#1488) --- book/src/framework/configuration.md | 1 + framework/.changeset/v0.3.9.md | 2 ++ framework/docker.go | 9 ++++++--- framework/promtail.go | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 framework/.changeset/v0.3.9.md diff --git a/book/src/framework/configuration.md b/book/src/framework/configuration.md index d011caae4..4c3725123 100644 --- a/book/src/framework/configuration.md +++ b/book/src/framework/configuration.md @@ -10,6 +10,7 @@ | CTF_IGNORE_CRITICAL_LOGS | Ignore all logs that has CRIT,FATAL or PANIC levels (Chainlink nodes only!) | `true`, `false` | `false` | 🚫 | | CTF_CHAINLINK_IMAGE | Flag to override Chainlink Docker image in format $repository:$tag | $repository:$tag | - | 🚫 | | CTF_JD_IMAGE | Job distributor service image in format $repository:$tag | $repository:$tag | - | 🚫 | +| CTF_CLNODE_DLV | Use debug entrypoint to allow Delve debugger connection, works only with "plugins" image of CL node | `true`, `false` | `false` | 🚫 | | LOKI_URL | URL to `Loki` push api, should be like`${host}/loki/api/v1/push` | URL | `http://host.docker.internal:3030/loki/api/v1/push` | 🚫 | | LOKI_TENANT_ID | Streams all components logs to `Loki`, see params below | `string` | `promtail` | 🚫 | | LOKI_BASIC_AUTH | Basic auth in format $user:$password | `$user:$password` | - | 🚫 | diff --git a/framework/.changeset/v0.3.9.md b/framework/.changeset/v0.3.9.md new file mode 100644 index 000000000..b0bf8e511 --- /dev/null +++ b/framework/.changeset/v0.3.9.md @@ -0,0 +1,2 @@ +- Dlv from original image +- Fix logs for promtail \ No newline at end of file diff --git a/framework/docker.go b/framework/docker.go index 4f081fc66..086a365eb 100644 --- a/framework/docker.go +++ b/framework/docker.go @@ -264,8 +264,7 @@ func WriteAllContainersLogs(dir string) error { func BuildImageOnce(once *sync.Once, dctx, dfile, nameAndTag string) error { var err error once.Do(func() { - dfilePath := filepath.Join(dctx, dfile) - err = runCommand("docker", "build", "-t", nameAndTag, "-f", dfilePath, dctx) + err = BuildImage(dctx, dfile, nameAndTag) if err != nil { err = fmt.Errorf("failed to build Docker image: %w", err) } @@ -275,5 +274,9 @@ func BuildImageOnce(once *sync.Once, dctx, dfile, nameAndTag string) error { func BuildImage(dctx, dfile, nameAndTag string) error { dfilePath := filepath.Join(dctx, dfile) - return runCommand("docker", "build", "-t", nameAndTag, "-f", dfilePath, dctx) + if os.Getenv("CTF_CLNODE_DLV") == "true" { + return runCommand("docker", "build", "--build-arg", `GO_GCFLAGS=all=-N -l`, "-t", nameAndTag, "-f", dfilePath, dctx) + } else { + return runCommand("docker", "build", "-t", nameAndTag, "-f", dfilePath, dctx) + } } diff --git a/framework/promtail.go b/framework/promtail.go index adaf4aeba..7ffb99a84 100644 --- a/framework/promtail.go +++ b/framework/promtail.go @@ -59,7 +59,7 @@ scrape_configs: lokiTenantID := os.Getenv("LOKI_TENANT_ID") if lokiURL == "" { - lokiURL = "http://host.docker.internal:3100/loki/api/v1/push" + lokiURL = "http://host.docker.internal:3030/loki/api/v1/push" } if lokiTenantID == "" { lokiTenantID = "promtail"