1
0
mirror of https://github.com/quay/quay.git synced 2025-04-18 10:44:06 +03:00

40 Commits

Author SHA1 Message Date
Kenny Lee Sin Cheong
5f8ca041e7
ui: implement change to render modelcard stored in layers (PROJQUAY-8642) (#3692)
* ui: implement change to render modelcard stored in layers (PROJQUAY-8412)

When a manifest has certain annotations or artifactTypes, render the
applicable modelcard markdown in a new tags detail tab.

* removing untar when fetching model card

* removing extra api calls

* Add modelcar check tests

---------

Co-authored-by: bcaton <bcaton@redhat.com>
2025-03-05 19:14:22 +00:00
Syed Ahmed
f7f4fbcbde
oci: fix nested index parsing (PROJQUAY-8272) (#3427)
image index can refer to another index when parsing. We currently
assume only a manifest can be referenced from an index. This fixes
the parse logic
2024-11-26 19:24:16 +00:00
Kenny Lee Sin Cheong
f27c5750e9
registry: add missing annotations property to OCIIndex datatype (PROJQUAY-8131) (#3357) 2024-10-24 14:25:15 +00:00
Kenny Lee Sin Cheong
fdb36d2435
registry: add artifact types and annotations to referrers index response (PROJQUAY-7481) (#3047) 2024-07-18 16:03:50 +00:00
Kenny Lee Sin Cheong
4546163e83
registry: implements the OCI 1.1 referrers API (PROJQUAY-7280) (#2597)
* registry: implements the OCI 1.1 referrers API

Migrations:
- Adds a subject column for lookup
- Adds a subject_backfilled column to track status of the backfilling
of existing manifests
- Adds a manifest_json column making use of postgres' JSONB support,
for future use.

Manifestsubjectbackfillworker: Indexes existing manifests for possible
existing subject field.

* Deprecate IGNORE_UNKNOWN_MEDIATYPES

* Cleanup
2024-06-07 13:28:13 -04:00
Kenny Lee Sin Cheong
e91b9e4543
registry: allow pushing manifests with artifactType and subject fields (PROJQUAY-6673) (#2659)
Allow manifests to be pushed with a artifactType and subject fields.
2024-02-12 13:32:43 -05:00
Syed Ahmed
8895caf97b
oci: remove platform requirement for image index (PROJQUAY-6658) (#2657)
The image index spec https://github.com/opencontainers/image-spec/blob/main/image-index.md
specifics `platform` as an optional field.
2024-02-05 21:55:03 +00:00
Syed Ahmed
0b3d35b71d
manifest: support empty config for artifacts (PROJQUAY-6658) (#2647)
Artifacts can have empty config defined
skip parsing if the config is empty
2024-02-05 12:15:23 -05:00
Kenny Lee Sin Cheong
5f63b3a7bb
chore: drop deprecated tables and remove unused code (PROJQUAY-522) (#2089)
* chore: drop deprecated tables and remove unused code

* isort imports

* migration: check for table existence before drop
2023-08-25 12:17:24 -04:00
Ivan Bazulic
d193d90a0e
oci: Allow optional components in the image config to be set to "null" (PROJQUAY-5634) (#1961)
* oci: Allow optional properties in the config layer to be set to null

* Correct formatting

* oci: Allow optional components in the image config to be set to "null"
See OCI spec for more information:

https://github.com/opencontainers/image-spec
2023-06-09 14:21:25 -04:00
Kenny Lee Sin Cheong
23b39720d1
registry: add option to ignore unknown mediatypes (PROJQUAY-5018) (#1750) 2023-02-09 14:10:05 -05:00
Flavian Missi
e262f062b7
oci/index.py: support docker schema2 sub-manifest types (#1649) 2022-12-05 10:40:00 +01:00
Flavian Missi
12e7c8fcb0
fix: support oci image indexes that don't specify a mediaType (PROJQUAY-4254) (#1469) 2022-08-08 17:21:20 +02:00
Oleg Bulatov
ed8f12ba34
Enable some flake8 checks in CI (#1389) 2022-06-16 18:22:16 +02:00
Oleg Bulatov
5eaf0584db
chore: Run mypy as CI job (#1363)
* Run mypy as CI job

* Fix peewee.pyi and configure pyright
2022-06-13 11:01:17 +02:00
Flavian Missi
d20542aa45
fix several warnings (#1374)
mostly invalid escape sequences
2022-06-10 11:46:56 +02:00
Brandon Caton
b2dbdcd798
schema1: Generate kid in the correct format (PROJQUAY-3486) (#1208)
Clients expect signed schema 1 manifests to contain a signature with the key ID in the correct format. We currently pass the automatically generated key ID which is just a hash of characters.
This causes errors in clients that try to pull signed schema 1 manifests that are generated by Quay - when creating tags through the UI or manifest conversions.
2022-05-17 13:20:09 -04:00
Brandon Caton
ef91c57c23
format: Updating black to resolve click dependency issue (PROJQUAY-3487) (#1209)
Currently the CI breaks due to a dependency of black, `click`, breaking with it's latest release with `ImportError: cannot import name '_unicodefun' from 'click'`. Since black does not pin it's version of click it pulls in the latest version containing the breaking change and fails the CI check. This updates black with the patch. [See the original issue here.](https://github.com/psf/black/issues/2964) The rest of the changes are format updates introduced with the latest version of black.
2022-03-29 15:34:57 -04:00
Flavian Missi
fe4d66b030
feat: pull-thru proxy cache (#1053)
introduces the possibility to pull images from external registries
through Quay, storing them locally for faster subsequent pulls.

Closes PROJQUAY-3030 and PROJQUAY-3033
2022-03-23 17:20:00 +01:00
Brandon Caton
58b0657255
Revert "schema1: Permit signed schema1 manifests during conversion (PROJQUAY-PROJQUAY-3285) (#1146)" (#1150)
This reverts commit b5bd74bf051e5de81fede6b386b3fbd178d7b8a8.
2022-02-25 16:31:23 -05:00
Brandon Caton
b5bd74bf05
schema1: Permit signed schema1 manifests during conversion (PROJQUAY-PROJQUAY-3285) (#1146)
Currently if an image with an OCI manifest is requested and the client does not support Docker Schema 2 or OCI manifests it will default to returning an unsigned Docker V2 Schema 1 manifest. Older clients who send a application/vnd.docker.distribution.manifest.v1+prettyjws media type header expect a signed Docker V2 Schema 1 manifest and break when an unsigned manifest is recieved. This change defaults to returning a signed manifest for OCI images if the application/vnd.docker.distribution.manifest.v1+prettyjws is present before falling back to an unsigned manifest.
2022-02-25 13:15:31 -05:00
Giuseppe Scrivano
1994f2d108
oci: add support for zstd compression (PROJQUAY-1417) (#801)
allow upload of layers compressed with zstd, instead of gzip.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-08-03 11:58:21 -04:00
Kenny Lee Sin Cheong
b0adc9667c
registry: add support for extended repository names (PROJQUAY-1535) (#814)
Allows forward slashes to be used in repository names according to
https://docs.docker.com/docker-hub/repos/.

NOTE: This change simply allows the use of "/" in repository
names needed for certain Openshift use cases. This does not implement
any new permission model for nested paths. i.e A repository with a
nested path is treated as a single repository under a _single_
namespace.
2021-07-28 12:27:33 -04:00
Kenny Lee Sin Cheong
64bc11fe46
oci: allow oci artifact registration (PROJQUAY-1032) (#803)
Allow registration of custom oci artifact types in Quay's configuration.
2021-07-26 09:52:33 -04:00
Kenny Lee Sin Cheong
7d9a49da10
Replace jwkest with authlib (#685)
* Replace jwkest with authlib and PyCrypto with cryptography

Remove pycryptodome dependencies.
Remove post-fork random seed init - python-cryptography's pseudo RNG should be fork safe:
- https://cryptography.io/en/latest/security.html?highlight=fork
- https://cryptography.io/en/latest/hazmat/backends/openssl.html?highlight=fork#os-random-engine

* deps: Pin cryptography to 3.3.1

Latest available version available on RHEL.
As of 3.4, cryptography builds on rust, which is not readily available
on RHEL.
2021-03-15 15:25:23 -04:00
Kurtis Mullins
bd7252c536
[PROJQUAY-1021] task: Update "Black" to version 20.8b1 2020-11-30 18:48:19 -05:00
thomasmckay
b266ca6d52
1002 - properly register helm oci type (#534) 2020-09-10 13:28:40 -04:00
Joseph Schorr
0e628b1569
Deprecate Image rows and move to in-memory synthesized legacy images [Python 3] (#442)
* Change verbs to use a DerivedStorageForManifest table instead of DerivedStorageForImage

This allows us to deprecate the DerivedStorageForImage table.

Fixes https://issues.redhat.com/browse/PROJQUAY-519

* Change uploaded blob tracking to use its own table and deprecate
RepositoryTag

* Start recording the compressed layers size and config media type on the
manifest row in the database

NOTE: This change includes a database migration which will *lock* the
manifest table

* Change tag API to return the layers size from the manifest

* Remove unused code

* Add new config_media_type field to OCI types

* Fix secscan V2 test for us no longer writing temp images

* Remove unused uploading field

* Switch registry model to use synthetic legacy images

Legacy images are now (with exception of the V2 security model) read from the *manifest* and sythensized in memory. The legacy image IDs are generated realtime based on the hashids library. This change also further deprecates a bunch of our Image APIs, reducing them to only returning the image IDs, and emptying out the remaining metadata (to avoid the requirement of us loading the information for the manifest from storage).

This has been tested with our full clients test suite with success.

* Add a backfill worker for manifest layers compressed sizes

* Change image tracks into manifest tracks now that we no longer have
manifest-less tags

* Add back in the missing method

* Add missing joins to reduce extra queries

* Remove unnecessary join when looking up legacy images

* Remove extra hidden filter on tag queries

* Further DB improvements

* Delete all Verbs, as they were deprecated

* Add back missing parameter in manifest data type

* Fix join to return None for the robot if not defined on mirror config

* switch to using secscan_v4_model for all indexing and remove most of secscan_v2_model code

* Add a missing join

* Remove files accidentally re-added due to rebase

* Add back hashids lib

* Rebase fixes

* Fix broken test

* Remove unused GPG signer now that ACI conversion is removed

* Remove duplicated repomirrorworker

* Remove unused notification code for secscan. We'll re-add it once Clair
V4 security notifications are ready to go

* Fix formatting

* Stop writing Image rows when creating manifests

* Stop writing empty layer blobs for manifests

As these blobs are shared, we don't need to write ManifestBlob rows
for them

* Remove further unused code

* Add doc comment to _build_blob_map

* Add unit test for synthetic V1 IDs

* Remove unused import

* Add an invalid value test to synthetic ID decode tests

* Add manifest backfill worker back in

Seems to have been removed at some point

* Add a test for cached active tags

* Rename test_shared to not conflict with another same-named test file

Pytest doesn't like having two test modules with the same name

* Have manifestbackfillworker also copy over the config_media_type if present

Co-authored-by: alecmerdler <alecmerdler@gmail.com>
2020-07-28 13:03:10 -04:00
Kurtis Mullins
38be6d05d0
Python 3 (#153)
* Convert all Python2 to Python3 syntax.

* Removes oauth2lib dependency

* Replace mockredis with fakeredis

* byte/str conversions

* Removes nonexisting __nonzero__ in Python3

* Python3 Dockerfile and related

* [PROJQUAY-98] Replace resumablehashlib with rehash

* PROJQUAY-123 - replace gpgme with python3-gpg

* [PROJQUAY-135] Fix unhashable class error

* Update external dependencies for Python 3

- Move github.com/app-registry/appr to github.com/quay/appr
- github.com/coderanger/supervisor-stdout
- github.com/DevTable/container-cloud-config
- Update to latest mockldap with changes applied from coreos/mockldap
- Update dependencies in requirements.txt and requirements-dev.txt

* Default FLOAT_REPR function to str in json encoder and removes keyword assignment

True, False, and str were not keywords in Python2...

* [PROJQUAY-165] Replace package `bencode` with `bencode.py`

- Bencode is not compatible with Python 3.x and is no longer
  maintained. Bencode.py appears to be a drop-in replacement/fork
  that is compatible with Python 3.

* Make sure monkey.patch is called before anything else (

* Removes anunidecode dependency and replaces it with text_unidecode

* Base64 encode/decode pickle dumps/loads when storing value in DB

Base64 encodes/decodes the serialized values when storing them in the
DB. Also make sure to return a Python3 string instead of a Bytes when
coercing for db, otherwise, Postgres' TEXT field will convert it into
a hex representation when storing the value.

* Implement __hash__ on Digest class

In Python 3, if a class defines __eq__() but not __hash__(), its
instances will not be usable as items in hashable collections (e.g sets).

* Remove basestring check

* Fix expected message in credentials tests

* Fix usage of Cryptography.Fernet for Python3 (#219)

- Specifically, this addresses the issue where Byte<->String
  conversions weren't being applied correctly.

* Fix utils

- tar+stream layer format utils
- filelike util

* Fix storage tests

* Fix endpoint tests

* Fix workers tests

* Fix docker's empty layer bytes

* Fix registry tests

* Appr

* Enable CI for Python 3.6

* Skip buildman tests

Skip buildman tests while it's being rewritten to allow ci to pass.

* Install swig for CI

* Update expected exception type in redis validation test

* Fix gpg signing calls

Fix gpg calls for updated gpg wrapper, and add signing tests.

* Convert / to // for Python3 integer division

* WIP: Update buildman to use asyncio instead of trollius.

This dependency is considered deprecated/abandoned and was only
used as an implementation/backport of asyncio on Python 2.x
This is a work in progress, and is included in the PR just to get the
rest of the tests passing. The builder is actually being rewritten.

* Target Python 3.8

* Removes unused files

- Removes unused files that were added accidentally while rebasing
- Small fixes/cleanup
- TODO tasks comments

* Add TODO to verify rehash backward compat with resumablehashlib

* Revert "[PROJQUAY-135] Fix unhashable class error" and implements __hash__ instead.

This reverts commit 735e38e3c1d072bf50ea864bc7e119a55d3a8976.
Instead, defines __hash__ for encryped fields class, using the parent
field's implementation.

* Remove some unused files ad imports

Co-authored-by: Kenny Lee Sin Cheong <kenny.lee@redhat.com>
Co-authored-by: Tom McKay <thomasmckay@redhat.com>
2020-06-05 16:50:13 -04:00
Joseph Schorr
312717c789
Handle the scenario where the OCI config is missing the history entry (#377)
We instead synthesize layers based solely on the blob data and the
last config entry
2020-05-11 11:04:05 -04:00
Joseph Schorr
2921b3aad2
Fix handling of OCI indexes and add some tests (#348)
Fixes https://issues.redhat.com/browse/PROJQUAY-621
2020-04-22 19:08:18 -04:00
Joseph Schorr
b211816aba
Implement experimental support for OCI manifests (#279)
* Implement OCI manifest and index support

* Remove unnecessary data model check in registry protocol fixtures

* Implement OCI testing

* Add migration for adding OCI content types

* Remove unused supports_schema2

* Add OCI_NAMESPACE_WHITELIST and reformat with black

* Catch errors in legacy image population and raise appropriately

* Add support for registration of additional artifact types

This change adds the infrastructure to support artifacts in OCI
manifests, but does not yet register any types

* Add a feature flag for enabling experimental Helm support via OCI

See: https://helm.sh/docs/topics/registries/
2020-04-13 11:24:09 -04:00
Joseph Schorr
e281d23f5e
Add a registry test for attempting to push a manifest pointing to (#292)
invalid config
2020-03-30 13:35:59 -04:00
Joseph Schorr
dce80ab26d
Fix support for empty manifests in V2_2 (#278)
Fixes https://issues.redhat.com/browse/PROJQUAY-510
2020-03-24 11:26:08 -04:00
Joseph Schorr
49862a9eda
Move shared image modules into a shared package in prep for adding OCI (#271) 2020-03-20 12:33:43 -04:00
Joseph Schorr
0844256a71
Major post-OCI cleanup (#225)
* Remove V3_UPGRADE_MODE

* Remove tag backfill worker and all callers to tag backfill and upgrades

* Change initdb to create all test data via the manifest builder, rather than manually via legacy images

* Convert various code paths to use the registry_model where we previously did not do so

* Convert the GC test suite to build via the manifest builder

* Delete an old, unused tool

* Delete the Pre OCI registry model

* Add additional error handling to the manifest creation code path

* Add additional error handling to the OCI tag creation code path

* Change how we respond to invalid manifest content types to better handle unknowns

* Change legacy secscan test suite to use the registry model

* Change the repo build badge to use the registry model (also fixes a bug)

* Delete now-unused data model code

* Remove old model adjustment code from OCI model

* Mark older data models as deprecated which will prevent new rows from being inserted

* Remove references to old registry test suite from various testing files

* Remove tag backfill worker (again; got re-added during rebase)

* Move all deprecated model checks into a central function

* Make data_migration more Pythonic

* Small requested fixes to Tag module styling

* Have tag backfill worker fail to migrate if there are TagManifest's

Since this backfill should only be called in future releases for empty models, this should catch someone attempting to upgrade from a too-old version

* Remove labelbackfillworker as it is no longer needed

* Remove unused invalid import

* Reimplement the tag test for the remaining method used
2020-03-17 13:27:29 -04:00
alecmerdler
3dd5f045ff fix all the docstrings 2020-02-05 19:55:07 -08:00
Joseph Schorr
eeb8148264 The created key in V2_2 config is optional, so make sure to treat it as such
Fixes https://issues.redhat.com/browse/QUAY-2111
2019-12-31 15:22:50 +02:00
Tom McKay
e6ae94db8b 'make black' results 2019-12-02 12:23:08 -05:00
Jimmy Zelinskie
9c0dd3b722 initial import for Open Source 🎉 2019-11-12 11:09:47 -05:00