1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00
Commit Graph

465 Commits

Author SHA1 Message Date
Joseph Schorr
140a7c54a6 Optimize the queries used in the RAC worker (#415)
Instead of an expensive subquery to find candidates, we use the slab
allocator.

This change also adds a feature flag for disabling the worker if
necessary, and changes the worker's timeout to be much longer

Fixes https://issues.redhat.com/browse/PROJQUAY-779
2020-06-11 11:24:37 -04:00
Joseph Schorr
8ff86175b8 Fix handling of client connections in pymemcache cache (#433)
pymemcache is apparently not thread safe, so our reuse of the client
was causing the occasional hang on read. This change has us open a new
connection per request, and then close it once complete. We also make
sure to close the DB connection before making the memcache connection,
in case the memcache connection takes a bit of time

We should investigate switching to the PooledClient library for reusing
connections (safely) once we verify this change works
2020-06-10 13:19:23 -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
77c0d87341 Add _driver_autocommit special config variable to allow us to enable (#424)
autocommit on select drivers
2020-06-05 16:47:49 -04:00
Jonathan King
85c5a7a3d7 Fixed repo list showing 'null' for state in api (#393)
* Update getting_started.md

* added tests

Co-authored-by: Jonathan <jonathan@fedora-jonathan.int.tocaconsulting.com>
2020-06-04 16:35:30 -04:00
Joseph Schorr
f1873aca21 Allow read replicas to have their own connections args (#414) 2020-06-04 16:06:58 -04:00
Joseph Schorr
d1f3da72fe Mark further blocks in the model to skip the read replica (#407) 2020-06-02 15:53:46 -04:00
Joseph Schorr
bc8dd498ef Make sure to immediately delete federated login links on user delete (#405)
Fixes https://issues.redhat.com/browse/PROJQUAY-760
2020-06-02 14:18:33 -04:00
Joseph Schorr
c90dee8c49 Make sure to filter deleted repositories from app registry list queries (#406)
Fixes https://issues.redhat.com/browse/PROJQUAY-762
2020-06-02 14:16:55 -04:00
Joseph Schorr
c7a4eef1aa Pop timeout from connection args for non-pooled DB (#398) 2020-05-28 17:54:14 -04:00
Joseph Schorr
9833713b0c Add caching for app registry listing package API (#374)
Fixes https://issues.redhat.com/browse/PROJQUAY-670
2020-05-18 11:07:11 -04:00
Joseph Schorr
556c46311d Enable Clair V4 to work with local storage (for POC only) (#380)
* Enable Clair V4 to work with local storage (for POC only)

* `.update` does not return the dictionary, so this call was returning `None` for headers
2020-05-18 11:06:56 -04:00
Joseph Schorr
6d5cd61d07 Disable read replica reading in critical registry paths (#267)
This ensures consistency when pushing when a read replica is enabled
2020-05-12 15:34:47 -04:00
Joseph Schorr
388b97922f Remove the use of a transaction for User and Repository delete (#273)
While a transaction is obviously safer, with the number of tables
and rows referencing these tables now, a transaction is potentially
locking up a significant chunk of the database. Since we're already
performing cleanup before calling the delete, including disabling
new data being written for the User or Repository, deletion without
a transaction should (usually) be sufficient; if it isn't, an
IntegrityError will be raised, and the workers can retry continuing
the GC operation
2020-05-12 12:22:25 -04:00
Joseph Schorr
f2eaba7ef2 Optimize repository lookup queries to meet the expected maximums (#246)
* Optimize repository lookup queries to meet the expected maximums

We were accidentally looking up more data that strictly allowed

Adds some additional assertions and testing as well

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

* Change loading of repositories in the repo view to be paginated

We drop the "card" view and switch to a table-only view, but still
load the full set of repositories

A followup change will begin to change the UI to only load additional
repos when requested
2020-05-12 12:12:54 -04:00
Joseph Schorr
3f8221f74d GC query improvements (#356)
* Change storage GC to process a single row at a time

This should remove the deadlock under the transaction and be much less
heavy on the DB

* Ensure we don't select repositories for GC from those already marked
for deletion or those under to-be-deleted namespaces

* Ensure that GC operations occur under global locks, to prevent
concurrent GC of the same repositories, which should reduce lock
contention on the database
2020-05-12 11:56:03 -04:00
Joseph Schorr
11bad4017d Remove deprecated torrent pull verb (#334)
Fixes https://issues.redhat.com/browse/PROJQUAY-587
2020-05-12 11:00:48 -04:00
Benjamin Merot
bab908d8f2 Defined found_results before try block so it's always assigned (#376)
Up until now, the "if not found_results" line could throw an UnboundLocalError because the variable was assigned inside a try block which could fail but the variable was later referenced.
2020-05-12 10:59:41 -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
Alec Merdler
f220bd1d9d create ManifestSecurityStatus with 'last_indexed' in the past to fix tests (#379) 2020-05-08 14:06:06 -07:00
Alec Merdler
6a68e399d7 fix re-indexing for Clair v4 security scanning (#373) 2020-05-08 09:11:27 -07:00
Alec Merdler
11eae32950 fix secscan model to work when only using Clair v2 (#362) 2020-04-30 14:24:08 -07:00
Kenny Lee Sin Cheong
816b7a9ed3 Add check for no repos when getting recent tags (#366)
Add an extra check and return an empty dict if no repo is given.
This is needed because `Tag.repository << [rid for rid in
repository_ids]` will fail on MySQL if the list is empty.
2020-04-30 14:55:45 -04:00
Kenny Lee Sin Cheong
7faae6e547 Remove assertion that repos exists (#365)
The previous assertion would just fail when there is no app repos in
the database.
2020-04-30 12:25:09 -04:00
Jimmy Zelinskie
26dcf45802 data.secscan_model: canonicalize before comparing 2020-04-28 18:13:40 -04:00
Joseph Schorr
0e221b0584 Fix the flaky GC verification test due to reuse of row IDs in SQLite (#358) 2020-04-28 18:12:51 -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
2f171889e4 Fix search filter for LDAP user lookup when no user filter is specified (#346)
The LDAP class defined the filter using a default Python parameter, so
we need to mimic it
2020-04-22 16:44:32 -04:00
Kenny Lee Sin Cheong
b703cb4524 Fix wrong reference name in ClairSecurityScannerAPI (#347)
* Fix wrong reference name in ClairSecurityScannerAPI

* Fix min_id referencing the value instead of the tuple reference
2020-04-22 15:27:05 -04:00
Joseph Schorr
6d733110da Add some additional information to help debug a flaky GC test (#333)
* Add some additional information to help debug a flaky GC test

* Make sure to cleanup our register callbacks
2020-04-14 23:31:01 -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
Alec Merdler
524a8157fd fix app repo 'last_modified' field (#326) 2020-04-08 08:34:35 -07:00
Alec Merdler
e003b8e8ed fix security scan column on tags view for Clair v2 (#324) 2020-04-07 14:40:58 -07:00
Joseph Schorr
3e8ef9574c Ensure that all user-provided filters are wrapped in parens (#322)
Also adds tests and fixes some issues with our existing filter

Fixes https://issues.redhat.com/browse/PROJQUAY-551
2020-04-07 17:30:12 -04:00
Alec Merdler
f39779db2c safe lookup of 'Features' property for Clair v2 (#320) 2020-04-06 15:30:05 -07:00
Joseph Schorr
93fa983f36 Add missing limit on RAC deletion code query (#317) 2020-04-06 13:19:30 -04:00
Joseph Schorr
48036344e3 Removed unused code after the recent cleanup (#311) 2020-04-03 15:02:35 -04:00
Joseph Schorr
076d7ddd01 Freeze time in the combined logs model tests to remove flakes (#302) 2020-04-03 11:01:51 -04:00
thomasmckay
2f4ac74bf0 PROJQUAY-550 - correct verify_tls mirroring (#305) 2020-04-02 13:51:11 -04:00
Alec Merdler
531b97c4f9 implement Clair v4 client and set up model splitting (#259) 2020-03-31 11:32:56 -07:00
Jake Moshenko
0cae8f7322 DBA operator migration generator bug fixes. (#291)
* DBA operator migration generator bug fixes.
Fix a bug where historical migrations had table and index names swapped.
Fix a bug where migrations were always being generated on upgrade and
downgrade.

* reformat with black
2020-03-27 14:30:22 -04:00
Joseph Schorr
e140a3928d Implement a solution for long index names in sqlalchemybridge (#283)
We now cap the index name length at 64 (as per MySQL restrictions). If
an index name is *longer* than that, we hash the index name in its
entirety and then append the short-sha of the hash as a suffix to a
shortened version of the index name. This ensures the index name meets
the length requirements while *also* being stable across generations.

This change also adds a legacy map of long index names to the names we
manually applied, to ensure they don't get regenerated either
2020-03-27 14:19:31 -04:00
Joseph Schorr
cb103e28de Fix unicode decode error when attempting to send unicode robot names (#288) 2020-03-27 11:40:13 -04:00
Joseph Schorr
54577af673 Change manifest builder's state to be serialized via JSON (#286)
When stored directly, we were encountering unicode errors for the image
metadata on older Docker clients. By serializing to/from JSON, we ensure
the unicode is handled properly
2020-03-26 15:13:52 -04:00
Joseph Schorr
59bc23313c Add additional detection for transitive deletes and fix those found (#281)
We were not testing for transitive deletes when performing *User*
deletion, which led us to have a few
2020-03-25 15:58:12 -04:00
Joseph Schorr
3d2aadf91c Update the manifest builder for V1 API to not construct Image rows (#280)
Instead, we now simply save all the Image information into the
in-memory session and then construct the manifest directly at the end.

Fixes https://issues.redhat.com/browse/PROJQUAY-513
2020-03-25 15:05:17 -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
79ca6f28cf Remove the shared registry model impl now that we have a single (#275)
registry model
2020-03-19 16:57:43 -04:00
Joseph Schorr
8701577cff Have the RepositoryActionCount worker cleanup old rows in RAC (#274)
We don't make use of any action counts older than a year, so this
change will have the worker remove old rows, one month (roughly) at
a time
2020-03-18 17:00:14 -04:00