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 for in-VM agent, shim, firecracker-conta… #377

Merged
merged 4 commits into from
Jan 20, 2020

Conversation

kzys
Copy link
Contributor

@kzys kzys commented Jan 9, 2020

Investigating issues like #370 will be easier if the agent can report
the version.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@kzys
Copy link
Contributor Author

kzys commented Jan 9, 2020

Right now, firecracker-containerd and firecracker-ctr have "some" version information.

% ./firecracker-control/cmd/containerd/firecracker-containerd -v                                    
containerd github.com/containerd/containerd 1.3.1+unknown                                           
% ./firecracker-control/cmd/containerd/firecracker-ctr -v                                           
ctr github.com/containerd/containerd 1.3.1+unknown                                                  

The shim is not having any.

% ./runtime/containerd-shim-aws-firecracker -h
Usage of ./runtime/containerd-shim-aws-firecracker:
  -address string
        grpc address back to main containerd
  -bundle string
        path to the bundle if not workdir
  -debug
        enable debug output in logs
  -httptest.serve string
        if non-empty, httptest.NewServer serves on this address and blocks
  -id string
        id of the task
  -namespace string
        namespace that owns the shim
  -publish-binary string
        path to publish binary (used for publishing events) (default "containerd")
  -socket string
        abstract socket path to serve
  -test.bench regexp
        run only benchmarks matching regexp
...

Copy link
Contributor

@samuelkarp samuelkarp left a comment

Choose a reason for hiding this comment

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

goimports is complaining, but other than the lint issue I think this code looks fine.

agent/main.go Outdated Show resolved Hide resolved
@kzys kzys changed the title Add -version flag to the in-VM agent Add version information for in-VM agent, shim, firecracker-containerd and firecracker-ctr Jan 9, 2020
@kzys kzys marked this pull request as ready for review January 9, 2020 19:47
kzys added 2 commits January 9, 2020 12:06
Investigating issues like firecracker-microvm#370 will be easier if the agent can report
the version.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
As like containerd's Makefile, we can fill out version.Revision to
make our life easier.

https://github.com/containerd/containerd/blob/0a1f2b40642e54ed06cd0a22cdf6025cbe70853c/Makefile#L24

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
samuelkarp
samuelkarp previously approved these changes Jan 9, 2020
@samuelkarp samuelkarp dismissed their stale review January 9, 2020 21:50

CI is failing

@kzys
Copy link
Contributor Author

kzys commented Jan 10, 2020

Because the shim's flag parsing is owned by containerd's shim package,
supporting -version/-v is not straightforward. Instead the binary logs
the version.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
Since the version strings won't be like "1.2.3", it would be better to
communicate the way we generate the strings.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
@kzys
Copy link
Contributor Author

kzys commented Jan 10, 2020

After the change, the shim will log the line like below;

time="2020-01-10T20:49:24.643207368Z" level=info msg="successfully started shim (git commit: a731d81a6313ba8d78036e6bf976808554f442eb)." runtime=aws.firecracker task_id=container-TestStopVM_Isolated_ErrorExit vmID=TestStopVM_Isolated_ErrorExit

agent will have -version

% ./agent/agent -version
containerd Firecracker agent (git commit: a731d81a6313ba8d78036e6bf976808554f442eb)

firecracker-containerd follows what containerd does.

% ./firecracker-control/cmd/containerd/firecracker-containerd -v
containerd github.com/containerd/containerd 1.3.1+unknown a731d81a6313ba8d78036e6bf976808554f442eb
% containerd -v
containerd containerd.io 1.2.10 b34a5c8af56e510852c35414db4c1f4fa6172339

@kzys kzys changed the title Add version information for in-VM agent, shim, firecracker-containerd and firecracker-ctr Add version information for in-VM agent, shim, firecracker-conta… Jan 20, 2020
@kzys kzys merged commit 0f43e9d into firecracker-microvm:master Jan 20, 2020
@kzys kzys deleted the add-version branch January 20, 2020 19:53
fangn2 pushed a commit to fangn2/firecracker-containerd that referenced this pull request Mar 23, 2023
…ependabot/go_modules/github.com/go-openapi/strfmt-0.21.2

Bump github.com/go-openapi/strfmt from 0.21.1 to 0.21.2
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.

3 participants