-
Notifications
You must be signed in to change notification settings - Fork 788
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 container information to .containerenv #2821
Conversation
7992dee
to
6801b69
Compare
@containers/podman-maintainers PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rhatdan, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
LGTM |
run_linux.go
Outdated
id=%q | ||
image=%q | ||
imageid=%q | ||
`, Version, b.Container, b.ContainerID, b.FromImage, b.FromImageID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`, Version, b.Container, b.ContainerID, b.FromImage, b.FromImageID) | |
`, Version, b.Container, b.ContainerID, b.FromImage, b.FromImageID, isRootless) |
name=%q | ||
id=%q | ||
image=%q | ||
imageid=%q |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imageid=%q | |
imageid=%q | |
rootless=%q |
containerenvPath := filepath.Join(path, "/run/.containerenv") | ||
if err = os.MkdirAll(filepath.Dir(containerenvPath), 0755); err != nil { | ||
return err | ||
} | ||
emptyFile, err := os.Create(containerenvPath) | ||
if err != nil { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isRootless := fmt.Sprintf("%v", unshare.IsRootless()) |
I'd add the rootless info too, we'll probably want it at some point and it was part of the discussion in the issue. |
We have been asked to leak some container information and image information into the container to be used by certain tools. (Toolbox and others) Signed-off-by: Daniel J Walsh <[email protected]>
6801b69
to
d9a7f13
Compare
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks a lot, @rhatdan ! |
rootless = 1 | ||
} | ||
// Populate the .containerenv with container information | ||
containerenv := fmt.Sprintf(`\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks weird. Why is the \
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes the code easier to read, i figure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That backslash makes it into the file, though, which is what makes it look weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok perhaps we should remove it then.
We have been asked to leak some container information
and image information into the container to be used
by certain tools. (Toolbox and others)
Signed-off-by: Daniel J Walsh [email protected]
What type of PR is this?
What this PR does / why we need it:
How to verify it
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?