Commit Graph
284 Commits
Author SHA1 Message Date
Martin Simon e58bab9587 Make the set of Acquire-By-Hash algorithms configurable
Acquire-By-Hash entries are written for MD5Sum, SHA1, SHA256 and SHA512,
hardcoded in two places in deb/index_files.go. Every algorithm is a full
set of index copies on each publish, and on S3-like storage each of those
is a network round trip rather than a link.

Measured on an R2-backed archive of 25 packages across three suites, one
`aptly publish update` per suite:

  Acquire-By-Hash off   38 S3 requests
  Acquire-By-Hash on   222 S3 requests   (88 HeadObject, 83 CopyObject,
                                          35 DeleteObject, 13 PutObject)

Modern apt verifies with SHA256; MD5Sum and SHA1 are deprecated and
Debian has been phasing them out of Release files for years. Publishers
who do not need them are paying three quarters of that for nothing, with
no way to say so.

acquireByHashAlgorithms in aptly.conf now selects the set. An empty or
absent value keeps all four, so existing configurations are unaffected.
The order entries are written in comes from the code rather than the
config, so the directories created in one loop and the entries written in
another cannot disagree. An unrecognised name is an error rather than
something to skip: skipping a typo would produce "no by-hash entries for
that algorithm", which looks exactly like having configured it away.

Set per publish invocation from the config, the way SkipBz2 already is,
rather than persisted on the publish point.

