From 49b4f295bd793ad9db579a042c4c899d1dd3d5a9 Mon Sep 17 00:00:00 2001 From: Craig MacKenzie Date: Fri, 17 Jan 2025 16:46:59 -0500 Subject: [PATCH 1/2] Only log links on error. --- dev-tools/mage/gotool/linkcheck.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dev-tools/mage/gotool/linkcheck.go b/dev-tools/mage/gotool/linkcheck.go index 0f7989ded88..4bc5f0d3e34 100644 --- a/dev-tools/mage/gotool/linkcheck.go +++ b/dev-tools/mage/gotool/linkcheck.go @@ -5,6 +5,8 @@ package gotool import ( + "fmt" + "github.com/magefile/mage/sh" ) @@ -15,7 +17,13 @@ var LinkCheck goLinkCheck = runGoLinkCheck func runGoLinkCheck(opts ...ArgOpt) error { args := buildArgs(opts).build() - return sh.RunV("link-patrol", args...) + output, err := sh.Output("link-patrol", args...) + if err != nil { + fmt.Println(output) + return err + } + + return nil } func (goLinkCheck) Path(path string) ArgOpt { return flagArgIf("-f", path) } From b7be221e3002be864d1054bade5e94b519f14736 Mon Sep 17 00:00:00 2001 From: Craig MacKenzie Date: Fri, 17 Jan 2025 16:55:23 -0500 Subject: [PATCH 2/2] Fix failing to pack fleet config file. --- dev-tools/cmd/buildfleetcfg/buildfleetcfg.go | 7 +++---- internal/pkg/agent/application/configuration_embed.go | 2 +- magefile.go | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/dev-tools/cmd/buildfleetcfg/buildfleetcfg.go b/dev-tools/cmd/buildfleetcfg/buildfleetcfg.go index 612142382b1..8fd098579fe 100644 --- a/dev-tools/cmd/buildfleetcfg/buildfleetcfg.go +++ b/dev-tools/cmd/buildfleetcfg/buildfleetcfg.go @@ -25,9 +25,7 @@ var ( func init() { flag.StringVar(&input, "in", "", "config to embed") - if flag.Lookup("out") == nil { - flag.StringVar(&output, "out", "-", "Output path. \"-\" means writing to stdout") - } + flag.StringVar(&output, "output", "-", "Output path. \"-\" means writing to stdout") flag.StringVar(&license, "license", "Elasticv2", "License header for generated file.") } @@ -85,7 +83,8 @@ func main() { err = os.WriteFile(output, data, 0640) if err != nil { - fmt.Fprintf(os.Stderr, "Error while writing the file, err: %+v\n", err) + fmt.Fprintf(os.Stderr, "Error while writing the file to '%s', err: %+v\n", output, err) + os.Exit(1) } return diff --git a/internal/pkg/agent/application/configuration_embed.go b/internal/pkg/agent/application/configuration_embed.go index 3787b97f1c3..951a2e25b1b 100644 --- a/internal/pkg/agent/application/configuration_embed.go +++ b/internal/pkg/agent/application/configuration_embed.go @@ -15,7 +15,7 @@ var DefaultAgentFleetConfig []byte func init() { // Packed File // _meta/elastic-agent.fleet.yml - unpacked := packer.MustUnpack("eJycVUuTo7oV3udnzD43PIauITsLN0KModO4jZA2KSS5BbaEqWsDhlT+e0rgtrtv3aSmsmAjpPP4Huf869s/9f5S/m2vyvOl5n8t5b65/Pau9vvLb6NW3/7+DY0r/x9v1q99WxBR7CmuwzNa/+Kbx/cTjSCgOLT4CFo+ggNzPF1iYXOdH1GUdxTmI3qmZ4pzaxMAj7k7SZywQzBTVKuObsGFuamFolSJKGuZFlNQJ5I2cc+2wCrhTm4dVRPsVSjM400N6D1GlA8Uhhad76kJQdoyuJMC/pDE8TuqVSOKWKEoO9EtmGiRWSX2Gj6a+6Fl8hDzH3q9CMAkCjAwN7YofpWkOcpMXxUtXrtAL/W/yJNEMO8Ijs8Uvz6hKBsF3v2c42ChWPPaUei7TF97gl+fzDkKVgcUpb0o4gPdgp7WS0+kiK0S04q42bQJwEiL0C6LWPERKAbDSUB1QPDals5OctfkSa25Fxh2NAAdwXbLNJfMIVLASiEYt0yHY4nz6Z4X7jo6rnrhqLkuPtrfX9ak22s1LHfAxNx8JE6e747HJxTEJxFlA59O/cYJRwGVJji1+Ojda9rotN84WS8c78yc8MhHv174/1E/+gWVgHLmYakta7nODwL64347a8QiWHWGCwQfsQzuHIaH0gkbWiQ/0biSKMoqroUSoX80+BA363ljakXHvTvn6YwGSGH1D+yzCcnTAQUriQzX2Fb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ZBNOGUJj7wIhsfOiK/Ezqe3k28viyv6+VDowsr6k4U5IJTMMh2U4mWXJgh9o59lAiGYsoUhz3TMsy0vM7vBYWLIpzefcUv66ur/fRi3glKBlVsKm5ii1HmePRm70Va2U+z9jhVJ04X1QP/nGu9CDeVDMlhOgu4L9Ateq/1nhcK1Z384LcP+++5fccovvJiNevUPPJyLGmup7xE3ypuYCdSYvlmxnbn9IdC+sJp7KuXU7UewZg4fyPYchp5r+1Kq3QVvT09r4WBjUCuZq4VItZpN3k0qLXz6eSnInf76Oa4ijAbS5dr20WVI2JYQc4qmf4zzpN8u7jr+N/59+4PaYgnjdbSjw8iJL3LVInIoaS8c72fmsYGp9PM3cT5N/ctgL5I5x1Y28Wj5s7VbI8uz33hfBGwar0FF05h77RRCQhLejtj5HL+XpO6e5Getd9VjHKPF3g+Q7wu6c2XZve+JxMPLjeLIBsUjZw/P+x87rIvwml25TTruMNnwZHTW+24Ew24SAsaXuQhp6T/v7jG9yy5v//t9OHM9fLrPYzfa3/mjsJFSX1fbP9o7+X1074EM663ZumLzcM3cJ+CQRjSK6Tdnh954bzpvjVknHajyE+OS47ImRXHqbZKV5oVudv72n2/Ptd4akkC7ZXJclyn68d7RqMjfvngndFxsjzjF3Z9TX6Xv7/DxA08y2D37suFRHHv9qGk8PzW3H27Of3ty7//9J8AAAD//zmvIS8=") raw, ok := unpacked["_meta/elastic-agent.fleet.yml"] if !ok { // ensure we have something loaded. diff --git a/magefile.go b/magefile.go index 4bfa58b704a..ed80a77b7c1 100644 --- a/magefile.go +++ b/magefile.go @@ -751,7 +751,7 @@ func BuildFleetCfg() error { out := filepath.Join("internal", "pkg", "agent", "application", "configuration_embed.go") fmt.Printf(">> BuildFleetCfg %s to %s\n", in, out) - return RunGo("run", goF, "--in", in, "--out", out) + return RunGo("run", goF, "--in", in, "--output", out) } // Enroll runs agent which enrolls before running.