0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00
zot/pkg/extensions
Andrei Aaron fac1d1d05d
chore(trivy): update trivy version and enforce OCI compliant repo names in local image storage (#1068)
1. chore(trivy): update trivy library version

The trivy team switched github.com/urfave/cli for viper so
there are some other code changes as well.

Since we don't use github.com/urfave/cli directly in our software
we needed to add a tools.go in order for "go mod tidy" to not delete it.
See this pattern explained in:
- https://github.com/99designs/gqlgen#quick-start
- https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module
- https://github.com/go-modules-by-example/index/blob/master/010_tools/README.md#walk-through

The jobs using "go get -u" have been updated to use "go install", since go get
modifies the go.mod by upgrading some of the packages, but downgrading trivy to an older
version with broken dependencies

2. fix(storage) Update local storage to ignore folder names not compliant with dist spec
Also updated trivy to download the DB and cache results under the rootDir/_trivy folder

3. fix(s3): one of the s3 tests was missing the skipIt call
This caused a failure when running locally without s3 being available

4. make sure the offline scanning is enabled, and zot only downloads the trivy DB
on the regular schedule, and doesn't download the DB on every image scan

ci: increase build and test timeout as tests are reaching the limit more often

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-01-18 08:24:44 -08:00
..
config fix(config): make all extension config consistent (#888) 2022-10-21 15:33:54 +03:00
lint refactor(cache): rewrote/refactored cachedb functionality to use interface (#667) 2022-11-02 15:53:08 -07:00
monitoring fix(config): make all extension config consistent (#888) 2022-10-21 15:33:54 +03:00
scrub refactor(cache): rewrote/refactored cachedb functionality to use interface (#667) 2022-11-02 15:53:08 -07:00
search chore(trivy): update trivy version and enforce OCI compliant repo names in local image storage (#1068) 2023-01-18 08:24:44 -08:00
sync fix: removed resty calls from sync (#1016) 2022-12-22 10:19:42 -08:00
_zot.md use zot as an extension name, ext as a component and search as a module 2022-05-24 19:12:40 -07:00
extension_metrics.go chore(lint): gci to separate zot from other imports (#870) 2022-10-20 09:39:20 -07:00
extension_metrics_disabled.go chore(lint): gci to separate zot from other imports (#870) 2022-10-20 09:39:20 -07:00
extension_scrub.go add enable/disable option for scrub extension (#827) 2022-09-27 18:06:50 -07:00
extension_scrub_disabled.go initial design for task scheduler (#700) 2022-09-22 22:27:56 -07:00
extension_search.go feat(repodb): Implement RepoDB for image specific information using boltdb/dynamodb (#979) 2023-01-09 12:37:44 -08:00
extension_search_disabled.go feat(repodb): Implement RepoDB for image specific information using boltdb/dynamodb (#979) 2023-01-09 12:37:44 -08:00
extension_sync.go feat(sync,s3): added s3 logic for ORAS and OCI artifacts (#985) 2022-11-14 22:21:49 -08:00
extension_sync_disabled.go feat(sync,s3): added s3 logic for ORAS and OCI artifacts (#985) 2022-11-14 22:21:49 -08: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 fix(config): make all extension config consistent (#888) 2022-10-21 15:33:54 +03:00
README.md build(tags): remove redundant build tag ui_base (#857) 2022-10-10 15:05:55 +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.

  • 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 enlisted in the above presented order.