Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version information and fix cloudbuild #455

Merged
merged 1 commit into from
May 30, 2024
Merged

Conversation

jkl73
Copy link
Contributor

@jkl73 jkl73 commented May 22, 2024

  • gotpm cmd can now shows version info:
$ go-tpm-tools_linux_amd64_v1/go-tpm-tools -v
gotpm version 0.4.4, commit 2dca42d8bece8ce657cd972d4451e3ba803b8e96, built at 2024-05-22T20:46:34Z
- go-sev-guest version v0.3.1
- go-tdx-guest version v0.9.3
  • launcher will also show build commit in the welcome message.

  • update launcher cloudbuild to go1.21 to match its go.mod

  • add "sync" at the end of the preload.sh file to fix (hopefully) the empty files in OEM partition when building the image.

/usr/share/oem/confidential_space $ ls -althr
total 80M
drwxr-xr-x 4 root root 4.0K May 28 20:51 ..
-rwxr-xr-x 1 root root  55M May 28 20:51 confidential_space_experiments
-rwxr-xr-x 1 root root  26M May 28 20:51 cs_container_launcher
-rw-r--r-- 1 root root    0 May 28 20:51 container-runner.service
-rwxr-xr-x 1 root root    0 May 28 20:51 exit_script.sh
-rw-r--r-- 1 root root    0 May 28 20:51 fluent-bit-cs.conf
-rw-r--r-- 1 root root    0 May 28 20:51 system-stats-monitor-cs.json
-rw-r--r-- 1 root root    0 May 28 20:51 boot-disk-size-consistency-monitor-cs.json
-rw-r--r-- 1 root root    0 May 28 20:51 docker-monitor-cs.json
-rw-r--r-- 1 root root    0 May 28 20:51 kernel-monitor-cs.json
drwxr-xr-x 2 root root 4.0K May 28 20:51 .

@jkl73 jkl73 force-pushed the showversion branch 2 times, most recently from 2dca42d to 9234966 Compare May 22, 2024 20:51
@jkl73
Copy link
Contributor Author

jkl73 commented May 22, 2024

/gcbrun

@jkl73
Copy link
Contributor Author

jkl73 commented May 22, 2024

/gcbrun

@jkl73
Copy link
Contributor Author

jkl73 commented May 22, 2024

/gcbrun

1 similar comment
@jkl73
Copy link
Contributor Author

jkl73 commented May 23, 2024

/gcbrun

@jkl73
Copy link
Contributor Author

jkl73 commented May 23, 2024

/gcbrun

@jkl73
Copy link
Contributor Author

jkl73 commented May 24, 2024

/gcbrun

@jkl73
Copy link
Contributor Author

jkl73 commented May 24, 2024

/gcbrun

@jkl73
Copy link
Contributor Author

jkl73 commented May 28, 2024

/gcbrun

@jkl73
Copy link
Contributor Author

jkl73 commented May 29, 2024

/gcbrun

@jkl73
Copy link
Contributor Author

jkl73 commented May 29, 2024

/gcbrun

@jkl73 jkl73 changed the title Add version information to gotpm cmd and launcher Add version information and fix cloudbuild May 29, 2024
@jkl73 jkl73 requested review from alexmwu and michael-pregman May 29, 2024 21:56

"github.com/google/go-tpm-tools/cmd"
)

// GoReleaser will populates those fields
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does it do this? I see https://pkg.go.dev/runtime/debug#ReadBuildInfo, does GoReleaser fill that out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, by default these three will be populated https://goreleaser.com/cookbooks/using-main.version/

Comment on lines +14 to +17
version = "dev"
commit = "none"
date = "unknown"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does goreleaser populate these fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when building the binary, using ldflags:
https://goreleaser.com/cookbooks/using-main.version/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider adding a comment

@@ -128,6 +128,12 @@ main() {
"Only 'debug' and 'hardened' are supported."
exit 1
fi

# make sure files are copied
sync
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is syncing required? Should we only sync the copy directory?

Copy link
Contributor Author

@jkl73 jkl73 May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the symptom we saw in some image builds are files with 0 length in the OEM partition, I thought this might be because of files didn't copy through and the partition got umounted.

/usr/share/oem/confidential_space $ ls -althr
total 80M
drwxr-xr-x 4 root root 4.0K May 28 20:51 ..
-rwxr-xr-x 1 root root  55M May 28 20:51 confidential_space_experiments
-rwxr-xr-x 1 root root  26M May 28 20:51 cs_container_launcher
-rw-r--r-- 1 root root    0 May 28 20:51 container-runner.service
-rwxr-xr-x 1 root root    0 May 28 20:51 exit_script.sh
-rw-r--r-- 1 root root    0 May 28 20:51 fluent-bit-cs.conf
-rw-r--r-- 1 root root    0 May 28 20:51 system-stats-monitor-cs.json
-rw-r--r-- 1 root root    0 May 28 20:51 boot-disk-size-consistency-monitor-cs.json
-rw-r--r-- 1 root root    0 May 28 20:51 docker-monitor-cs.json
-rw-r--r-- 1 root root    0 May 28 20:51 kernel-monitor-cs.json
drwxr-xr-x 2 root root 4.0K May 28 20:51 .

Adding this to make sure all files are written to the disk.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed to sync the oem directory only

@jkl73
Copy link
Contributor Author

jkl73 commented May 29, 2024

/gcbrun

Comment on lines +14 to +17
version = "dev"
commit = "none"
date = "unknown"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider adding a comment

Verified

This commit was signed with the committer’s verified signature.
Fdawgs Frazer Smith
Upgrade launcher cloudbuild to golang 1.21
Fix cloudbuild with empty oem files
@jkl73 jkl73 merged commit 264c9b4 into google:main May 30, 2024
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants