fix(garm): build openstack provider as static binary - #269
Merged
Conversation
The garm-provider-openstack binary in the bare-base rock was built dynamically linked: with cgo enabled and the net package imported, Go links glibc's NSS resolvers dynamically via the internal linker, which ignores -extldflags -static. On a bare rock there is no dynamic loader, so GARM failed to exec it with 'fork/exec ...: no such file or directory' during runner consolidation and never spawned runners -- while the charm still reported active. Build the provider with CGO_ENABLED=0 to force a fully static, pure-Go binary, matching how the garm part avoids the same issue.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the GARM rock build so the garm-provider-openstack binary is built as a fully static (pure-Go) executable by forcing CGO_ENABLED=0, addressing runtime failures on the bare base where dynamically linked binaries cannot be exec’d due to the missing ELF interpreter.
Changes:
- Set
CGO_ENABLED=0for thegarm-provider-openstackpart and remove the ineffective-extldflags -staticusage for that binary. - Add a changelog entry documenting the runner provisioning fix and the root cause.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
garm-rockcraft.yaml |
Forces a pure-Go, static build of garm-provider-openstack suitable for base: bare and removes an ldflag that was not achieving static linking. |
docs/changelog.md |
Documents the user-visible impact and the build change that fixes provider execution. |
cbartz
marked this pull request as ready for review
July 8, 2026 12:12
cbartz
requested review from
florentianayuwono,
javierdelapuente,
weiiwang01,
yanksyoon and
yhaliaw
as code owners
July 8, 2026 12:12
florentianayuwono
approved these changes
Jul 8, 2026
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.
What this PR does
Builds the
garm-provider-openstackbinary in the GARM rock withCGO_ENABLED=0so it is a fully static, pure-Go binary, and drops the ineffective-extldflags -staticldflag.Why we need it
On the deployed
garmcharm, runner consolidation failed with:The binary was present but dynamically linked: with cgo enabled (default) and the
netpackage imported, Go links glibc's NSS resolvers dynamically via its internal linker, which never invokes the external linker — so the existing-extldflags -staticwas silently ignored. The rock uses abarebase with no dynamic loader/libc, so GARM could notexecit and no runners were spawned — while the charm still reportedactive(the charm doesn't scrape GARM's runtime logs). Thegarmbinary avoids this via itsosusergo,netgotags; the provider had neither those norCGO_ENABLED=0.Test plan
go build -ldflags "-extldflags -static", cgo default) →dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2.CGO_ENABLED=0 go build) →statically linked, no ELF interpreter.build-garm-rock.sh), extracted the provider from the OCI layer → confirmedstatically linked, no interp.Review focus
CGO_ENABLED=0over addingosusergo,netgotags: the OpenStack provider is pure Go with no cgo dependency (unlike garm's sqlite), so disabling cgo outright is the simplest guarantee and removes any reliance on the external linker honouring-static.Potential breaking changes / new dependencies
None. Build-only change; no new modules, APIs, or workflow changes.
Checklist
CONTRIBUTING.mdhas been updated upon changes to the contribution/development process (e.g. changes to the way tests are run) — N/Adocs/changelog.mdwith user-relevant changesterraform fmtpasses andtflintreports no errors — N/A0.1and prior rock fixes (e.g. fix(garm): add CA trust store to bare rock so GARM can verify TLS #257) did not bump it; left unchanged for consistencyAGENTS.md— N/A.copilot-collections.yamlor.github/instructions/: I re-checked whether theAGENTS.md"12-factor divergences" guidance still matches the upstream copilot-collections guidance — N/A