Skip to content

[1/3] Make guest-agent buildable on FreeBSD#617

Merged
google-oss-prow[bot] merged 1 commit into
GoogleCloudPlatform:mainfrom
yagehu:yagehu/freebsd
Jun 9, 2026
Merged

[1/3] Make guest-agent buildable on FreeBSD#617
google-oss-prow[bot] merged 1 commit into
GoogleCloudPlatform:mainfrom
yagehu:yagehu/freebsd

Conversation

@yagehu

@yagehu yagehu commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Expected changes to Linux behavior: None

This commit, when paired with corresponding dependency patches, makes guest-agent buildable on FreeBSD. The plan is to incrementally fix guest-agent's behavior on FreeBSD.

The list of required dependency patches:

@google-oss-prow google-oss-prow Bot requested review from bkatyl and drewhli June 1, 2026 16:25
@yagehu yagehu requested a review from SaswatPadhi June 1, 2026 16:29
@yagehu yagehu changed the title Make guest-agent buildable on FreeBSD [1/2] Make guest-agent buildable on FreeBSD Jun 1, 2026
@yagehu yagehu changed the title [1/2] Make guest-agent buildable on FreeBSD [1/3] Make guest-agent buildable on FreeBSD Jun 1, 2026
@ChaitanyaKulkarni28

Copy link
Copy Markdown
Member

Thanks for the FreeBSD port! I notice significant duplication between the new _freebsd.go files and the existing Linux implementations. To improve maintainability and avoid logic drift, we should consider refactoring the common code into shared files.

Like for the agentcrypto package:

We can create a new file, mtls_mds_unix.go, with the build directive //go:build linux || freebsd

The identical constants (rootCACertFileName, clientCredsFileName) and helper functions (writeRootCACert, writeClientCredentials, getCAStoreUpdater, certificateDirFromUpdater) can be moved there.

This would leave mtls_mds_linux.go and mtls_mds_freebsd.go to only define their platform-specific defaultCredsDir and certUpdaters maps.

The command and sshtrustedca packages could be handled similarly and ensure that core logic is maintained in a single place.

What do you think? Was this duplication to avoid any impact on Linux/Windows implementations?

@google-oss-prow google-oss-prow Bot added size/XL and removed size/L labels Jun 2, 2026
This commit, when paired with corresponding dependency patches, makes
guest-agent buildable on FreeBSD. The plan is to incrementally fix
guest-agent's behavior on FreeBSD. Because this commit only introduces
files with the `_freebsd` suffix, it does not impact the current
behavior on Linux or Windows.

The list of required dependency patches:

- google/go-sev-guest#189
- google/go-tdx-guest#101
- tarm/serial#134
@yagehu

yagehu commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the FreeBSD port! I notice significant duplication between the new _freebsd.go files and the existing Linux implementations. To improve maintainability and avoid logic drift, we should consider refactoring the common code into shared files.

Like for the agentcrypto package:

We can create a new file, mtls_mds_unix.go, with the build directive //go:build linux || freebsd

The identical constants (rootCACertFileName, clientCredsFileName) and helper functions (writeRootCACert, writeClientCredentials, getCAStoreUpdater, certificateDirFromUpdater) can be moved there.

This would leave mtls_mds_linux.go and mtls_mds_freebsd.go to only define their platform-specific defaultCredsDir and certUpdaters maps.

The command and sshtrustedca packages could be handled similarly and ensure that core logic is maintained in a single place.

What do you think? Was this duplication to avoid any impact on Linux/Windows implementations?

Done. The original intent was to minimize disruption to the existing Linux code.

@SaswatPadhi

Copy link
Copy Markdown
Member

Thanks for the PR, @yagehu, and thanks for taking a look @ChaitanyaKulkarni28. I look at the changes and they LGTM -- mostly path tweaks for FreeBSD.

I think we could merge this, unless @ChaitanyaKulkarni28 has any remaining concerns (I'll leave it up to him for final approval).

@google-oss-prow google-oss-prow Bot added the lgtm label Jun 9, 2026
@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ChaitanyaKulkarni28, yagehu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [ChaitanyaKulkarni28]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow Bot merged commit 6d2c2d0 into GoogleCloudPlatform:main Jun 9, 2026
10 checks passed
@yagehu yagehu deleted the yagehu/freebsd branch June 15, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants