0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-16 21:56:37 -05:00
Commit graph

712 commits

Author SHA1 Message Date
Andrei Aaron
1f9f178a57
ci(golang): fix syncing build image golang 1.20 (#1205)
Since the matrix values were unquoted,
the logic reading the yaml considered them numbers

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-02-17 10:02:30 -08:00
Ramkumar Chinchani
672a2cd384
chore: add/sync golang 1.20.x images (#1200)
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-02-16 11:25:32 +02:00
Bogdan Bivolaru
7c3bf86a6b
refactor: Centralise extensions config entries (#1177)
Except for registry sync config

Signed-off-by: Bogdan BIVOLARU <104334+bogdanbiv@users.noreply.github.com>
2023-02-15 22:20:28 -08:00
peusebiu
4aa0106b0a
feat(scheduler): use an worker pool for scheduler (#1146)
Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
2023-02-15 11:36:50 -08:00
Nicol
f00a9e6e48
perf: update the ImageList queries to return PaginatedImagesResult (#1182)
Signed-off-by: Nicol Draghici <idraghic@cisco.com>
2023-02-15 11:34:07 -08:00
Ramkumar Chinchani
d79ad863e4
fix: set GC delay defaults for storage subPaths (#1189)
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-02-14 09:16:37 -08:00
Andrei Aaron
0cddb2be3e
feat(ui): use a Makefile variable to download a pre-existing zui build (#1196)
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-02-13 22:55:05 +02:00
Ramkumar Chinchani
b9a75b2e44
chore(go.mod): fix dependabot alerts (#1194)
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-02-13 12:48:05 -08:00
Andreea Lupu
ee95ab0ffc
fix: call notation-go libs instead of using notation binary (#1104)
fix: add loading notation path

Signed-off-by: Andreea-Lupu <andreealupu1470@yahoo.com>
Co-authored-by: Roxana Nemulescu <roxana.nemulescu@gmail.com>
2023-02-13 10:43:52 -08:00
Amit Marcus
2377d62344
feat(sync): onDemand check for updated manifest (#1190)
Signed-off-by: Amit Marcus <marxus@gmail.com>
2023-02-13 10:33:48 -08:00
Andrei Aaron
c0aaca8ed1
feat(ui): package zui within zot binary (#1161)
(cherry picked from commit d557da0baba819b7cd7e6b5941528776e125ac6d)

build(ui): fix stacker builds


(cherry picked from commit ba25daf02b4a9bc7ee1cb6f84b7a6b096ca7d61f)

build(ui): various fixes

- Fix metrics endpoint
- Fix unit tests unit tests
- Make the ui build optional in the makefile
before the linter lint runs in the golangci-lint workflow
- Do not attempt to include UI routes if search is enabled
- Fix authorization for search endpoint



fix: use zot tag in ui make target


(cherry picked from commit 2a6882fa23f06b2d68c6c299773a6ff50bf90e78)

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
Signed-off-by: Catalin Hofnar <catalin.hofnar@gmail.com>
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
Co-authored-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-02-10 14:52:54 -08:00
Andrei Aaron
d12836e69c
refactor(cve): improve CVE test time by mocking trivy (#1184)
- refactor(cve): remove the global of type cveinfo.CveInfo from the extensions package
  Replace it with an attribute on controller level
- refactor(controller): extract initialization logic from controller.Run()
- test(cve): mock cve scanner in cli tests

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-02-09 21:04:52 -08:00
Andrei Aaron
c1de15c87b
ci: Revert "test: show the execution times of the tests (#1163)" (#1186)
Exit code was not corrctly handled because of the pipes/tee,
so the job would not fail if tests were failing. Reverting this for now.

This reverts commit 74013a71af.

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-02-09 14:28:01 +02:00
Andrei Aaron
74013a71af
test: show the execution times of the tests (#1163)
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-02-07 20:25:08 +02:00
Ramkumar Chinchani
c154ab02f3
chore(deps): fix dependabot alerts (#1179)
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-02-07 08:52:17 +02:00
Andrei Aaron
af222de108
test: refactor CVE tests in CLI package (#1170)
Changes in this commit:

A.
There were nested conveys following the pattern:
- outer convey was a positive test
- inner conveys were negative tests
The positive and negative tests did not depend on one another, but the positive test was repeated for each negative test.

So for example if there was 1 positive test and 2 negative tests what go would do is:
1. execute the outer convey with the positive test
2. execute the 1st inner convey with the 1st negative test
3. execute the outer convey with the positive test
4. execute the 2nd inner convey with the 2nd negative test

Since there were no dependencies between these tests they can be moved on the same level.

B.
The test function bringing up the controller for `TestServerCVEResponseGQL` was the same for `TestServerCVEResponse`, so I removed `TestServerCVEResponseGQL` and moved the Conveys under `TestServerCVEResponse`. This will save time on the initial TrivyDB download, since it's done only once when the controller starts.

C. The `Convey("without flags", func() {` was actually the same as the test under which it was nested: `Convey("Test CVE invalid url port", t, func() {` no code differences so I removed it.

D. Use the new test functions to start/stop and wait for the zot contoller to be reachable

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-02-06 13:16:28 -08:00
Andrei Aaron
3676c5889e
test: avoid running trivy tests if search build label is missing (#1172)
The 'test' makefile target runs the tests for both 'minimal' and equivalent of the former 'extended' build.
The trivy package tests were run twice, even if the trivy logic is unreachable if search is disabled.
With this update we should see a cut of about 150s of test time.

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-02-04 23:21:45 -08:00
Andrei Aaron
3cb99f4ed9
ci(cache): split go build cache from go modules cache (#1169)
The cache should not be the same if we build for different OSs/architectures

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-02-04 09:57:07 +02:00
Andrei Aaron
78feb4b495
docs(graphql): rewrote search.md (#1130)
* docs(graphql): rewrote search.md
docs(graphql): added pagination and filter docs for gql

Squash of both commits:
(cherry picked from commit 2268fa0510b32b27f2c1f71e9889ec769877553b)
(cherry picked from commit c96adc88b2fb9edff90e7e4b01a8885511ceb0df)
Signed-off-by: Catalin Hofnar <catalin.hofnar@gmail.com>

Some additional updates by Andrei Aaron to keep up with the changes on main.
Also add more comments to schema.graphql

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

* style: run a graphql schemma linter as a github workflow

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

---------

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
Co-authored-by: Catalin Hofnar <catalin.hofnar@gmail.com>
2023-02-02 12:46:35 -08:00
Nicol
ba3f6f7492
fix(test): update the zot tests not to use test/data as rootDir (use a temporary folder instead) (#1162)
Signed-off-by: Nicol Draghici <idraghic@cisco.com>
2023-02-02 11:39:03 -08:00
Ramkumar Chinchani
863d057e43
chore(deps): fix dependabot alerts (#1153)
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-02-01 00:21:14 -08:00
Lisca Ana-Roberta
976ccfcf0d
fix: removed references to old dist-spec (#1128)
Signed-off-by: Ana-Roberta Lisca <ana.kagome@yahoo.com>
2023-01-31 09:35:33 -08:00
Ramkumar Chinchani
1b618f305e
test(exporter): add unit test to cover cli pkg (#1148)
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-01-27 20:35:32 -08:00
Ramkumar Chinchani
b3ed92ef1a
chore(deps): fix dependabot alerts (#1143)
https://github.com/project-zot/zot/pull/1119
https://github.com/project-zot/zot/pull/1142

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-01-26 22:39:18 -08:00
Andrei Aaron
e04d98272c
chore: update the version of go-lru we use to the latest available (#1141)
We are now using v2.0.1 in the cve cache logic.
Unfortunately we are also using v0.5.4 indirectly, as it is required for gqlgen, see:
e6114a2c6a/go.mod (L7)

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-01-26 11:14:17 -08:00
Ramkumar Chinchani
e2c7a3c5ba
fix(referrers): fix some conformance issues (#1134)
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-01-26 10:13:12 -08:00
Andrei Aaron
feb7328f50
feat(repodb): DerivedImageList and BaseImageList make use of RepoDB (#1135)
- derivedImageList and baseImageList now use FilterTags to obtain results,
each with its own filter function
- images that have the exact same manifest as the one provided as a
parameter are no longer considered base images or derived images
- both calls can be made with specific pagination parameters, and the
response will include PageInfo

Signed-off-by: Alex Stan <alexandrustan96@yahoo.ro>

fix(tests): fix one of the pagination tests

The results were not reliable as the 2 returned tags were sorted by created date/time
which was not set, resulting in an unpredictable order

Signed-off-by: Andrei Aaron <andaaron@cisco.com>
(cherry picked from commit be504200a1127371422aeb0e5c0219e2a1ead20a)
(cherry picked from commit ed8d797e639f262a63840120afe92da7db9a7600)
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

Signed-off-by: Andrei Aaron <andaaron@cisco.com>
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
Co-authored-by: Alex Stan <alexandrustan96@yahoo.ro>
2023-01-25 14:06:02 -08:00
Ramkumar Chinchani
be4b8c6243
fix(referrers): annotation key is incorrect (#1139)
"If filtering is requested and applied, the response MUST include an
annotation (org.opencontainers.referrers.filtersApplied) denoting that
an artifactType filter was applied.""

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-01-25 12:50:03 -08:00
Ramkumar Chinchani
0938e4704c
chore(deps): fix dependabot alerts (#1131)
Also, remove go mod redirects and update linter config.

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-01-25 10:58:39 -08:00
Andrei Aaron
799f747429
fix: Sort tags returned by ExpendedRepoInfo in the Images property with the newest first (#1137)
Signed-off-by: Nicol Draghici <idraghic@cisco.com>
(cherry picked from commit e99ea64bd1b9699bcd6d72183c722d636772bbb1)

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
Signed-off-by: Nicol Draghici <idraghic@cisco.com>
2023-01-25 10:57:10 -08:00
Andrei Aaron
58ec62b3e4
feat(cve): graphql: paginate returned CVEs for a given image (#1136)
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-01-24 15:03:10 -08:00
Andrei Aaron
08983a845a
feat(repodb): implement pagination for ImageList and integrate it with RepoDB (#1129)
* feat(repodb): implement pagination for ImageList and integrate it with RepoDB

- it can now return all images from all repos, when provided repo parameter is ""

Signed-off-by: Alex Stan <alexandrustan96@yahoo.ro>
(cherry picked from commit c003dcec9f805564946935e7eb091632f605035e)
(cherry picked from commit 72feba979b9ddd452465a652bb31f439584a046c)
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

* ci(timeouts): increase ci-cd workflow timeout for the build and test step

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

Signed-off-by: Alex Stan <alexandrustan96@yahoo.ro>
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
Co-authored-by: Alex Stan <alexandrustan96@yahoo.ro>
2023-01-23 09:45:11 -08:00
Andrei Aaron
3caa0f3253
feat(cve): the cve related calls to use repodb and add pagination on image results (#1118)
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-01-20 22:09:40 +02:00
Nicol
f0d947809b
test(refactor): cleanup/simplify testcases (#1124)
Signed-off-by: Nicol Draghici <idraghic@cisco.com>
2023-01-20 10:01:52 -08:00
Nicol
70a60b4660
refactor: Cleanup/simplify testcases in /pkg/extensions (#1116)
Signed-off-by: Nicol Draghici <idraghic@cisco.com>

fix: Increase coverage when copying files

Signed-off-by: Nicol Draghici <idraghic@cisco.com>
2023-01-19 08:54:05 -08:00
Andrei Aaron
b997176363
feat(repodb): add PageInfo to GlobalSearch and RepoListWithNewestImage results (#1121)
Signed-off-by: Alex Stan <alexandrustan96@yahoo.ro>

add page info to dynamo-> feat(repodb): add PageInfo to GlobalSearch and RepoListWithNewestImage results

(cherry picked from commit 4fed42bb4bbc68199281d9d9a4e09b97fbd4759b)
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

Signed-off-by: Alex Stan <alexandrustan96@yahoo.ro>
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
Co-authored-by: Alex Stan <alexandrustan96@yahoo.ro>
2023-01-18 14:20:55 -08:00
Andrei Aaron
d960c2e23f
fix(ci): do not use "ghcr.io/aquasecurity/trivy-db" for ci (#1107)
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-01-18 14:18:03 -08:00
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
Ramkumar Chinchani
9294ebb0ec
docs: fix copyright related info for cncf onboarding (#1117)
https://github.com/cncf/toc/issues/972

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-01-17 15:43:45 -08:00
Andrei Aaron
e8e7c343ad
feat(repodb): add pagination for ImageListForDigest and implement FilterTags (#1102)
* feat(repodb): add pagination for ImageListForDigest and implement FilterTags

ImageListForDigest can now return paginated results, directly from DB.
It uses FilterTags, a new method to filter tags (obviously) based on
the criteria provided in the filter function.
Pagination of tags is now slightly different, it shows all results if
no limit and offset are provided.

Signed-off-by: Alex Stan <alexandrustan96@yahoo.ro>

bug(tests): cli tests for digests expecting wrong size

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
(cherry picked from commit 369216df931a4053c18278a8d89f86d2e1e6a436)

fix(repodb): do not include repo metadata in search results if no matching tags are identified

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

* fix(repodb): Fix an issue in FilterTags where repometa was not proceesed correctly

The filter function was called only once per manifest digest.
The function is supposed to also take into consideration repometa,
but only the first repometa-manifestmeta pair was processed.

Also increase code coverage.

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
Co-authored-by: Alex Stan <alexandrustan96@yahoo.ro>
2023-01-18 00:31:54 +02:00
Andrei Aaron
9f8bc60b20
feat(cve): cache trivy results for an image:tag (#1101)
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-01-17 13:14:17 -08:00
Ramkumar Chinchani
eebc750367
chore(deps): fix dependabot alerts (#1115)
https://github.com/project-zot/zot/pull/1112
https://github.com/project-zot/zot/pull/1113
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-01-17 09:48:58 +02:00
Nicol
c11c69c351
refactor: Cleanup/simplify testcases in /pkg/cli (#1103)
Signed-off-by: Nicol Draghici <idraghic@cisco.com>
2023-01-16 21:52:50 -08:00
Andrei Aaron
1b11b9d335
fix(repodb): make table reset syncronous for consistent testing (#1111)
Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
(cherry picked from commit bea0eabcaa)
(cherry picked from commit 0f02d625331987126326a28731f14d3139061adc)

fix(repodb): use dynamodb sdk functions for waiting on tables to be created or deleted

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

fix(ci): make sure the dynamodb tables used in testing have unique names

There were cases of failures when tests were run for the entire repodb package
which did not reproduce when tests were run for each sub-folder individually
This change should make sure there are no collisions between the names
used in concurrent tests.

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
Co-authored-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
2023-01-16 16:01:35 +02:00
Andrei Aaron
33b55efc92
fix(ci): do not build zot container image for the annotation tests (#1110)
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-01-13 22:50:20 +02:00
Ramkumar Chinchani
ca1d4beb2a
ci: also allow manual workflow triggers (#1109)
* ci: also allow manual workflow triggers

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>

* ci: add a github actions checker

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
2023-01-13 00:49:42 -08:00
Andrei Aaron
9f0b833293
fix(ci): use oras login before copying trivy-db
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-01-12 18:44:45 +00:00
Andrei Aaron
787a75e218
fix(ci): fix path to trivy-db copy under project-zot (#1108)
Signed-off-by: Andrei Aaron <aaaron@luxoft.com>

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-01-12 20:01:43 +02:00
Andrei Aaron
6f5b7afd39
ci(trivy): copy trivydb oci artefact to project-zot repo (#1106)
This will replace calls made directly to ghcr.io/aquasecurity/trivy-db
Which are hitting the rate limiter

Signed-off-by: Andrei Aaron <aaaron@luxoft.com>
2023-01-12 09:54:53 -08:00
Lisca Ana-Roberta
261fc2fb38
fix: added error message for missing CVEs (#1085)
Signed-off-by: Ana-Roberta Lisca <ana.kagome@yahoo.com>
2023-01-11 15:02:29 -08:00