Commit graph

3110 commits

Author SHA1 Message Date
Kevin Morris
d8e3ca1abb
change(notify): converted to use aurweb.db ORM
- Removed notify sharness test

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-28 19:55:10 -08:00
Kevin Morris
9fb1fbe32c
feat(testing): add email testing utilities
Changes:
- util/sendmail now populates email files in the 'test-emails' directory.
    - util/sendmail does this in a serialized fashion based off of
      the test suite and name retrieved from PYTEST_CURRENT_TEST
      in the format: `<test_suite>_<test_function>.n.txt` where n
      is increased by one every time sendmail is run.
- pytest conftest fixtures have been added for test email setup;
  it wipes out old emails for the particular test function being run.
- New aurweb.testing.email.Email class allows developers to test
  against emails stored by util/sendmail. Simple pass the serial
  you want to test against, starting at serial = 1; e.g. Email(serial).

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-28 19:55:10 -08:00
Kevin Morris
b72bd38f76
change(pkgmaint): converted to use aurweb.db ORM
- Replaced time.time() usage with datetime.utcnow().timestamp()
- Removed pkgmaint sharness test

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-28 19:55:10 -08:00
Kevin Morris
f4ef02fa5b
fix(fastapi): fix Package's PackageBase backref cascade
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-28 19:55:09 -08:00
Kevin Morris
d097799b34
change(usermaint): converted to use aurweb.db ORM
- Removed usermaint sharness test

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-28 19:55:09 -08:00
Kevin Morris
8d5683d3f1
change(tuvotereminder): converted to use aurweb.db ORM
- Removed tuvotereminder sharness test.
- Added [tuvotereminder] section to config.defaults.
- Added `range_start` option to config.defaults [tuvotereminder].
- Added `range_end` option to config.defaults [tuvotereminder].

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-28 19:55:09 -08:00
Kevin Morris
29c2d0de6b
change(mkpkglists): converted to use aurweb.db ORM
- Improved speed dramatically
- Removed mkpkglists sharness

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-28 19:55:08 -08:00
Kevin Morris
c59acbf6d6
add noop testing utility
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-28 19:55:08 -08:00
Kevin Morris
29989b7fdb
change(aurblup): converted to use aurweb.db ORM
Introduces:
- aurweb.testing.alpm.AlpmDatabase
    - Used to mock up and manage a remote repository.
- templates/testing/alpm_package.j2
    - Used to generate a single ALPM package desc.
