-
Notifications
You must be signed in to change notification settings - Fork 142
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
device: Add services
command for seeing info about services running on a device
#2525
Conversation
An error occurred whilst building your landr site preview:
|
@myarmolinsky the problem #1759 is outlining (albeit, not entirely clear) is that if you want to SSH into a device's containers you need to perform a few steps to get the right info. In the output of balena scan we can see my device is running 2 containers but if I want to spawn a shell into them I cannot since I don't know them. I'd have to SSH to the host than ask the engine the services running than shell into the container from the host.
the desired result is for balena scan to tell you the name of the containers so after scanning you can just ssh into it like so..
|
The feature you've implemented here is still useful since someone can ask the device what services it has if you know the UUID. |
device.image_install?.map((imageInstall) => { | ||
const newImageInstall: AugmentedImageInstall = { ...imageInstall }; | ||
newImageInstall.name = getExpandedProp( | ||
getExpandedProp(imageInstall.image, 'is_a_build_of__service')!, | ||
'service_name', | ||
); | ||
newImageInstall.release = getExpandedProp( | ||
imageInstall.is_provided_by__release, | ||
'commit', | ||
); | ||
return newImageInstall; | ||
}), |
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.
Since the UI already does render such a list, how about doing it in a similar way by using the device.current_services
?
I would assume that this should be the first thing the check and then move any additional common code into the SDK itself.
Other than that, LGTM code-wise.
device.image_install?.map((imageInstall) => { | |
const newImageInstall: AugmentedImageInstall = { ...imageInstall }; | |
newImageInstall.name = getExpandedProp( | |
getExpandedProp(imageInstall.image, 'is_a_build_of__service')!, | |
'service_name', | |
); | |
newImageInstall.release = getExpandedProp( | |
imageInstall.is_provided_by__release, | |
'commit', | |
); | |
return newImageInstall; | |
}), | |
Object.entries(device.current_services).flatMap(([serviceName, containers]) => { | |
return containers.map((container) => ({ | |
...container, | |
name: serviceName, | |
release: container.commit, | |
}); | |
}), |
2ec92cd
to
c23138d
Compare
… on a device Change-type: minor Signed-off-by: Matthew Yarmolinsky <matthew-timothy@balena.io>
c23138d
to
6f5920c
Compare
device: Add
services
command for seeing info about services running on a deviceChange-type: minor
Signed-off-by: Matthew Yarmolinsky matthew-timothy@balena.io
Ex. output (ran on a BoB device):
Please check the CONTRIBUTING.md file for relevant information and some
guidance. Keep in mind that the CLI is a cross-platform application that runs
on Windows, macOS and Linux. Tests will be automatically run by balena CI on
all three operating systems, but this will only help if you have added test
code that exercises the modified or added feature code.
Note that each commit message (currently only the first line) will be
automatically copied to the CHANGELOG.md file, so try writing it in a way
that describes the feature or fix for CLI users.
If there isn't a linked issue or if the linked issue doesn't quite match the
PR, please add a PR description to explain its purpose or the features that it
implements. Adding PR comments to blocks of code that aren't self explanatory
usually helps with the review process.
If the PR introduces security considerations or affects the development, build
or release process, please be sure to highlight this in the PR description.
Thank you very much for your contribution!