Commit Graph

2627 Commits

Author SHA1 Message Date
André Roth 67cdd00ff7 (not4debian) ci: run unit tests in docker
- run separate unit-test job
- build docker
- allow make docker-unit-tests in ci
2026-06-20 11:02:43 +02:00
André Roth f02298b9c7 go: mod tidy 2026-06-20 11:02:43 +02:00
André Roth 01ba94bdbe s3: fix pathCache race condition
Make sure pathCache is properly locked for concurrent access.

Add RWMutex to the PublishedStorage struct:
- Cache initialization
  Read-lock to test for nil, then write-lock with a second nil check before populating
- Cache reads
  RLock/RUnlock, allowing concurrent readers
- Cache writes / deletes
  Lock/Unlock
2026-06-20 11:02:43 +02:00
André Roth 5fd95b9216 api: make updating name optional in repo edit
and path escape the new name param
2026-06-20 11:02:43 +02:00
André Roth cff6fc5b56 tests: remove temporary folders 2026-06-20 11:02:43 +02:00
André Roth e10cc0a20a Source files: fix empty line in Package-List 2026-06-20 11:02:43 +02:00
André Roth f47586a19a (adapted4debian) publish: check if storage exists 2026-06-20 11:02:38 +02:00
André Roth 44d00ca240 (debian) swagger: remove test 2026-06-20 11:01:55 +02:00
André Roth f2d890c490 (adapted4debian) publish: support MultiDist toggle 2026-06-19 22:20:46 +02:00
André Roth 162692ed3d tasks: fix race conditions
* show resources in task details
* fix task state locking
* return task object consistently

Race condition iexisted where task State, err, and processReturnValue fields
were written by consumer goroutine and read by concurrent accessors without
proper synchronization, causing torn reads and data races.
2026-06-19 22:20:46 +02:00
André Roth 94bbee5f9d (adapted4debian) mirror: fix race conditions
* load data inside background tasks
  Perform collection.LoadComplete inside maybeRunTaskInBackground
  Have tasks use a fresh copy of taskCollectionFactory, taskCollection
2026-06-19 22:20:45 +02:00
André Roth 7bc47a6c59 snapshot: fix race conditions
* perform collection.LoadComplete inside maybeRunTaskInBackground
 * have tasks use a fresh copy of taskCollectionFactory, taskCollection
 * fix locking for snapshots of snapshots by locking SourceSnapshots
 * use uuids, since names can be renamed
2026-06-19 22:20:45 +02:00
André Roth 163803fdd6 repos: fix race conditions
* load data inside background tasks
  Perform collection.LoadComplete inside maybeRunTaskInBackground
  Have tasks use a fresh copy of taskCollectionFactory, taskCollection
* use uuids, since names can be renamed
2026-06-19 22:20:45 +02:00
André Roth 13da613c94 (adapted4debian) publish: fix race conditions
* remove useless resource lock
  Resource locks need to be before the background task. creating same publish endpoint at the same time is unlikely...
* load data inside background tasks
  This fixes a flaw in async apis, which loaded the published repo from the DB and mutated it outside the task closure, before the task lock was acquired.
  Perform collection.LoadComplete inside maybeRunTaskInBackground and have tasks use a fresh copy of taskCollectionFactory, taskCollection
* lock source repos/snapshots for publish operations
  Concurrent tasks were not properly locking their resources, leading to inconsistent published indexes:
  SourceLocalRepo: iterate published.Sources (component -> source UUID), look up each local repo via localRepoCollection.ByUUID and append string(repo.Key()) to resources
  SourceSnapshot: iterate b.Snapshots,look up each snapshot via snapshotCollection.ByName and append string(snapshot.ResourceKey()) to resources.
* lock pool on non MultiDist publish
* revert mutex on LinkFromPool
* use uuids, since names can be renamed
* add test for MultiDist change
2026-06-19 22:20:45 +02:00
Catalin Muresan 9e8ed76e70 Added tests to please codeconv 2026-06-19 22:20:45 +02:00
Catalin Muresan c779115c08 Fix crash in aptly db recover 2026-06-19 22:20:45 +02:00
André Roth b2ef0c2f18 docs: fix typos 2026-06-19 22:20:45 +02:00
André Roth 8789229cc4 system tests: do not depend on launchpad.net 2026-06-19 22:20:45 +02:00
André Roth 61a3d3d130 config: allow setting PPA Base URL 2026-06-19 22:20:45 +02:00
André Roth a76d01bd3b (adapted4debian) document prometheus API
* enable in dev and test env
* fix api/repos doc
2026-06-19 22:20:45 +02:00
Russell Greene a87bc41aaf fix docs for Serve in API mode 2026-06-19 22:20:45 +02:00
Tim Foerster 609b2da840 (adapted4debian) Add SOURCE_DATE_EPOCH support for reproducible builds
Implement support for the SOURCE_DATE_EPOCH environment variable as
specified by reproducible-builds.org. When set, this variable overrides
the current timestamp in the Release file's Date and Valid-Until fields,
enabling reproducible filesystem publishes.

