-
Notifications
You must be signed in to change notification settings - Fork 817
[sonic-package-manager] first phase implementation of sonic-package-manager #1527
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
Changes from 47 commits
2356869
ece3845
8bc75a7
e72f540
1a6d5d9
be4f089
2240308
9fd283d
0cbaa3e
1a99797
a80ecb0
06dfd30
725210d
f2ee39f
c724569
3dc793f
faeadcf
ae1ce45
83f2af6
d31497a
c2eacdf
801ff85
f5ba246
2dee5c6
08c9c6d
42a2665
413b44f
78afedd
f101f1f
4d03aa8
180eae3
3b98489
3280b5b
21ae66b
5548976
5a2675d
68f90f5
e7f1c59
ae5bad9
909079a
a394b27
9653c61
0e96ddb
9090a47
b2eeb59
e765d5d
24fb439
fd46c34
86bf53f
1ace0e1
6feda36
a2f7649
0d5dfcf
4c2f986
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -143,6 +143,7 @@ | |||||
| * [Watermark Show commands](#watermark-show-commands) | ||||||
| * [Watermark Config commands](#watermark-config-commands) | ||||||
| * [Software Installation and Management](#software-installation-and-management) | ||||||
| * [SONiC Package Manager](#sonic-package-manager) | ||||||
| * [SONiC Installer](#sonic-installer) | ||||||
| * [Troubleshooting Commands](#troubleshooting-commands) | ||||||
| * [Routing Stack](#routing-stack) | ||||||
|
|
@@ -7961,8 +7962,289 @@ Go Back To [Beginning of the document](#) or [Beginning of this section](#waterm | |||||
|
|
||||||
| ## Software Installation and Management | ||||||
|
|
||||||
| SONiC software can be installed in two methods, viz, "using sonic-installer tool", "ONIE Installer". | ||||||
| SONiC images can be installed in one of two methods: | ||||||
| 1. From within a running SONiC image using the `sonic-installer` utility | ||||||
| 2. From the vendor's bootloader (E.g., ONIE, Aboot, etc.) | ||||||
|
|
||||||
| SONiC packages are available as prebuilt Docker images and meant to be installed with the *sonic-package-manager* utility. | ||||||
|
|
||||||
| ### SONiC Package Manager | ||||||
|
|
||||||
| The *sonic-package-manager* is a command line tool to manage (e.g. install, upgrade or uninstall) SONiC Packages. | ||||||
|
|
||||||
| **sonic-package-manager list** | ||||||
|
|
||||||
| This command lists all available SONiC packages, their desription, installed version and installation status. | ||||||
| SONiC package status can be *Installed*, *Not installed* or *Built-In*. "Built-In" status means that a feature is built-in to SONiC image and can't be upgraded or uninstalled. | ||||||
|
|
||||||
| - Usage: | ||||||
| ``` | ||||||
| sonic-package-manager list | ||||||
| ``` | ||||||
|
|
||||||
| - Example: | ||||||
| ``` | ||||||
| admin@sonic:~$ sonic-package-manager list | ||||||
| Name Repository Description Version Status | ||||||
| -------------- --------------------------- ---------------------------- --------- -------------- | ||||||
| cpu-report azure/cpu-report CPU report package N/A Not Installed | ||||||
| database docker-database SONiC database package 1.0.0 Built-In | ||||||
| dhcp-relay azure/docker-dhcp-relay SONiC dhcp-relay package 1.0.0 Installed | ||||||
| fpm-frr docker-fpm-frr SONiC fpm-frr package 1.0.0 Built-In | ||||||
| lldp docker-lldp SONiC lldp package 1.0.0 Built-In | ||||||
| macsec docker-macsec SONiC macsec package 1.0.0 Built-In | ||||||
| mgmt-framework docker-sonic-mgmt-framework SONiC mgmt-framework package 1.0.0 Built-In | ||||||
| nat docker-nat SONiC nat package 1.0.0 Built-In | ||||||
| pmon docker-platform-monitor SONiC pmon package 1.0.0 Built-In | ||||||
| radv docker-router-advertiser SONiC radv package 1.0.0 Built-In | ||||||
| sflow docker-sflow SONiC sflow package 1.0.0 Built-In | ||||||
| snmp docker-snmp SONiC snmp package 1.0.0 Built-In | ||||||
| swss docker-orchagent SONiC swss package 1.0.0 Built-In | ||||||
| syncd docker-syncd-mlnx SONiC syncd package 1.0.0 Built-In | ||||||
| teamd docker-teamd SONiC teamd package 1.0.0 Built-In | ||||||
| telemetry docker-sonic-telemetry SONiC telemetry package 1.0.0 Built-In | ||||||
| ``` | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see it as "repository" is more used in the context of storage place, where multiple images could be available, Even you say the same below "A package is a docker image, a repo may contain several docker images."
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the list going to show default-reference too?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We may add if this is required There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How are the docker image tags going to be used here? Maybe they should be shown instead or additionally to the "Version" ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can be added |
||||||
|
|
||||||
| **sonic-package-manager repository add** | ||||||
|
|
||||||
renukamanavalan marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| This command will add a new repository as source for SONiC packages to the database. *NOTE*: requires elevated (root) privileges to run | ||||||
|
|
||||||
| - Usage: | ||||||
| ``` | ||||||
| Usage: sonic-package-manager repository add [OPTIONS] NAME REPOSITORY | ||||||
|
|
||||||
| Add new repository to database | ||||||
|
|
||||||
| Options: | ||||||
| --default-reference TEXT Default installation reference | ||||||
| --description TEXT Optional package entry description | ||||||
| --help Show this message and exit. | ||||||
| ``` | ||||||
| - Example: | ||||||
| ``` | ||||||
| admin@sonic:~$ sudo sonic-package-manager repository add \ | ||||||
| cpu-report azure/sonic-cpu-report --default-reference 1.0.0 | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. e.g. "... add cpu-report azure/sonic-cpu-report ..." what is this "azure/sonic-cpu-report" ? What is the purpose of default-reference ?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The install command, takes even repo path, so wonder what is the value of this repo? Guess we can discuss 1:1, as I guess we are not on same page.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is this "azure/sonic-cpu-report" ? This is a repository, arbitrary example. What is the purpose of default-reference ? The purpose of default-reference is described in HLD - https://github.com/stepanblyschak/SONiC/blob/sonic-app-ext-3/doc/sonic-application-extention/sonic-application-extention-hld.md#sonic-package-database. The install command, takes even repo path, so wonder what is the value of this repo? Not sure I understand the question. |
||||||
| ``` | ||||||
|
|
||||||
| **sonic-package-manager repository remove** | ||||||
|
|
||||||
| This command will remove a repository as source for SONiC packages from the database . The package has to be *Not Installed* in order to be removed from package database. *NOTE*: requires elevated (root) privileges to run | ||||||
|
|
||||||
| - Usage: | ||||||
| ``` | ||||||
| Usage: sonic-package-manager repository remove [OPTIONS] NAME | ||||||
|
|
||||||
| Remove repository from database | ||||||
|
|
||||||
| Options: | ||||||
| --help Show this message and exit. | ||||||
| ``` | ||||||
| - Example: | ||||||
| ``` | ||||||
| admin@sonic:~$ sudo sonic-package-manager repository remove cpu-report | ||||||
| ``` | ||||||
|
|
||||||
| **sonic-package-manager install** | ||||||
|
|
||||||
| This command pulls and installs a package on SONiC host. *NOTE*: this command requires elevated (root) privileges to run | ||||||
|
|
||||||
renukamanavalan marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| - Usage: | ||||||
| ``` | ||||||
| Usage: sonic-package-manager install [OPTIONS] [PACKAGE_EXPR] | ||||||
|
|
||||||
| Install/Upgrade package using [PACKAGE_EXPR] in format | ||||||
| "<name>[=<version>|@<reference>]" | ||||||
|
|
||||||
| Options: | ||||||
| --enable Set the default state of the feature to | ||||||
|
||||||
| enabled and enable feature right after | ||||||
| installation. NOTE: user needs to execute | ||||||
| "config save -y" to make this setting | ||||||
| persistent | ||||||
| --default-owner [local|kube] Default owner configuration setting for a | ||||||
| feature | ||||||
| --from-repository TEXT Fetch package directly from image registry | ||||||
| repository NOTE: This argument is mutually | ||||||
| exclusive with arguments: [package_expr, | ||||||
| from_tarball]. | ||||||
| --from-tarball FILE Fetch package from saved image tarball NOTE: | ||||||
|
||||||
| This argument is mutually exclusive with | ||||||
| arguments: [package_expr, from_repository]. | ||||||
| -f, --force Force operation by ignoring failures | ||||||
|
||||||
| -y, --yes Automatically answer yes on prompts | ||||||
| -v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG | ||||||
|
||||||
| --skip-host-plugins Do not install host OS plugins provided by the | ||||||
| package (CLI, etc). NOTE: In case when package | ||||||
| host OS plugins are set as mandatory in | ||||||
| package manifest this option will fail the | ||||||
| installation. | ||||||
| --help Show this message and exit. | ||||||
| ``` | ||||||
| - Example: | ||||||
| ``` | ||||||
| admin@sonic:~$ sudo sonic-package-manager install dhcp-relay=1.0.2 | ||||||
| ``` | ||||||
| ``` | ||||||
| admin@sonic:~$ sudo sonic-package-manager install dhcp-relay@latest | ||||||
| ``` | ||||||
| ``` | ||||||
| admin@sonic:~$ sudo sonic-package-manager install dhcp-relay@sha256:9780f6d83e45878749497a6297ed9906c19ee0cc48cc88dc63827564bb8768fd | ||||||
| ``` | ||||||
| ``` | ||||||
| admin@sonic:~$ sudo sonic-package-manager install --from-repository azure/sonic-cpu-report:latest | ||||||
| ``` | ||||||
| ``` | ||||||
| admin@sonic:~$ sudo sonic-package-manager install --from-tarball sonic-docker-image.gz | ||||||
| ``` | ||||||
|
|
||||||
| **sonic-package-manager uninstall** | ||||||
|
|
||||||
| This command uninstalls package from SONiC host. *NOTE*: this command requires elevated (root) privileges to run. | ||||||
renukamanavalan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| - Usage: | ||||||
| ``` | ||||||
| Usage: sonic-package-manager uninstall [OPTIONS] NAME | ||||||
|
|
||||||
| Uninstall package | ||||||
|
||||||
| Uninstall package | |
| Uninstall package |
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.
Should we also allow uninstalling multiple packages at once?
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.
It can be added
Outdated
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.
Same as for install, i think force is not a good idea here. The package-manager should abstract and "protect the user" in the sense, that it does not break the system. If the user decides to replace a docker container or binary somewhere, she/he is still free to do so without the package-manger.
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.
The package-manager should abstract and "protect the user" in the sense, that it does not break the system.
[SB] Then the user does not use --force
stepanblyschak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
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.
Personally, i find "reset" very confusing when targeting "just one package". I think a command to reset ALL packages to their default state (if possible when considering that those packages might also have installed tools on the host, which usually do not have a straight "revert" option) would be very useful thou.
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.
"packages might also have installed tools on the host, which usually do not have a straight "revert" option" - could you please give an example?
Reset multiple can be added
renukamanavalan marked this conversation as resolved.
Show resolved
Hide resolved
Outdated
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.
I think "tags" might confuse people here, since it was not mentioned in the docs so far.
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.
The docs states about Docker and Repository and Registry, it does not look like user can be aware about it but not understand "tags in repository"
Outdated
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.
| --all Show all available tags in repository | |
| --all Show all versions available in the repository |
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.
Is "--all" the default ? If not, what is the default ?
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.
No, it is not. --all is an option so it is not a default.
Outdated
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.
Either we register the repo, in which case don't allow install/upgrade to override
Or, allow this command to accept repo
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.
Does this also stop and uninstall the corresponding service, if running? [SB] It is user responsibilty
Or would it demand, the service should be in stopped state, for remove to be success? [SB] Yes
Would it fail, if there are dependent packages installed? [SB] Yes, uninstallation will fail.
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.
Either we register the repo, in which case don't allow install/upgrade to override
Or, allow this command to accept repo
Could you please clarify which command you are refering to and what is your suggestion?
stepanblyschak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
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.
Although it looks nice to humans, output like this is very hard to parse for automation tools. Maybe we can offer an option to output something like yaml, json or something similar 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.
Then use --plain
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.
Which format will "plain" be in ? If it is any defined format (like yaml, json or something alike), i think we wanna rename that option to "--format $FORMAT" or "--$FORMAT"
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.
package_expr ??
Does manifest carry change log ?
manifest.json.j2 does not have it
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.
Does manifest carry change log ? [SB] Yes
manifest.json.j2 does not have it. [SB] We may extend, btw, extension usually won't be in sonic-buildimage repository so they won't use manifest.json.j2
renukamanavalan marked this conversation as resolved.
Show resolved
Hide resolved
renukamanavalan marked this conversation as resolved.
Show resolved
Hide resolved
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.
Will it upgrade packages, if currently installed is lower version, w/o --skip flag?
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.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| _sonic_package_manager_completion() { | ||
| COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \ | ||
| COMP_CWORD=$COMP_CWORD \ | ||
| _SONIC_PACKAGE_MANAGER_COMPLETE=complete $1 ) ) | ||
| return 0 | ||
| } | ||
|
|
||
| complete -F _sonic_package_manager_completion -o default sonic-package-manager; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| sonic-package-manager |
Uh oh!
There was an error while loading. Please reload this page.