Pre-existing test failures on this tree are unchanged by this commit:
deb goes 173->177 passed with the same 11 failures, utils keeps its one
(TestCompress), s3 stays green.
2026-11-03 13:13:18 +01:00
Luan Dang 0d23d32840 test: handle HEAD metrics response cleanup 2026-11-03 11:42:38 +01:00
Luan DangandCopilot Autofix powered by AI 198c801f00 Refactor TestHeadMetrics for improved testing
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-11-03 11:42:38 +01:00
Luan Dang 328120f80a api: add metrics-only listener 2026-11-03 11:42:38 +01:00
James Munson 2d72d1f0d5 Expose net/http/pprof handlers under /api/debug/pprof/* when the new
enablePprofEndpoint (JSON) / enable_pprof_endpoint (YAML) config option
is true. The endpoint is disabled by default.
2026-11-02 15:14:35 +01:00
André Roth 5775d2e31c Merge pull request #1656 from aptly-dev/fix/mirror-rename
mirror: fix rename
2026-11-01 10:36:13 +01:00
André Roth bddfed27e5 swagger: fix validation error 2026-11-01 02:30:33 +01:00
André Roth cd365b2899 mirror: fix rename 2026-11-01 02:30:11 +01:00
André Roth 3c46f7976b Merge pull request #1624 from chipflake/api-codename
api/publish: allow setting custom Codename on the Release file
2026-11-01 00:36:28 +01:00
André Roth bf06c688ed Merge pull request #1611 from tbe/api-pull-fix
api: fix snasphot-pull
2026-10-31 23:35:07 +01:00
adam magued f525d653a5 test(api): add regression test for concurrent snapshot deletion 2026-10-14 15:55:55 +03:00
adam magued 74c13f73f2 fix(api): handle concurrent snapshot deletion during list endpoint 2026-10-14 15:55:53 +03:00
Eleni Michalaki 3d7f17e849 api/publish: allow setting custom Codename on the Release file 2026-08-26 11:35:43 +02:00
Thomas Berger f95153a7c9 api: fix snasphot-pull
in the API, snapshotPull never finished reading the target repository
within the async block. So the target was treated as an empty
snapshot, and a pull would only carry over the content from the sources
2026-07-25 01:48:55 +02:00
André Roth 48907fc915 Merge pull request #1594 from aptly-dev/fix/s3-race
s3: fix race conditions
2026-06-19 13:31:12 +02:00
André Roth c63324756b 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-19 12:53:44 +02:00
André Roth cfa79a0a32 api: make updating name optional in repo edit
and path escape the new name param
2026-06-19 11:47:07 +02:00
André Roth dd85493b1a publish: check if storage exists 2026-06-18 21:34:55 +02:00
André Roth b28daa8417 initial commit for JFrog support
# Conflicts:
#	api/api_test.go
#	api/router.go
#	go.mod
#	go.sum
#	utils/config_test.go
2026-06-18 18:18:31 +02:00
Pierig Le Saux 4b8f0c42ac initial commit for JFrog support 2026-06-18 13:38:03 +02:00
Pierig Le Saux d5fbf0f795 feat: add GCS publish backend with config, API, docs, and tests 2026-06-17 23:39:27 +02:00
Pierig Le Saux ed4af9a0f6 add support for gcs 2026-06-17 23:39:26 +02:00
André Roth c2b0379e91 docs(dput): add missing @Router swagger annotation to apiFilesUploadOne 2026-06-17 21:29:06 +02:00
André Roth 84a5c20abe fix(dput): call syncFile to surface ENOSPC on upload 2026-06-17 21:29:06 +02:00
André Roth d3a613c335 fix(dput): replace manual read loop with io.Copy 2026-06-17 21:29:06 +02:00
André Roth 4e4ca0f38e fix(dput): validate :file path param to prevent directory traversal 2026-06-17 21:29:06 +02:00
Benoît Allard 12390f102e Add API endpoint suitable for dput. 2026-06-17 21:29:06 +02:00
André Roth caed9c234d publish: support MultiDist toggle 2026-06-13 14:48:01 +02:00
André Roth dfa34157a0 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-13 14:47:58 +02:00
André Roth 722064363c 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-13 14:47:58 +02:00
André Roth 9771f228bc 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-13 14:47:58 +02:00
André Roth 6ee51b6454 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-13 14:47:40 +02:00
André Roth c723fea807 docs: fix typos 2026-05-04 11:35:55 +02:00
André Roth a20eb6866a document prometheus API
* enable in dev and test env
* fix api/repos doc
2026-04-26 23:56:05 +02:00
André Roth 0b84009b4a tests: add new arguments 2026-04-26 18:37:36 +02:00
Pierig Le Saux 92d7561d49 test(api): add coverage for NumPackages list handlers and error paths 2026-04-26 18:37:36 +02:00
Pierig Le Saux e908531bef feat(api): add NumPackages to mirrors/repos/snapshots list responses
add API response wrappers with NumPackages derived from RefList length; keep show endpoint payloads unchanged for backward compatibility; add API tests for list endpoint NumPackages; update swagger response schemas for list endpoints
2026-04-26 18:37:36 +02:00
Pierig Le Saux 8be72b48a1 update 2026-04-26 17:44:25 +02:00
Pierig Le Saux 5655480e00 add codecoverage 2026-04-26 17:44:25 +02:00
Pierig Le Saux 1ed50697ec fix: delete is interactive 2026-04-26 17:44:25 +02:00
Pierig Le Saux 89e3bdfa07 delete a gpg key 2026-04-26 17:44:25 +02:00
Philip Cramer a7a4bb7001 test: improve test coverage for AppStream feature 2026-04-26 15:04:38 +02:00
Philip Cramer 29c37293b9 feat: wire AppStream support through CLI, API, and publish 2026-04-26 15:04:17 +02:00
André Roth f6221a2413 Merge pull request #1535 from lecafard/push-qxtqtunqqqnu
Add edit mirror API endpoint
2026-04-26 13:57:49 +02:00
Russell Greene 66e814c086 fix docs for Serve in API mode 2026-04-13 10:59:47 -06:00
tom b3f5d96490 Add edit mirror API endpoint 2026-04-12 22:26:58 +02:00
Zhang Xiao e2ebcbb02a Release file: support Version field
https://wiki.debian.org/DebianRepository/Format#Version

The Version field, if specified, shall be the version of the release.
On the other hand, if not set or set to an empty value, the Version
field will not be included in the Release file.

Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com>
2026-03-03 07:38:44 +00:00
Ales Bregar 1702537979 clearer REST api docs, put whitespace to docs to show that keyId strings are trimmed 2026-01-24 10:55:15 +01:00
Ales Bregar 12604b9379 updating REST api with multiple gpg keys support, due backwards compatibility introducing CSV under same key (gpg-key) 2026-01-24 10:55:15 +01:00
Zhang Xiao a2ffffedc1 Support updating label and origin domain of publish
Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com>
2026-01-16 14:50:09 +01:00