- Read SOURCE_DATE_EPOCH environment variable in Publish()
- Use the epoch timestamp for both Date and Valid-Until fields
- Gracefully fallback to current time if unset or invalid
- Add comprehensive tests for valid and invalid SOURCE_DATE_EPOCH values
2026-06-19 22:20:45 +02:00
André Roth 4d6b83ff82 multi sign: add test 2026-06-19 22:20:45 +02:00
Ales Bregar c7ca974c2e clearer REST api docs, put whitespace to docs to show that keyId strings are trimmed 2026-06-19 22:20:45 +02:00
Ales Bregar 079273b06e updating REST api with multiple gpg keys support, due backwards compatibility introducing CSV under same key (gpg-key) 2026-06-19 22:20:45 +02:00
Ales Bregar 450757d411 review fix 2026-06-19 22:20:45 +02:00
Ales Bregar 1e0330ba3e system test t12_api sends empty keyRef string, making gpg fail 2026-06-19 22:20:45 +02:00
Ales Bregar cb04fdc21c system test unexpected string fix (would be helpful, but not changing the test just for this) 2026-06-19 22:20:45 +02:00
Ales Bregar bdf09992c9 system test configuration fix 2026-06-19 22:20:45 +02:00
Ales Bregar af304b93b5 documentation updated 2026-06-19 22:20:45 +02:00
Ales Bregar 1ec5a382fa white space revert to minimize change 2026-06-19 22:20:45 +02:00
Ales Bregar 788c3c6420 pgp: support multiple jeys
- #309 adding gpgKeys config key, accepting array of keyRef, cli args has precedence
- #691 adding handling of multiple keyRefs when signing with gpg
2026-06-19 22:20:45 +02:00
André Roth 1bdd1872c2 tasklist: fix deadlocks
* lock correct resources
* unlock list before queueing
2026-06-19 22:20:45 +02:00
André Roth f9d5427cde unit-test: use /smallfs when non-root 2026-06-19 22:20:45 +02:00
André Roth dbafacd531 ci: provide 1MB /smallfs to docker
# Conflicts:
#	Makefile
2026-06-19 22:20:45 +02:00
Brian Witt f38a727b6e (adapted4debian) error on out of space 2026-06-19 22:20:45 +02:00
Yaksh Bariya bfe6b75872 give myself some credit as well
Cause I'm nice :)
2026-06-19 22:20:45 +02:00
Yaksh Bariya e73d99d635 make version comparision more similar to that of dpkg
Initially found by automated repository health checks used by Termux
in https://github.com/termux/termux-packages/issues/27472

The root problem was 4.3.5a comparing less than 4.3.5-rc1-1 by aptly
According to debian "4.3.5a" > "4.3.5-rc1-1"

This is because dpkg splits hyphen for revision at the first hyphen,
whereas aptly was splitting at the last hyphen which is different from
dpkg's behaviour.

dpkg behaviour: https://git.dpkg.org/cgit/dpkg/dpkg.git/tree/lib/dpkg/parsehelp.c#n242

Perhaps this wasn't detected as there was broken tests in the repository
since the initial commit of aptly. This also fixes those tests
2026-06-19 22:20:45 +02:00
Tobias Assarsson a58d0266e7 fix repo edit api. 2026-06-19 22:20:45 +02:00
Ryan Gonzalez 13273d843e system-test: Allow skipping coverage
Enabling coverage near-doubles the incremental build time and adds
overhead to individual tests on the order of **5-10x** or more. It's not
essential to have this for quick local system-test runs, so add an option
to disable it.
2026-06-19 22:20:45 +02:00
Ryan Gonzalez 8d827b1312 system-test: Forward CAPTURE to docker
The code was only forwarding TEST, but CAPTURE is useful too.
2026-06-19 22:20:45 +02:00
Ryan Gonzalez 72f2ba3b1d docker: Preserve the go build cache
Otherwise, every `make docker-...` invocation will need to rebuild
everything from scratch.
2026-06-19 22:20:45 +02:00
Ryan Gonzalez 514e386502 docker: Fix usage with rootless podman and SELinux
When using rootless podman, the *current user* gets mapped to uid 0,
which results in the aptly user being unable to write to the build
directory. We can instead map the current user to the corresponding uid
in the container via `PODMAN_USERNS=keep-id`, which matches up with what
docker-wrapper wants...but then that will *enter the container as the
current uid*, which messes with the ability to set permissions on
`/var/lib/aptly`. That can be fixed by explicitly passing `--user 0:0`,
which should be a no-op on docker (since the container's default user is
already root).

Additionally, this adds `--security-opt label=disable` to avoid
permission errors when running on systems with SELinux enforcing.
2026-06-19 22:20:45 +02:00
Ryan Gonzalez 1ef694096a system-test: Fix crash when a comparison with a non-string value fails
`orig` isn't necessarily a string, so the string concatenation here can
raise a TypeError.
2026-06-19 22:20:45 +02:00
chesseed 9bff408b7b fix comment 2026-06-19 22:20:45 +02:00
chesseed 0b62edb84a fix swagger errors 2026-06-19 22:20:45 +02:00
JupiterRider 45fe4a58ca (adapted4debian) ran "gofmt -s -w ." to format the code 2026-06-19 22:20:45 +02:00
JupiterRider b560a8b146 add JupiterRider to AUTHORS file 2026-06-19 22:20:45 +02:00
JupiterRider 96512fb0e2 remove tautological (unnecessary) nil condition 2026-06-19 22:20:45 +02:00
Alejandro Guijarro Monerris 474d4fac36 chore: add name to AUTHORS 2026-06-19 22:20:45 +02:00