Repository navigation
build(vendor): restore the go-tpm-tools sources the TPM simulator needs - #21
Merged
Merged
Conversation
`go mod vendor` drops the C sources of github.com/google/go-tpm-tools, so
the vendored simulator does not compile with cgo ("Platform.h: No such
file or directory"). Upstream's `make vendor` re-extracts the release
tarball of the go.mod version into vendor/ for exactly this reason. The
fork lost those files when it was re-vendored with plain `go mod vendor`
in 6945ef4, and every branch since has inherited that.
Extract the v0.4.9 tarball the way the `vendor` target does. Files are
only added: the 7 Go files already vendored are identical. Some of them
match go-tpm-tools' own .gitignore, among them TPMCmd/tpm/src/main/*.c,
which the simulator includes, so they are added with -f; upstream tracks
them too. go.mod, go.sum and vendor/modules.txt do not change.
Release builds are not affected: the operator is built with
CGO_ENABLED=0, and os-build restores the same sources before it builds
elemental-register. This fixes the cgo unit tests (pkg/install,
pkg/register, pkg/server, pkg/tpm, cmd/operator, cmd/register), which
failed to compile in CI.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
The first CI run on the fork (run 45965358394, on #20) failed: six Ginkgo suites did not compile.
go mod vendordrops the C sources ofgithub.com/google/go-tpm-tools. Upstream'smake vendorre-extracts the release tarball of the go.mod version intovendor/for this reason, and upstreamv1.9.xtracks 451.h/.cfiles there. The fork kept only one: it was re-vendored with plaingo mod vendorin 6945ef4 ("support alauda baremetal"). Every branch since inherits that, including1.9.1-alaudaand1.9.1-alauda-4.6. The local test runs in #15, #16 and #18 had to work around it with-mod=mod.What
The
vendortarget's extraction step, forGO_TPM_TAG=v0.4.9(from go.mod):vendor/github.com/google/go-tpm-tools/changes: go.mod, go.sum andvendor/modules.txtare untouched..gitignoreand were added with-f:simulator/ms-tpm-20-ref/TPMCmd/tpm/src/main/*.c(the simulator#includes them),cmd/gotpm/,go.workandgo.work.sum. Upstream tracks these too. All 840 files of the tarball are tracked.a2eb3739afa65b60c351550c6c0541f17c5af6a22837da3690fcd6e44ef354bf.Impact
Test-only. Release builds already avoid the missing files:
CGO_ENABLED=0;Dockerfile.registerdownloads the same tarball before it builds elemental-register with cgo.Consumers do not need to move their pins for this.
Verification
Local, from vendor only (
GOFLAGS=-mod=vendor GOPROXY=off CGO_ENABLED=1):go build ./...andgo veton the affected packages: OK. The only output is the knownfunction main is undeclaredfor the generator-onlygenerate.goandutils/mockgen.go.go test -raceon the six suites that failed to compile in CI:pkg/tpm,pkg/install,pkg/server,cmd/operator/operatorandcmd/registerpass.pkg/registerpasses 61 of 64. The 3 failures are the knowncannot retrieve MAC address from any network interfacein this NIC-less container, the same 3 that fail on the base commit.This PR's own Unit tests run is the real check: GitHub runners have a NIC and envtest, so all 16 suites should run.
After merge: merge
1.9.1-alauda-4.5forward into1.9.1-alauda-4.6, then bring that into #20.🤖 Generated with Claude Code