[build]: Reduce duplicate compilation in CI - #4812
Draft
theasianpianist wants to merge 1 commit into
Draft
Conversation
Reuse common cfgmgr and P4 orchagent objects through static archives. Build unit-test binaries only for check targets so Trixie package jobs can use DEB_BUILD_OPTIONS=nocheck without compiling redundant tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: f289b446-dbae-48ba-8d0a-dc02083cdf07 Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
Collaborator
|
/azp run |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR optimizes the SWSS autotools build and Azure CI pipeline to reduce duplicate compilations (notably in orchagent/P4 and cfgmgr paths) and keep CI runtimes under timeout by reusing newly introduced static convenience archives and selectively skipping unit-test execution in Trixie package builds.
Changes:
- Introduce reusable static archives (
libcfgmgrcommon.a,libp4orchshared.a) to compile shared sources once and link them into multiple binaries. - Move unit-test binaries from
noinst_PROGRAMStocheck_PROGRAMSso they compile only duringmake check(and can be skipped viaDEB_BUILD_OPTIONS=nocheck). - Add an Azure pipeline parameter to disable unit tests for Trixie package builds and skip publishing test results when tests are intentionally not run.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/mock_tests/Makefile.am | Switch unit-test targets to check_PROGRAMS to avoid building them during the normal make all path. |
| tests/Makefile.am | Convert the tests binary to check_PROGRAMS so it builds/runs only under make check. |
| orchagent/p4orch/tests/Makefile.am | Add libp4orchshared.a and link it into p4orch_tests; keep test-only objects at -O0. |
| orchagent/p4orch/shared_sources.mk | Define a shared source list for orchagent/P4 code to be compiled once into an archive. |
| orchagent/Makefile.am | Link orchagent against the shared archive and add build dependency wiring. |
| configure.ac | Add AM_PROG_AR to support building new static archives reliably. |
| cfgmgr/Makefile.am | Build common cfgmgr framework sources once as libcfgmgrcommon.a and link it into cfgmgr daemons. |
| azure-pipelines.yml | Disable unit tests in the Trixie build stages via a new template parameter. |
| .azure-pipelines/build-template.yml | Implement run_unit_tests parameter: set DEB_BUILD_OPTIONS=nocheck when false and gate test publishing accordingly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Recent SWSS jobs are approaching or exceeding the 60-minute CI timeout. Azure logs showed ASAN compilation at 48-53 minutes and Trixie compilation varying from 33 minutes to over 53 minutes. A timed-out Trixie job spent 32.6 minutes in orchagent compilation and another 9.7 minutes compiling mock tests before cancellation.
What changed
libcfgmgrcommon.ainstead of once per daemon.libp4orchshared.a.-O0while production objects retain the package optimization level.noinst_PROGRAMStocheck_PROGRAMS.DEB_BUILD_OPTIONS=nocheckfor Trixie package jobs, while primary Bookworm and ASAN jobs retain unit-test execution.Measured impact
In a container constrained to the CI agents' 4 CPUs and 32 GiB:
nocheckpackage buildValidation
master(4f3dda15)../autogen.shRUSTFLAGS=-Dwarnings dpkg-buildpackage -us -uc -b -j$(nproc)DEB_BUILD_OPTIONS=nocheckpackage generation completed successfully.