fix(oracledb_exporter): Support CGO_ENABLED=0 cross-compilation#6168
Merged
Conversation
The oracledb integration imported github.com/oracle/oracle-db-appdev-monitoring/collector, which transitively pulls in github.com/godror/godror. godror requires CGO, so `cd collector && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build .` failed with "undefined: VersionInfo" and similar errors from godror's orahlp.go. Apply the existing loki.source.journal dual-file pattern: keep pure-Go config and helpers unconditional, move the godror-touching New() body behind //go:build cgo, and add a //go:build !cgo stub New() that returns a clear error so configs surface a meaningful message in no-cgo builds. Also add CI cross-compile jobs covering linux/amd64 and linux/arm64 on macos-15-xlarge: collector in test_mac.yml, pyroscope playground in test_pyroscope_pr.yml. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replace the goarch matrix on the new cross-compile jobs with sequential linux/amd64 + linux/arm64 build steps in a single job, and turn off setup-go caching on these jobs so they run from a clean module cache. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Merge the collector and pyroscope playground cross-compile jobs into one job in test_mac.yml with four sequential build steps (collector amd64/arm64, pyroscope playground amd64/arm64), and rename it to clarify the purpose: keeping mac-to-linux cross-compilation working for developers who build Alloy on macOS but test/run on linux. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Move CGO_ENABLED=0 and GOOS=linux to job-level env on the mac-to-linux cross-compile job, leaving only GOARCH inline. Drop step-level names from the four build steps so the run command itself labels them. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The job name already communicates the intent. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
thampiotr
reviewed
May 19, 2026
| - run: cd collector && GOARCH=amd64 go build . | ||
| - run: cd collector && GOARCH=arm64 go build . | ||
| - run: GOARCH=amd64 go build ./internal/component/pyroscope/util/internal/cmd/playground | ||
| - run: GOARCH=arm64 go build ./internal/component/pyroscope/util/internal/cmd/playground |
Contributor
There was a problem hiding this comment.
Would only one arch here be sufficient?
thampiotr
reviewed
May 19, 2026
thampiotr
approved these changes
May 20, 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.
The oracledb integration imported github.com/oracle/oracle-db-appdev-monitoring/collector, which transitively pulls in github.com/godror/godror. godror requires CGO, so
cd collector && CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build .failed with "undefined: VersionInfo" and similar errors from godror's orahlp.go.The fix follows the existing loki.source.journal dual-file pattern: pure-Go config and helpers stay unconditional, the godror import and New() body move behind
//go:build cgo, and a//go:build !cgostub New() returns a clear error so configs surface a meaningful message in no-cgo builds.To prevent regressions, two new CI jobs cross-compile the collector (in test_mac.yml) and the pyroscope playground (in test_pyroscope_pr.yml) for linux/amd64 and linux/arm64 with CGO_ENABLED=0 on macos-15-xlarge.