From 5a7aed56bc5871872f249e664b4b863e5d3b1550 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Mar 2026 07:52:23 +0000 Subject: [PATCH 1/6] Initial plan From 29e114cbeeb21e13bbf2eefee1f8d307ffd4d6f7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Mar 2026 08:06:07 +0000 Subject: [PATCH 2/6] Add build optimization flags to Makefile and e2e test helper to reduce binary sizes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add -trimpath and -ldflags="-s -w" to all Makefile build targets and the e2e test binary builder, matching the flags already used by goreleaser for release builds. This strips the symbol table, DWARF debug info, and file system paths from binaries. Main binary size: 86MB → 62MB (~28% reduction) Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com> --- Makefile | 15 +++++++++------ tests/e2e/internal/testutil/testutil.go | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 385bf1a9..7bb0439a 100644 --- a/Makefile +++ b/Makefile @@ -21,35 +21,38 @@ help: @echo " make serve-docs - Generate and serve CLI documentation" @echo " make clean - Remove built artifacts" +# Build flags to reduce binary size (strip symbols, debug info, and file paths) +GO_BUILD_FLAGS = -trimpath -ldflags="-s -w" + # Build the main pipeleek binary build: @echo "Building pipeleek..." - CGO_ENABLED=0 go build -o pipeleek ./cmd/pipeleek + CGO_ENABLED=0 go build $(GO_BUILD_FLAGS) -o pipeleek ./cmd/pipeleek # Build GitLab-specific binary build-gitlab: @echo "Building pipeleek-gitlab..." - CGO_ENABLED=0 go build -o pipeleek-gitlab ./cmd/pipeleek-gitlab + CGO_ENABLED=0 go build $(GO_BUILD_FLAGS) -o pipeleek-gitlab ./cmd/pipeleek-gitlab # Build GitHub-specific binary build-github: @echo "Building pipeleek-github..." - CGO_ENABLED=0 go build -o pipeleek-github ./cmd/pipeleek-github + CGO_ENABLED=0 go build $(GO_BUILD_FLAGS) -o pipeleek-github ./cmd/pipeleek-github # Build BitBucket-specific binary build-bitbucket: @echo "Building pipeleek-bitbucket..." - CGO_ENABLED=0 go build -o pipeleek-bitbucket ./cmd/pipeleek-bitbucket + CGO_ENABLED=0 go build $(GO_BUILD_FLAGS) -o pipeleek-bitbucket ./cmd/pipeleek-bitbucket # Build Azure DevOps-specific binary build-devops: @echo "Building pipeleek-devops..." - CGO_ENABLED=0 go build -o pipeleek-devops ./cmd/pipeleek-devops + CGO_ENABLED=0 go build $(GO_BUILD_FLAGS) -o pipeleek-devops ./cmd/pipeleek-devops # Build Gitea-specific binary build-gitea: @echo "Building pipeleek-gitea..." - CGO_ENABLED=0 go build -o pipeleek-gitea ./cmd/pipeleek-gitea + CGO_ENABLED=0 go build $(GO_BUILD_FLAGS) -o pipeleek-gitea ./cmd/pipeleek-gitea # Build all binaries build-all: build build-gitlab build-github build-bitbucket build-devops build-gitea diff --git a/tests/e2e/internal/testutil/testutil.go b/tests/e2e/internal/testutil/testutil.go index bd06fdcf..75ca0163 100644 --- a/tests/e2e/internal/testutil/testutil.go +++ b/tests/e2e/internal/testutil/testutil.go @@ -159,7 +159,7 @@ var ( ) func buildBinary(moduleDir, outputPath string) error { - cmd := exec.Command("go", "build", "-o", outputPath, "./cmd/pipeleek") + cmd := exec.Command("go", "build", "-trimpath", "-ldflags=-s -w", "-o", outputPath, "./cmd/pipeleek") cmd.Dir = moduleDir cmd.Env = os.Environ() return cmd.Run() From b9b024fbfe97bd5638b23827ec3a6ff586dcbbcb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Mar 2026 08:43:41 +0000 Subject: [PATCH 3/6] Improve test speed and reduce release artifact sizes - Fix Windows CI e2e build: add -trimpath -ldflags="-s -w" flags to match Linux/Makefile behavior (~15% faster build, ~28% smaller binary) - Switch goreleaser release format from raw binaries to compressed archives (tar.gz for Linux/macOS, zip for Windows) reducing release download size from 62MB to ~20MB per artifact (68% reduction) Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com> --- .github/workflows/test.yml | 2 +- goreleaser.yaml | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 77fc2493..07e9f124 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -64,7 +64,7 @@ jobs: - name: Build pipeleek binary for e2e tests (Windows) if: runner.os == 'Windows' - run: go build -o pipeleek.exe ./cmd/pipeleek + run: CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o pipeleek.exe ./cmd/pipeleek - name: Run e2e tests (Linux) if: runner.os == 'Linux' diff --git a/goreleaser.yaml b/goreleaser.yaml index 0470053c..22b6bb96 100644 --- a/goreleaser.yaml +++ b/goreleaser.yaml @@ -129,7 +129,12 @@ builds: - -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Date={{.Date}} archives: - - formats: binary + - formats: + - tar.gz + format_overrides: + - goos: windows + formats: + - zip name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" release: From 72d52a20746e3c8f4721892a745104d928e859b8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 9 Mar 2026 12:15:05 +0000 Subject: [PATCH 4/6] Revert goreleaser.yaml archives to direct binary format Restores `formats: binary` instead of tar.gz/zip compressed archives, so release binaries are published directly without wrapping. Co-authored-by: frjcomp <107982661+frjcomp@users.noreply.github.com> --- goreleaser.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/goreleaser.yaml b/goreleaser.yaml index 22b6bb96..0470053c 100644 --- a/goreleaser.yaml +++ b/goreleaser.yaml @@ -129,12 +129,7 @@ builds: - -X github.com/CompassSecurity/pipeleek/internal/cmd/common.Date={{.Date}} archives: - - formats: - - tar.gz - format_overrides: - - goos: windows - formats: - - zip + - formats: binary name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" release: From e800b7ff7a9ad66a7050cc819a6045683cb6415c Mon Sep 17 00:00:00 2001 From: frjcomp <107982661+frjcomp@users.noreply.github.com> Date: Mon, 9 Mar 2026 14:07:05 +0100 Subject: [PATCH 5/6] Update .github/workflows/test.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 07e9f124..d1764708 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -64,7 +64,9 @@ jobs: - name: Build pipeleek binary for e2e tests (Windows) if: runner.os == 'Windows' - run: CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o pipeleek.exe ./cmd/pipeleek + env: + CGO_ENABLED: 0 + run: go build -trimpath -ldflags="-s -w" -o pipeleek.exe ./cmd/pipeleek - name: Run e2e tests (Linux) if: runner.os == 'Linux' From 70c4f697e8a4bf96f86a3656324e33e00074c2b9 Mon Sep 17 00:00:00 2001 From: frjcomp <107982661+frjcomp@users.noreply.github.com> Date: Mon, 9 Mar 2026 14:07:33 +0100 Subject: [PATCH 6/6] Update tests/e2e/internal/testutil/testutil.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- tests/e2e/internal/testutil/testutil.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/e2e/internal/testutil/testutil.go b/tests/e2e/internal/testutil/testutil.go index 75ca0163..68e84b67 100644 --- a/tests/e2e/internal/testutil/testutil.go +++ b/tests/e2e/internal/testutil/testutil.go @@ -161,7 +161,18 @@ var ( func buildBinary(moduleDir, outputPath string) error { cmd := exec.Command("go", "build", "-trimpath", "-ldflags=-s -w", "-o", outputPath, "./cmd/pipeleek") cmd.Dir = moduleDir - cmd.Env = os.Environ() + + // Ensure CGO is disabled so the e2e-built binary matches Makefile/CI builds. + env := os.Environ() + filteredEnv := make([]string, 0, len(env)+1) + for _, kv := range env { + if strings.HasPrefix(kv, "CGO_ENABLED=") { + continue + } + filteredEnv = append(filteredEnv, kv) + } + filteredEnv = append(filteredEnv, "CGO_ENABLED=0") + cmd.Env = filteredEnv return cmd.Run() }