Skip to content

Commit b8455f6

Browse files
authored
Merge branch 'master' into s3-reupload-fix
2 parents 12b6b04 + 132c923 commit b8455f6

31 files changed

Lines changed: 573 additions & 246 deletions

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ jobs:
109109
strategy:
110110
fail-fast: false
111111
matrix:
112-
name: ["Debian 13/testing", "Debian 12/bookworm", "Debian 11/bullseye", "Debian 10/buster", "Ubuntu 24.04", "Ubuntu 22.04", "Ubuntu 20.04"]
112+
name: ["Debian 13/trixie", "Debian 12/bookworm", "Debian 11/bullseye", "Ubuntu 24.04", "Ubuntu 22.04", "Ubuntu 20.04"]
113113
arch: ["amd64", "i386" , "arm64" , "armhf"]
114114
include:
115-
- name: "Debian 13/testing"
115+
- name: "Debian 13/trixie"
116116
suite: trixie
117117
image: debian:trixie-slim
118118
- name: "Debian 12/bookworm"
@@ -121,9 +121,6 @@ jobs:
121121
- name: "Debian 11/bullseye"
122122
suite: bullseye
123123
image: debian:bullseye-slim
124-
- name: "Debian 10/buster"
125-
suite: buster
126-
image: debian:buster-slim
127124
- name: "Ubuntu 24.04"
128125
suite: noble
129126
image: ubuntu:24.04
@@ -135,6 +132,7 @@ jobs:
135132
image: ubuntu:20.04
136133
container:
137134
image: ${{ matrix.image }}
135+
options: --user root
138136
env:
139137
APT_LISTCHANGES_FRONTEND: none
140138
DEBIAN_FRONTEND: noninteractive

