0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2025-01-20 22:52:51 -05:00
zot/pkg/extensions
Andrei Aaron faa410a0c3
feat(cli): Fix multiple issues with zli output (#1612)
https://github.com/project-zot/zot/issues/1591
    - I will rename "IMAGE NAME" to "REPOSITORY" in order to make the header easier to parse
    - The order of the images cannot be predicted if zot is getting them 1 by 1 using the REST API for manifests, so they cannot be sorted when printed. We could wait on all calls to return but that may take minutes, and printing partial results as they become available is better.
    - The order of the images can be predicted when relying on the zot specific search API, but that is not available in all zot servers depending on build options. I added sorting ascending by default. We are planning to implement configurable sorting in a separate PR - see the work under https://github.com/project-zot/zot/pull/1577
    - With regards to the column widths/alignments that was discussed before, and the issue is we don't know the values beforehand for the REST API based responses. As mentioned above printing partial results as they become available is better.
    - The column widths/alignments are partially fixed in this PR for the search API, but we should properly fix this in - see https://github.com/project-zot/zot/pull/851

https://github.com/project-zot/zot/issues/1592
    - Fix missing space after help message

https://github.com/project-zot/zot/issues/1598
    - Fix table headers showing for json/yaml format
    - Fix spacing shown with json format, use 1 row per shown entry in order to be compatible with json lines format: https://jsonlines.org/
    - Add document header `---` to every image shown in yaml format to separate the entries

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-07-12 10:21:12 -07:00
..
config feat: integrate openID auth logic and user profile management (#1381) 2023-07-07 09:27:10 -07:00
lint refactor: filenames should use _ not - (#1547) 2023-06-22 11:54:41 -07:00
monitoring feat: remove usage of zerolog.Logger.Msgf() from zot code (#1382) 2023-04-27 19:44:22 -07:00
scrub refactor(storage): refactoring storage (#1459) 2023-05-26 11:08:19 -07:00
search feat(cli): Fix multiple issues with zli output (#1612) 2023-07-12 10:21:12 -07:00
sync feat(sync): sync can include self url in registry.URLs (#1562) 2023-07-10 12:27:21 +03:00
_zot.md feat: integrate openID auth logic and user profile management (#1381) 2023-07-07 09:27:10 -07:00
extension_api_key.go feat: integrate openID auth logic and user profile management (#1381) 2023-07-07 09:27:10 -07:00
extension_api_key_disabled.go feat: integrate openID auth logic and user profile management (#1381) 2023-07-07 09:27:10 -07:00
extension_api_key_test.go feat: integrate openID auth logic and user profile management (#1381) 2023-07-07 09:27:10 -07:00
extension_metrics.go feat(ui): package zui within zot binary (#1161) 2023-02-10 14:52:54 -08:00
extension_metrics_disabled.go feat(ui): package zui within zot binary (#1161) 2023-02-10 14:52:54 -08:00
extension_mgmt.go build: fix mgmt and userprefs when building them separately (#1601) 2023-07-10 19:40:14 +03:00
extension_mgmt_disabled.go feat: upload certificates and public keys for verifying signatures (#1485) 2023-07-06 14:57:59 +03:00
extension_mgmt_disabled_test.go feat: upload certificates and public keys for verifying signatures (#1485) 2023-07-06 14:57:59 +03:00
extension_scrub.go fix: changing default numWorkers, making it customizable and refactoring scheduler (#1563) 2023-07-04 11:03:29 +03:00
extension_scrub_disabled.go initial design for task scheduler (#700) 2022-09-22 22:27:56 -07:00
extension_search.go fix: changing default numWorkers, making it customizable and refactoring scheduler (#1563) 2023-07-04 11:03:29 +03:00
extension_search_disabled.go feat(userprefs): update documentation and list extensions endpoint (#1456) 2023-05-25 14:46:52 +03:00
extension_search_test.go fix: changing default numWorkers, making it customizable and refactoring scheduler (#1563) 2023-07-04 11:03:29 +03:00
extension_sync.go feat(sync): sync can include self url in registry.URLs (#1562) 2023-07-10 12:27:21 +03:00
extension_sync_disabled.go refactor(sync): use task scheduler (#1301) 2023-05-31 10:26:23 -07:00
extension_ui.go fix(csp): upgrade UI and fix zap failure (#1372) 2023-04-13 13:48:09 -07:00
extension_ui_disabled.go build(ui): the ui is now included in the zot binary by default (#1202) 2023-02-23 22:28:08 +02:00
extension_ui_test.go feat(repodb): Multiarch Image support (#1147) 2023-02-27 11:23:18 -08:00
extension_userprefs.go build: fix mgmt and userprefs when building them separately (#1601) 2023-07-10 19:40:14 +03:00
extension_userprefs_disable.go feat(userprefs): update documentation and list extensions endpoint (#1456) 2023-05-25 14:46:52 +03:00
extension_userprefs_test.go fix(extensions): consolidate extensions headers returned to UI by extensions (#1473) 2023-05-25 11:44:54 -07:00
extensions_lint.go image level lint: enforce manifest mandatory annotations 2022-07-27 11:48:04 +03:00
extensions_lint_disabled.go image level lint: enforce manifest mandatory annotations 2022-07-27 11:48:04 +03:00
extensions_test.go feat: integrate openID auth logic and user profile management (#1381) 2023-07-07 09:27:10 -07:00
get_extensions.go feat(userprefs): update documentation and list extensions endpoint (#1456) 2023-05-25 14:46:52 +03:00
get_extensions_disabled_test.go feat(userprefs): update documentation and list extensions endpoint (#1456) 2023-05-25 14:46:52 +03:00
README.md refactor: split AuthZ mdw in 2 different parts, each for a specific purpose (#1542) 2023-07-05 09:37:52 -07:00
README_apikey.md feat: integrate openID auth logic and user profile management (#1381) 2023-07-07 09:27:10 -07:00
README_mgmt.md feat: integrate openID auth logic and user profile management (#1381) 2023-07-07 09:27:10 -07:00
userprefs.md feat(userprefs): update documentation and list extensions endpoint (#1456) 2023-05-25 14:46:52 +03:00

Adding new extensions

As new requirements come and build time extensions need to be added, there are a few things that you have to make sure are present before commiting :

  • files that should be included in the binary only with a specific extension must contain the following syntax at the beginning of the file :

//go:build sync will be added automatically by the linter, so only the second line is mandatory .

NOTE: the third line in the example should be blank, otherwise the build tag would be just another comment.

//go:build sync
// +build sync

package extensions
...................
  • when adding a new tag, specify the new order in which multiple tags should be used (bottom of this page)

  • for each and every new file that contains functions (functionalities) specific to an extension, one should create a corresponding file that must contain the exact same functions, but no functionalities included. This file must begin with an "anti-tag" (e.g. // +build !sync) which will include this file in binaries that don't include this extension ( in this example, the file won't be used in binaries that include sync extension ). See extension-sync-disabled.go for an example.

  • each extension is responsible with implementing authorization for newly added HTTP endpoints. zot will provide the necessary data, including user permissions, to the extension, but actual enforcement of these permissions is the responsibility of each extension. Each extension http.Handler has access to a context previously populated by BaseAuthzHandler with relevant user info. That info has the following structure:

    type AccessControlContext struct {
      // read method action
      ReadGlobPatterns map[string]bool
      // detectManifestCollision behaviour action
      DmcGlobPatterns map[string]bool
      IsAdmin         bool
      Username        string
      Groups          []string
      } 
    

    This data can then be accessed from the request context so that every extension can apply its own authorization logic, if needed .

  • when a new extension comes out, the developer should also write some blackbox tests, where a binary that contains the new extension should be tested in a real usage scenario. See test/blackbox folder for multiple extensions examples.

  • newly added blackbox tests should have targets in Makefile. You should also add them as Github Workflows, in .github/workflows/ecosystem-tools.yaml

  • with every new extension, you should modify the EXTENSIONS variable in Makefile by adding the new extension. The EXTENSIONS variable represents all extensions and is used in Make targets that require them all (e.g make test).

  • the available extensions that can be used at the moment are: sync, scrub, metrics, search . NOTE: When multiple extensions are used, they should be listed in the above presented order.