- Removed aurblup sharness test

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-28 19:55:08 -08:00
Kevin Morris
3efb9a57b5
change(popupdate): converted to use aurweb.db ORM
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-28 19:55:07 -08:00
Kevin Morris
3a65e33abe
fix(gitlab-ci): prepare conf/config for setup
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-28 19:35:32 -08:00
Kevin Morris
dbeebd3b01
change(fastapi): setup live database in mariadb-init-entrypoint.sh
Centralize database setup there and remove all copying of
config.dev from the entrypoint scripts (the Dockerfile
now does it).

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 23:29:49 -08:00
Kevin Morris
343a306bb8
change(docker): setup AUR_CONFIG in Dockerfile
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 23:29:44 -08:00
Kevin Morris
84beacd427
fix(docker): supply AUR_CONFIG_IMMUTABLE for docker-compose
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 22:49:52 -08:00
Kevin Morris
5b350bc361
change(docker): use aurweb-config to update AUR_CONFIG
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 22:49:48 -08:00
Kevin Morris
0726a08677
fix(docker): remove sqlite scripts
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 22:46:11 -08:00
Kevin Morris
f3efc18b50
feat(docker): force test db configuration
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 22:42:12 -08:00
Kevin Morris
0e938209af
feat(aurweb-config): add unset action and simplify
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 22:34:15 -08:00
Kevin Morris
199622c53f
fix(fastapi): refresh records when fetching updated packages
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 21:35:48 -08:00
Kevin Morris
232594ae44
Merge branch 'fix-sid-generation' into pu 2021-11-27 21:32:21 -08:00
Kevin Morris
7b0d664bc0
fix(docker): reorg ./data mounts
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 21:03:24 -08:00
Kevin Morris
47feb72f48
fix(fastapi): fix SessionID (and ResetKey) generation
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 20:19:40 -08:00
Kevin Morris
d658627e99
fix(fastapi): don't redirect to login on authed /login
Closes #184

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 19:14:32 -08:00
Kevin Morris
a87973e0c7
Merge branch 'pu-config' into pu 2021-11-27 16:54:19 -08:00
Kevin Morris
759f18ea75
feat: add aurweb-config console script
This can be used to update config values for the entirety
of a config. When config values are set through this tool,
$AUR_CONFIG is overridden with a copy of the config file
with all sections and options found in $AUR_CONFIG
+ $AUR_CONFIG_DEFAULTS.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 16:44:56 -08:00
Kevin Morris
b98159d5b9
change(docker): use step-ca for CA + cert generation
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-27 16:43:29 -08:00
Kevin Morris
e558e979ff
fix(fastapi): check ssh key prefixes against configured valid-keytypes
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-24 21:29:28 -08:00
Kevin Morris
1aab960401
fix: use corrent u2f ssh key prefixes
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-24 21:29:15 -08:00
Kevin Morris
47d83244bb
change(gitlab-ci): add 'fast-single-thread' tag to the test stage
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-22 22:26:56 -08:00
Kevin Morris
3b686c475d
fix: default detailed loglevel to DEBUG
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-22 10:22:58 -08:00
Kevin Morris
39fd3b891e
change: set -v for sh tests
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-22 10:22:32 -08:00
Kevin Morris
e891d7c8e8
change(docker): allow run-pytests to collect coverage
Additionally fix up the argument parsing to be a bit less
flexible.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-22 10:22:01 -08:00
Kevin Morris
34747359ba
fix(docker): expose git service's 2222 through 0.0.0.0
Other ports we use are locked to 127.0.0.1. The `git` service,
however, already promotes security in its sshd service and
can't really be abused from an external source. This simplifies
the need to forward to localhost if deploy targets want the sshd
to be available.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-21 23:11:02 -08:00
Kevin Morris
41e0eaaece
fix(docker): force bind ports to localhost only
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-21 21:43:59 -08:00
Kevin Morris
ffb450db71
Merge branch 'logging-fix' into pu 2021-11-21 00:56:29 -08:00
Kevin Morris
bc7bf9866a
docker: bind ./aurweb in cron service by default
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-21 00:55:27 -08:00
Kevin Morris
e8f4c9cf69
fix(fastapi): remove aurweb logger definition
Both the root and aurweb loggers are included in output,
causing repeated log messages. Now, just rely on the
root logger for aurweb logging.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-21 00:54:23 -08:00
Kevin Morris
d4d9f50b8f
change(docker): use ./data instead of ./cache
For the `git` service, ./data is always used to provide an
optional overriding of ssh host keys. In aur-dev production
containers, most services which use the data mount use an
internal Docker `data` volume instead.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-20 20:05:32 -08:00
Kevin Morris
604901fe74
fix(docker): fix nginx .gz match against cgit snapshots
This only deals with .gz files in the root of the request_uri
and now more. That is: /packages.gz goes through the nginx regex,
but now /cgit/.../snapshot/package.tar.gz is served by the cgit
block.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-20 20:00:53 -08:00
Kevin Morris
c7feecd4b8
housekeep(docker): remove configuration regexes in the nginx service
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-20 19:34:33 -08:00
Kevin Morris
a1e547c057
feat(docker): allow configurable SSH_CMDLINE in git service
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-20 19:04:38 -08:00
Kevin Morris
ba3ef742ce
feat(docker): allow user-customizable ssh host keys
There is a new ./data bind mount used here. If ssh_host_* keys are
in ./data when the git service starts, they'll override the
container-generated host keys.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-20 18:40:32 -08:00
Kevin Morris
233d25b1c3
feat: add test_spawn, an aurweb.spawn test
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-20 15:47:25 -08:00
Kevin Morris
19191fa8b5
fix: update nginx config in aurweb.spawn
Host a specific FastAPI nginx frontend as well as a PHP
nginx frontend, configurable by the (PHP|FASTAPI)_NGINX_PORT
environment variables.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-20 15:47:25 -08:00
Kevin Morris
47d0df76e6
feat: support gunicorn in aurweb.spawn
This also comes with a -w|--workers argument that allows
the caller to set the number of gunicorn workers.

Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-20 15:47:24 -08:00
Kevin Morris
82ca4ad9a0
feat: check php configuration in aurweb.spawn
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-20 15:47:24 -08:00
Kevin Morris
191198ca41
housekeep(fastapi): simplify aurweb.spawn.stop()
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-20 15:47:24 -08:00
Kevin Morris
0b5d088016
fix(fastapi): catch ProgrammingError instead of OperationalError in conftest
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-20 13:20:47 -08:00
Kevin Morris
008a8824ce
housekeep(fastapi): simplify package_base_comaintainers_post
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-20 13:20:46 -08:00
Kevin Morris
f897411ddf
change(fastapi): let conftest bypass create database errors
Signed-off-by: Kevin Morris <kevr@0cost.org>
2021-11-18 21:27:09 -08:00