Skip to content

ROX-33792: perf(build): combine roxctl and roxagent builds per arch#19781

Closed
janisz wants to merge 1 commit intomasterfrom
combine_roxctl_and_roxagent_build
Closed

ROX-33792: perf(build): combine roxctl and roxagent builds per arch#19781
janisz wants to merge 1 commit intomasterfrom
combine_roxctl_and_roxagent_build

Conversation

@janisz
Copy link
Copy Markdown
Contributor

@janisz janisz commented Apr 2, 2026

Description

Build roxctl and roxagent together in a single go build invocation for each Linux architecture, following the pattern from main-build-nodeps.

Problem:

  • CLI builds invoked go build separately for roxctl and roxagent on each architecture
  • 8 separate build invocations for Linux (4 roxctl + 4 roxagent)
  • Go toolchain restarted for each binary
  • Common dependencies recompiled multiple times
  • No build cache sharing within same architecture

Solution:

  • Created cli_linux-% pattern rule that builds both binaries together
  • Single go build with multiple package paths: ./roxctl ./compliance/virtualmachines/roxagent
  • roxctl-linux and roxagent-linux now depend on combined targets
  • Preserves existing pattern rules for backward compatibility and darwin/windows builds

Performance (warm cache, 4 Linux architectures):

  • Old approach (separate builds): 10m 6s
  • New approach (sequential): 2m 18s → 4.4x faster
  • New approach (make -j 2): 1m 6s → 9.2x faster
  • New approach (make -j 4): 37s → 16.4x faster

Similar pattern used in:

User-facing documentation

Testing and quality

  • the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag
  • CI results are inspected

Automated testing

  • added unit tests
  • added e2e tests
  • added regression tests
  • added compatibility tests
  • modified existing tests

How I validated my change

CI

…ecture

Build roxctl and roxagent together in a single go build invocation for
each Linux architecture, following the pattern from main-build-nodeps.

Problem:
- CLI builds invoked go build separately for roxctl and roxagent on each
  architecture
- 8 separate build invocations for Linux (4 roxctl + 4 roxagent)
- Go toolchain restarted for each binary
- Common dependencies recompiled multiple times
- No build cache sharing within same architecture

Solution:
- Created cli_linux-% pattern rule that builds both binaries together
- Single go build with multiple package paths: ./roxctl ./compliance/virtualmachines/roxagent
- roxctl-linux and roxagent-linux now depend on combined targets
- Preserves existing pattern rules for backward compatibility and darwin/windows builds

Performance (warm cache, 4 Linux architectures):
- Old approach (separate builds): 10m 6s
- New approach (sequential): 2m 18s → 4.4x faster
- New approach (make -j 2): 1m 6s → 9.2x faster
- New approach (make -j 4): 37s → 16.4x faster

Similar pattern used in:
- main-build-nodeps: builds 9 binaries in one invocation
- PR #19417: consolidated operator build

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@janisz
Copy link
Copy Markdown
Contributor Author

janisz commented Apr 2, 2026

It's not that much faster in CI

@janisz janisz closed this Apr 2, 2026
@rhacs-bot
Copy link
Copy Markdown
Contributor

Images are ready for the commit at d087c94.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-530-gd087c946f5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants