CI pipeline is slow #35
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
keyop-go/nfq_forwarder#35
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The CI pipeline takes a long time at the moment, and shouldn't need to.
We can probably pre-install some of the required tools in the image (image is at https://gitlab.keyop.co.uk/keyop/docker/golang-ci.git). Also check if there are any other efficiencies to be gained by restructuring the CI pipeline in any way.
changed the description
mentioned in commit
6622234467mentioned in merge request !76
In-repo fixes up for review: !76 (branch
issue35_speed_up_ci_pipeline) - splits the Makefile'ssetuptarget so each job only installs the one tool it actually needs, and adds Go module/build caching to.gitlab-ci.yml. See the MR description for the full trace-log timing breakdown that motivated this - the short version:go install .../goreleaser/v2@latest+go install .../gitleaks/v8@latesttogether accounted for ~2 of a ~2.5 minute job, by far the dominant cost, since neither is baked into the image.Suggested changes for
registry.keyop.co.uk/keyop/docker/golang-ci(I don't have access to that project to make these myself):Bake in pinned
goreleaserandgitleaksbinaries - this is the big one, worth ~2 minutes per job on its own. Something like, in the Dockerfile:(pin to specific versions rather than
@latest- this project's own Makefile currently floats to@latesttoo, which is a separate, pre-existing minor risk worth fixing at the same time: an image rebuild could otherwise silently pick up a new major version of either tool with no warning). Once these are on$PATHin the image, this project'sMakefileneeds no changes at all -setup-goreleaser/setup-gitleaks'scommand -vguards (from !76) already skip thego installentirely when the binary is already present.Bake in
libpam0g-dev,yamllint, andiptables(apt packages) - smaller win (~6-7s/job) but same principle. Once present,.gitlab-ci.yml's defensive package-check (also from !76) automatically shrinks to a no-op with no further change needed on this side either.Worth checking whether the image already has Go's own build cache warmed with this module's dependencies (or a generic warm cache from building typical Go projects) - if the image is rebuilt periodically, priming
$GOPATH/pkg/mod/$GOCACHEwith a representativego mod download/go buildduring the image build could shave additional time off the very first pipeline run against a fresh image, though !76's.gitlab-ci.ymlcache should handle every run after that regardless.Once (1) and (2) land in the image and a new tag is rolled out, the only remaining
.gitlab-ci.ymlchange needed here would be bumping the pinned image tag (currentlyregistry.keyop.co.uk/keyop/docker/golang-ci:1.26.4) - happy to do that once you let me know the new tag is ready.Submitted the golang-ci image fix: golang-ci MR !46 (assignee/reviewer set the same way as this project's MRs). Turned out to be more than just "add the missing tools" - while testing a real
docker buildagainst the current Dockerfile, found it's actually broken today: the existingcurl/makeversion pins are stale (Debian bookworm versions against what's now a trixie-based image) andlibpam0g-devwas never actually being installed at all due to a syntax bug (a colon instead of=, placed outside the actual install command) - which explains why this project's own CI has had to apt-get install it directly all along. Fixed both, added yamllint/iptables, and baked in pinned goreleaser/gitleaks. Verified with a real local Docker build (not just reviewed by eye) - every tool confirmed present and functional in the built image, including a real gitleaks scan. See the golang-ci MR for full detail.mentioned in commit
c4dbec2115mentioned in commit
8432b95b7aMerged via !76 (merge commit
8432b95). No release for this one - CI-only change, per Danny. Confirmed the speedup materialized: lint/build jobs went from ~150-156s each (pre-fix baseline) to ~16-18s each on pipeline 402 - roughly a 9x improvement, combining the golang-ci image bake-in (golang-ci !46) with the in-repo Go module/build caching.mentioned in issue #27