From 86f6f7657a496ec3be1ddd5eac0a673c7762bd6d Mon Sep 17 00:00:00 2001 From: Alejandro <61026152+amalavet@users.noreply.github.com> Date: Tue, 27 Jan 2026 17:14:33 -0600 Subject: [PATCH] fix: modify the grafana dev build (#116872) * ale/debug * undo change and ignore local cert * fix flag * cleanup --- .dockerignore | 1 + .gitignore | 1 + pkg/build/cmd.go | 13 ++++++++----- pkg/build/opts.go | 2 ++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.dockerignore b/.dockerignore index 191b8881ded..baf9cd046c6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,6 +5,7 @@ .vscode bin !bin/grafana-linux-k8s +!bin/grafana-linux-k8s-debug data* dist docker diff --git a/.gitignore b/.gitignore index e0bd0bf8e6e..36162236c77 100644 --- a/.gitignore +++ b/.gitignore @@ -264,3 +264,4 @@ public/mockServiceWorker.js .hippo coverage-summary.json +devenv/blocks/auth/signer/keys/ec_private_key.pem diff --git a/pkg/build/cmd.go b/pkg/build/cmd.go index c3b9ec0bc50..0e1666f8942 100644 --- a/pkg/build/cmd.go +++ b/pkg/build/cmd.go @@ -102,7 +102,7 @@ func RunCmd() int { } case "build": - //clean() + // clean() for _, binary := range binaries { log.Println("building binaries", cmd) // Can't use filepath.Join here because filepath.Join calls filepath.Clean, which removes the `./` from this path, which upsets `go build` @@ -154,6 +154,10 @@ func setup(goos string) { } func doBuild(binaryName, pkg string, opts BuildOpts) error { + if opts.binarySuffix != "" { + binaryName += "-" + opts.binarySuffix + } + log.Println("building", binaryName, pkg) if err := setBuildEnv(opts); err != nil { @@ -166,7 +170,7 @@ func doBuild(binaryName, pkg string, opts BuildOpts) error { } binary := fmt.Sprintf("./bin/%s", binaryName) - //don't include os/arch/libc in output path in dev environment + // don't include os/arch/libc in output path in dev environment if !opts.isDev { binary = fmt.Sprintf("./bin/%s-%s%s/%s", opts.goos, opts.goarch, libcPart, binaryName) } @@ -289,9 +293,8 @@ func setBuildEnv(opts BuildOpts) error { } } - if (opts.goos != GoOSLinux || opts.goarch != "amd64") && - opts.goos != GoOSDarwin { - // needed for archs other than linux/amd64 and darwin/arm64 + darwin/amd64 + if opts.goos != GoOSLinux && opts.goos != GoOSDarwin { + // needed for archs other than linux/amd64, linux/arm64, darwin/arm64 and darwin/amd64 opts.cgo = true } diff --git a/pkg/build/opts.go b/pkg/build/opts.go index 8e5486d22d1..6ec61fcc5dc 100644 --- a/pkg/build/opts.go +++ b/pkg/build/opts.go @@ -26,6 +26,7 @@ type BuildOpts struct { skipRpmGen bool skipDebGen bool printGenVersion bool + binarySuffix string } // BuildOptsFromFlags reads the cmd args to assemble a BuildOpts object. This function calls flag.Parse() @@ -50,6 +51,7 @@ func BuildOptsFromFlags() BuildOpts { flag.BoolVar(&opts.skipRpmGen, "skipRpm", false, "skip rpm package generation (default: false)") flag.BoolVar(&opts.skipDebGen, "skipDeb", false, "skip deb package generation (default: false)") flag.BoolVar(&opts.printGenVersion, "gen-version", false, "generate Grafana version and output (default: false)") + flag.StringVar(&opts.binarySuffix, "suffix", "", "suffix to append to binary name") flag.Parse() opts.buildID = shortenBuildID(buildIDRaw)