‎AUTHORS‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,6 @@ List of contributors, in chronological order:
7171
* Silke Hofstra (https://github.com/silkeh)
7272
* Itay Porezky (https://github.com/itayporezky)
7373
* Alejandro Guijarro Monerris (https://github.com/alguimodd)
74+
* JupiterRider (https://github.com/JupiterRider)
75+
* Agustin Henze (https://github.com/agustinhenze)
76+
* Tobias Assarsson (https://github.com/daedaluz)

‎Makefile‎

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,23 @@ COVERAGE_DIR?=$(shell mktemp -d)
77
GOOS=$(shell go env GOHOSTOS)
88
GOARCH=$(shell go env GOHOSTARCH)
99

10+
export PODMAN_USERNS = keep-id
11+
DOCKER_RUN = docker run --security-opt label=disable -it --user 0:0 --rm -v ${PWD}:/work/src
12+
1013
# Setting TZ for certificates
1114
export TZ=UTC
1215
# Unit Tests and some sysmte tests rely on expired certificates, turn back the time
1316
export TEST_FAKETIME := 2025-01-02 03:04:05
1417

18+
# run with 'COVERAGE_SKIP=1' to skip coverage checks during system tests
19+
ifeq ($(COVERAGE_SKIP),1)
20+
COVERAGE_ARG_BUILD :=
21+
COVERAGE_ARG_TEST := --coverage-skip
22+
else
23+
COVERAGE_ARG_BUILD := -coverpkg="./..."
24+
COVERAGE_ARG_TEST := --coverage-dir $(COVERAGE_DIR)
25+
endif
26+
1527
# export CAPUTRE=1 for regenrating test gold files
1628
ifeq ($(CAPTURE),1)
1729
CAPTURE_ARG := --capture
@@ -103,13 +115,13 @@ test: prepare swagger etcd-install ## Run unit tests (add TEST=regex to specify
103115

104116
system-test: prepare swagger etcd-install ## Run system tests
105117
# build coverage binary
106-
go test -v -coverpkg="./..." -c -tags testruncli
118+
go test -v $(COVERAGE_ARG_BUILD) -c -tags testruncli
107119
# Download fixture-db, fixture-pool, etcd.db
108120
if [ ! -e ~/aptly-fixture-db ]; then git clone https://github.com/aptly-dev/aptly-fixture-db.git ~/aptly-fixture-db/; fi
109121
if [ ! -e ~/aptly-fixture-pool ]; then git clone https://github.com/aptly-dev/aptly-fixture-pool.git ~/aptly-fixture-pool/; fi
110122
test -f ~/etcd.db || (curl -o ~/etcd.db.xz http://repo.aptly.info/system-tests/etcd.db.xz && xz -d ~/etcd.db.xz)
111123
# Run system tests
112-
PATH=$(BINPATH)/:$(PATH) FORCE_COLOR=1 $(PYTHON) system/run.py --long --coverage-dir $(COVERAGE_DIR) $(CAPTURE_ARG) $(TEST)
124+
PATH=$(BINPATH)/:$(PATH) FORCE_COLOR=1 $(PYTHON) system/run.py --long $(COVERAGE_ARG_TEST) $(CAPTURE_ARG) $(TEST)
113125

114126
bench:
115127
@echo "\e[33m\e[1mRunning benchmark ...\e[0m"
@@ -173,16 +185,16 @@ docker-image-no-cache: ## Build aptly-dev docker image (no cache)
173185
@docker build --no-cache -f system/Dockerfile . -t aptly-dev
174186

175187
docker-build: ## Build aptly in docker container
176-
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper build
188+
@$(DOCKER_RUN) aptly-dev /work/src/system/docker-wrapper build
177189

178190
docker-shell: ## Run aptly and other commands in docker container
179-
@docker run -it --rm -p 3142:3142 -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper || true
191+
@$(DOCKER_RUN) -p 3142:3142 aptly-dev /work/src/system/docker-wrapper || true
180192

181193
docker-deb: ## Build debian packages in docker container
182-
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper dpkg DEBARCH=amd64
194+
@$(DOCKER_RUN) aptly-dev /work/src/system/docker-wrapper dpkg DEBARCH=amd64
183195

184196
docker-unit-test: ## Run unit tests in docker container (add TEST=regex to specify which tests to run)
185-
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper \
197+
@$(DOCKER_RUN) aptly-dev /work/src/system/docker-wrapper \
186198
azurite-start \
187199
AZURE_STORAGE_ENDPOINT=http://127.0.0.1:10000/devstoreaccount1 \
188200
AZURE_STORAGE_ACCOUNT=devstoreaccount1 \
@@ -191,27 +203,27 @@ docker-unit-test: ## Run unit tests in docker container (add TEST=regex to spec
191203
azurite-stop
192204

193205
docker-system-test: ## Run system tests in docker container (add TEST=t04_mirror or TEST=UpdateMirror26Test to run only specific tests)
194-
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper \
206+
@$(DOCKER_RUN) aptly-dev /work/src/system/docker-wrapper \
195207
azurite-start \
196208
AZURE_STORAGE_ENDPOINT=http://127.0.0.1:10000/devstoreaccount1 \
197209
AZURE_STORAGE_ACCOUNT=devstoreaccount1 \
198210
AZURE_STORAGE_ACCESS_KEY="Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" \
199211
AWS_ACCESS_KEY_ID=$(AWS_ACCESS_KEY_ID) \
200212
AWS_SECRET_ACCESS_KEY=$(AWS_SECRET_ACCESS_KEY) \
201-
system-test TEST=$(TEST) \
213+
system-test TEST=$(TEST) CAPTURE=$(CAPTURE) COVERAGE_SKIP=$(COVERAGE_SKIP) \
202214
azurite-stop
203215

204216
docker-serve: ## Run development server (auto recompiling) on http://localhost:3142
205-
@docker run -it --rm -p 3142:3142 -v ${PWD}:/work/src -v /tmp/cache-go-aptly:/var/lib/aptly/.cache/go-build aptly-dev /work/src/system/docker-wrapper serve || true
217+
@$(DOCKER_RUN) -p 3142:3142 -v /tmp/cache-go-aptly:/var/lib/aptly/.cache/go-build aptly-dev /work/src/system/docker-wrapper serve || true
206218

207219
docker-lint: ## Run golangci-lint in docker container
208-
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper lint
220+
@$(DOCKER_RUN) aptly-dev /work/src/system/docker-wrapper lint
209221

210222
docker-binaries: ## Build binary releases (FreeBSD, macOS, Linux generic) in docker container
211-
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper binaries
223+
@$(DOCKER_RUN) aptly-dev /work/src/system/docker-wrapper binaries
212224

213225
docker-man: ## Create man page in docker container
214-
@docker run -it --rm -v ${PWD}:/work/src aptly-dev /work/src/system/docker-wrapper man
226+
@$(DOCKER_RUN) aptly-dev /work/src/system/docker-wrapper man
215227

216228
mem.png: mem.dat mem.gp
217229
gnuplot mem.gp

‎README.rst‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Define Release APT sources in ``/etc/apt/sources.list.d/aptly.list``::
6363

6464
deb [signed-by=/etc/apt/keyrings/aptly.asc] http://repo.aptly.info/release DIST main
6565

66-
Where DIST is one of: ``buster``, ``bullseye``, ``bookworm``, ``focal``, ``jammy``, ``noble``
66+
Where DIST is one of: ``bullseye``, ``bookworm``, ``trixie``, ``focal``, ``jammy``, ``noble``
6767

6868
Install aptly packages::
6969

@@ -80,7 +80,7 @@ Define CI APT sources in ``/etc/apt/sources.list.d/aptly-ci.list``::
8080

8181
deb [signed-by=/etc/apt/keyrings/aptly.asc] http://repo.aptly.info/ci DIST main
8282

83-
Where DIST is one of: ``buster``, ``bullseye``, ``bookworm``, ``focal``, ``jammy``, ``noble``
83+
Where DIST is one of: ``bullseye``, ``bookworm``, ``trixie``, ``focal``, ``jammy``, ``noble``
8484

8585
Note: same gpg key is used as for the Upstream Debian Packages.
8686

‎Releasing.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ git push origin v$version master
1313
- run swagger locally (`make docker-serve`)
1414
- copy generated docs/swagger.json to https://github.com/aptly-dev/www.aptly.info/tree/master/static/swagger/aptly_1.x.y.json
1515
- add new version to select tag in content/doc/api/swagger.md line 48
16+
- update version in content/download.md
1617
- push commit to master
1718
- create release announcement on https://github.com/aptly-dev/aptly/discussions

‎api/api.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func apiReady(isReady *atomic.Value) func(*gin.Context) {
7070
return
7171
}
7272

73-
status := aptlyStatus{Status: "Aptly is ready"}
73+
status := aptlyStatus{Status: "Aptly is ready"}
7474
c.JSON(200, status)
7575
}
7676
}
@@ -178,7 +178,7 @@ func truthy(value interface{}) bool {
178178
if value == nil {
179179
return false
180180
}
181-
switch v := value.(type) {
181+
switch v := value.(type) {
182182
case string:
183183
switch strings.ToLower(v) {
184184
case "n", "no", "f", "false", "0", "off":

‎api/publish.go‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ type publishedRepoUpdateSwitchParams struct {
393393
// @Description
394394
// @Description See also: `aptly publish update` / `aptly publish switch`
395395
// @Tags Publish
396-
// @Produce json
397396
// @Param prefix path string true "publishing prefix"
398397
// @Param distribution path string true "distribution name"
399398
// @Param _async query bool false "Run in background and return task object"

‎api/repos.go‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,18 @@ func apiReposEdit(c *gin.Context) {
195195
collectionFactory := context.NewCollectionFactory()
196196
collection := collectionFactory.LocalRepoCollection()
197197

198-
repo, err := collection.ByName(c.Params.ByName("name"))
198+
name := c.Params.ByName("name")
199+
repo, err := collection.ByName(name)
199200
if err != nil {
200201
AbortWithJSONError(c, 404, err)
201202
return
202203
}
203204

204-
if b.Name != nil {
205+
if b.Name != nil && *b.Name != name {
205206
_, err := collection.ByName(*b.Name)
206207
if err == nil {
207208
// already exists
208-
AbortWithJSONError(c, 404, err)
209+
AbortWithJSONError(c, 404, fmt.Errorf("local repo with name %q already exists", *b.Name))
209210
return
210211
}
211212
repo.Name = *b.Name
@@ -455,7 +456,7 @@ func apiReposPackagesDelete(c *gin.Context) {
455456
// @Tags Repos
456457
// @Param name path string true "Repository name"
457458
// @Param dir path string true "Directory of packages"
458-
// @Param file path string false "Filename (optional)"
459+
// @Param file path string true "Filename"
459460
// @Param _async query bool false "Run in background and return task object"
460461
// @Produce json
461462
// @Success 200 {string} string "OK"
@@ -901,10 +902,10 @@ func apiReposIncludePackageFromDir(c *gin.Context) {
901902
out.Printf("Failed files: %s\n", strings.Join(failedFiles, ", "))
902903
}
903904

904-
ret := reposIncludePackageFromDirResponse{
905+
ret := reposIncludePackageFromDirResponse{
905906
Report: reporter,
906907
FailedFiles: failedFiles,
907-
}
908+
}
908909
return &task.ProcessReturnValue{Code: http.StatusOK, Value: ret}, nil
909910
})
910911
}

‎api/snapshot.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,9 @@ type snapshotsCreateFromRepositoryParams struct {
217217
// @Summary Snapshot Repository
218218
// @Description **Create a snapshot of a repository by name**
219219
// @Tags Snapshots
220-
// @Param name path string true "Repository name"
221220
// @Consume json
222221
// @Param request body snapshotsCreateFromRepositoryParams true "Parameters"
223-
// @Param name path string true "Name of the snapshot"
222+
// @Param name path string true "Repository name"
224223
// @Param _async query bool false "Run in background and return task object"
225224
// @Produce json
226225
// @Success 201 {object} deb.Snapshot "Created snapshot object"

‎azure/package_pool.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (pool *PackagePool) Open(path string) (aptly.ReadSeekerCloser, error) {
104104
if err != nil {
105105
return nil, errors.Wrapf(err, "error creating tempfile for %s", path)
106106
}
107-
defer func () { _ = os.Remove(temp.Name()) }()
107+
defer func() { _ = os.Remove(temp.Name()) }()
108108

109109
_, err = pool.az.client.DownloadFile(context.TODO(), pool.az.container, path, temp, nil)
110110
if err != nil {

0 commit comments

Comments
 (0)