mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-25 08:42:14 +00:00
Compare commits
65 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 65b34cfec5 | |||
| 48907fc915 | |||
| 6f92c51134 | |||
| c63324756b | |||
| cfa79a0a32 | |||
| 1b177bbf68 | |||
| c0c4bc3e35 | |||
| 64e298e737 | |||
| 423fb6e813 | |||
| 6c4d7a75f9 | |||
| a743f03242 | |||
| d9bedfa478 | |||
| e8e3f944ea | |||
| 3c98aa237a | |||
| be68b15b74 | |||
| 4a19238df8 | |||
| dd85493b1a | |||
| 29e643cdf6 | |||
| 9bb765d048 | |||
| b9d4aed7d8 | |||
| 160d16d96c | |||
| 4655f10048 | |||
| 3333a643cb | |||
| acc79d2cf6 | |||
| 9502f3833f | |||
| 7a2a82c60e | |||
| 7c47b8662f | |||
| ce070ec010 | |||
| fbad25e2b5 | |||
| 041eeff67d | |||
| 6244747912 | |||
| b28daa8417 | |||
| 214c151194 | |||
| 4b8f0c42ac | |||
| 8ebe80f066 | |||
| b0c65112cb | |||
| 46e9ac65fa | |||
| a2fb925a94 | |||
| b4a171b3ea | |||
| 83b1c1b6cb | |||
| 7dd5c34254 | |||
| e04df59065 | |||
| c02c469fa6 | |||
| d5fbf0f795 | |||
| ed4af9a0f6 | |||
| 9bb8de68d0 | |||
| 00e75ebf3c | |||
| c2b0379e91 | |||
| 84a5c20abe | |||
| d3a613c335 | |||
| 4e4ca0f38e | |||
| 12390f102e | |||
| 1224708283 | |||
| 1c1de6564b | |||
| 9c121c8111 | |||
| 2605dd24f5 | |||
| 781eaff397 | |||
| 33c06b1b4a | |||
| caed9c234d | |||
| af1df410a2 | |||
| dfa34157a0 | |||
| 722064363c | |||
| 9771f228bc | |||
| 6ee51b6454 | |||
| ab150890cb |
@@ -57,7 +57,7 @@ jobs:
|
||||
- name: "Install Test Packages"
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --no-install-recommends graphviz gnupg2 gpgv2 git gcc make devscripts python3 python3-requests-unixsocket python3-termcolor python3-swiftclient python3-boto python3-azure-storage python3-etcd3 python3-plyvel flake8 faketime
|
||||
sudo apt-get install -y --no-install-recommends graphviz gnupg2 gpgv2 git gcc make devscripts python3 python3-requests-unixsocket python3-termcolor python3-swiftclient python3-boto python3-azure-storage python3-etcd3 python3-plyvel flake8 faketime dput-ng
|
||||
|
||||
- name: "Checkout Repository"
|
||||
uses: actions/checkout@v4
|
||||
@@ -100,6 +100,9 @@ jobs:
|
||||
AZURE_STORAGE_ACCESS_KEY: "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
JFROG_URL: ${{ secrets.JFROG_URL }}
|
||||
JFROG_USERNAME: ${{ secrets.JFROG_USERNAME }}
|
||||
JFROG_PASSWORD: ${{ secrets.JFROG_PASSWORD }}
|
||||
run: |
|
||||
sudo mkdir -p /srv ; sudo chown runner /srv
|
||||
mkdir -p out/coverage
|
||||
|
||||
@@ -39,12 +39,13 @@ jobs:
|
||||
shell: sh
|
||||
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v4
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
# Require: The version of golangci-lint to use.
|
||||
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
|
||||
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
|
||||
version: v1.64.5
|
||||
version: v2.12.2
|
||||
args: --timeout=10m
|
||||
|
||||
# Optional: working directory, useful for monorepos
|
||||
# working-directory: somedir
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
version: "2"
|
||||
run:
|
||||
timeout: 5m
|
||||
linters:
|
||||
settings:
|
||||
staticcheck:
|
||||
|
||||
@@ -2,7 +2,7 @@ GOPATH=$(shell go env GOPATH)
|
||||
VERSION=$(shell make -s version)
|
||||
PYTHON?=python3
|
||||
BINPATH?=$(GOPATH)/bin
|
||||
GOLANGCI_LINT_VERSION=v2.0.2 # version supporting go 1.24
|
||||
GOLANGCI_LINT_VERSION=v2.12.2 # version supporting go 1.25
|
||||
COVERAGE_DIR?=$(shell mktemp -d)
|
||||
GOOS=$(shell go env GOHOSTOS)
|
||||
GOARCH=$(shell go env GOHOSTARCH)
|
||||
|
||||
@@ -133,3 +133,9 @@ Scala sbt:
|
||||
Molior:
|
||||
|
||||
- `Molior Debian Build System <https://github.com/molior-dbs/molior>`_ by André Roth
|
||||
|
||||
Jenny:
|
||||
|
||||
- `Jenny, an APT repository manager, a tool to manage Debian package repositories for a Debian-like distribution <https://github.com/groupe-edf/Jenny>`_ by EDF Group
|
||||
It handles incoming packages either built locally or mirrored from external sources, follows them through phases of development (called "environments"), and publishes them as repositories usable by apt and related tools.
|
||||
This tool is currently only in French language.
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -41,6 +42,22 @@ func createTestConfig() *os.File {
|
||||
jsonString, err := json.Marshal(gin.H{
|
||||
"architectures": []string{},
|
||||
"enableMetricsEndpoint": true,
|
||||
"S3PublishEndpoints": map[string]map[string]string{
|
||||
"test-s3": {
|
||||
"region": "us-east-1",
|
||||
"bucket": "bucket-s3",
|
||||
},
|
||||
},
|
||||
"GcsPublishEndpoints": map[string]map[string]string{
|
||||
"test-gcs": {
|
||||
"bucket": "bucket-gcs",
|
||||
},
|
||||
},
|
||||
"JFrogPublishEndpoints": map[string]map[string]string{
|
||||
"test-jfrog": {
|
||||
"url": "http://jfrog.example.com",
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil
|
||||
@@ -173,3 +190,39 @@ func (s *APISuite) TestTruthy(c *C) {
|
||||
c.Check(truthy(-1), Equals, true)
|
||||
c.Check(truthy(gin.H{}), Equals, true)
|
||||
}
|
||||
|
||||
func (s *APISuite) TestGetJFrogEndpoints(c *C) {
|
||||
response, err := s.HTTPRequest("GET", "/api/jfrog", nil)
|
||||
c.Assert(err, IsNil)
|
||||
c.Check(response.Code, Equals, 200)
|
||||
|
||||
var endpoints []string
|
||||
err = json.Unmarshal(response.Body.Bytes(), &endpoints)
|
||||
c.Assert(err, IsNil)
|
||||
sort.Strings(endpoints)
|
||||
c.Check(endpoints, DeepEquals, []string{"test-jfrog"})
|
||||
}
|
||||
|
||||
func (s *APISuite) TestGetS3Endpoints(c *C) {
|
||||
response, err := s.HTTPRequest("GET", "/api/s3", nil)
|
||||
c.Assert(err, IsNil)
|
||||
c.Check(response.Code, Equals, 200)
|
||||
|
||||
var endpoints []string
|
||||
err = json.Unmarshal(response.Body.Bytes(), &endpoints)
|
||||
c.Assert(err, IsNil)
|
||||
sort.Strings(endpoints)
|
||||
c.Check(endpoints, DeepEquals, []string{"test-s3"})
|
||||
}
|
||||
|
||||
func (s *APISuite) TestGetGCSEndpoints(c *C) {
|
||||
response, err := s.HTTPRequest("GET", "/api/gcs", nil)
|
||||
c.Assert(err, IsNil)
|
||||
c.Check(response.Code, Equals, 200)
|
||||
|
||||
var endpoints []string
|
||||
err = json.Unmarshal(response.Body.Bytes(), &endpoints)
|
||||
c.Assert(err, IsNil)
|
||||
sort.Strings(endpoints)
|
||||
c.Check(endpoints, DeepEquals, []string{"test-gcs"})
|
||||
}
|
||||
|
||||
@@ -185,6 +185,69 @@ func apiFilesUpload(c *gin.Context) {
|
||||
c.JSON(200, stored)
|
||||
}
|
||||
|
||||
// @Summary Upload One File
|
||||
// @Description **Upload one file to a directory**
|
||||
// @Description
|
||||
// @Description - file is uploaded
|
||||
// @Description - existing uploaded are overwritten
|
||||
// @Description
|
||||
// @Description **Example:**
|
||||
// @Description ```
|
||||
// @Description $ dput aptly aptly_0.9~dev+217+ge5d646c_i386.changes
|
||||
// @Description ```
|
||||
// @Tags Files
|
||||
// @Param dir path string true "Directory to upload files to. Created if does not exist"
|
||||
// @Param file path string true "File to upload"
|
||||
// @Produce json
|
||||
// @Success 200 {array} string "Name of uploaded file"
|
||||
// @Failure 400 {object} Error "Bad Request"
|
||||
// @Failure 404 {object} Error "Not Found"
|
||||
// @Failure 500 {object} Error "Internal Server Error"
|
||||
// @Router /api/files/{dir}/{file} [put]
|
||||
func apiFilesUploadOne(c *gin.Context) {
|
||||
if !verifyDir(c) {
|
||||
return
|
||||
}
|
||||
|
||||
fileName := c.Params.ByName("file")
|
||||
if !verifyPath(fileName) {
|
||||
AbortWithJSONError(c, 400, fmt.Errorf("wrong file"))
|
||||
return
|
||||
}
|
||||
|
||||
path := filepath.Join(context.UploadPath(), utils.SanitizePath(c.Params.ByName("dir")))
|
||||
err := os.MkdirAll(path, 0777)
|
||||
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, 500, err)
|
||||
return
|
||||
}
|
||||
stored := []string{}
|
||||
|
||||
destPath := filepath.Join(path, fileName)
|
||||
dst, err := os.Create(destPath)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, 500, err)
|
||||
return
|
||||
}
|
||||
defer func() { _ = dst.Close() }()
|
||||
|
||||
if _, err = io.Copy(dst, c.Request.Body); err != nil {
|
||||
AbortWithJSONError(c, 500, err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = syncFile(dst); err != nil {
|
||||
AbortWithJSONError(c, 500, fmt.Errorf("error syncing file %s: %s", fileName, err))
|
||||
return
|
||||
}
|
||||
|
||||
stored = append(stored, filepath.Join(c.Params.ByName("dir"), fileName))
|
||||
|
||||
apiFilesUploadedCounter.WithLabelValues(c.Params.ByName("dir")).Inc()
|
||||
c.JSON(200, stored)
|
||||
}
|
||||
|
||||
// @Summary List Files
|
||||
// @Description **Show uploaded files in upload directory**
|
||||
// @Description
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Summary GCS buckets
|
||||
// @Description **Get list of GCS buckets**
|
||||
// @Description
|
||||
// @Description List configured GCS buckets.
|
||||
// @Tags Status
|
||||
// @Produce json
|
||||
// @Success 200 {array} string "List of GCS buckets"
|
||||
// @Router /api/gcs [get]
|
||||
func apiGCSList(c *gin.Context) {
|
||||
keys := []string{}
|
||||
for k := range context.Config().GCSPublishRoots {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
c.JSON(200, keys)
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Summary JFrog repositories
|
||||
// @Description **Get list of JFrog repositories**
|
||||
// @Description
|
||||
// @Description List configured JFrog publish endpoints.
|
||||
// @Tags Status
|
||||
// @Produce json
|
||||
// @Success 200 {array} string "List of JFrog publish endpoints"
|
||||
// @Router /api/jfrog [get]
|
||||
func apiJFrogList(c *gin.Context) {
|
||||
keys := []string{}
|
||||
for k := range context.Config().JFrogPublishRoots {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
c.JSON(200, keys)
|
||||
}
|
||||
+47
-15
@@ -216,9 +216,9 @@ func apiMirrorsDrop(c *gin.Context) {
|
||||
name := c.Params.ByName("name")
|
||||
force := c.Request.URL.Query().Get("force") == "1"
|
||||
|
||||
// Phase 1: Pre-task validation (shallow load for 404 check only)
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
mirrorCollection := collectionFactory.RemoteRepoCollection()
|
||||
snapshotCollection := collectionFactory.SnapshotCollection()
|
||||
|
||||
repo, err := mirrorCollection.ByName(name)
|
||||
if err != nil {
|
||||
@@ -228,21 +228,34 @@ func apiMirrorsDrop(c *gin.Context) {
|
||||
|
||||
resources := []string{string(repo.Key())}
|
||||
taskName := fmt.Sprintf("Delete mirror %s", name)
|
||||
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err := repo.CheckLock()
|
||||
// Phase 2: Inside task lock - create fresh collections
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskMirrorCollection := taskCollectionFactory.RemoteRepoCollection()
|
||||
taskSnapshotCollection := taskCollectionFactory.SnapshotCollection()
|
||||
|
||||
// Fresh load after lock acquired
|
||||
repo, err := taskMirrorCollection.ByName(name)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to drop: %v", err)
|
||||
}
|
||||
|
||||
err = repo.CheckLock()
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to drop: %v", err)
|
||||
}
|
||||
|
||||
if !force {
|
||||
snapshots := snapshotCollection.ByRemoteRepoSource(repo)
|
||||
// Fresh checks with current collections
|
||||
snapshots := taskSnapshotCollection.ByRemoteRepoSource(repo)
|
||||
|
||||
if len(snapshots) > 0 {
|
||||
return &task.ProcessReturnValue{Code: http.StatusForbidden, Value: nil}, fmt.Errorf("won't delete mirror with snapshots, use 'force=1' to override")
|
||||
}
|
||||
}
|
||||
|
||||
err = mirrorCollection.Drop(repo)
|
||||
err = taskMirrorCollection.Drop(repo)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to drop: %v", err)
|
||||
}
|
||||
@@ -535,7 +548,8 @@ func apiMirrorsUpdate(c *gin.Context) {
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.RemoteRepoCollection()
|
||||
|
||||
remote, err = collection.ByName(c.Params.ByName("name"))
|
||||
name := c.Params.ByName("name")
|
||||
remote, err = collection.ByName(name)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, 404, err)
|
||||
return
|
||||
@@ -550,6 +564,7 @@ func apiMirrorsUpdate(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Pre-task validation of new name if provided
|
||||
if b.Name != remote.Name {
|
||||
_, err = collection.ByName(b.Name)
|
||||
if err == nil {
|
||||
@@ -566,9 +581,26 @@ func apiMirrorsUpdate(c *gin.Context) {
|
||||
|
||||
resources := []string{string(remote.Key())}
|
||||
maybeRunTaskInBackground(c, "Update mirror "+b.Name, resources, func(out aptly.Progress, detail *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
// Phase 2: Inside task lock - create fresh factory
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.RemoteRepoCollection()
|
||||
|
||||
// Fresh load after lock acquired (use captured `name` variable, not gin context)
|
||||
remote, err := taskCollection.ByName(name)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
// Fresh rename check inside lock (if renaming)
|
||||
if b.Name != remote.Name {
|
||||
_, err := taskCollection.ByName(b.Name)
|
||||
if err == nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusConflict, Value: nil}, fmt.Errorf("unable to rename: mirror %s already exists", b.Name)
|
||||
}
|
||||
}
|
||||
|
||||
downloader := context.NewDownloader(out)
|
||||
err := remote.Fetch(downloader, verifier, b.IgnoreSignatures)
|
||||
err = remote.Fetch(downloader, verifier, b.IgnoreSignatures)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
@@ -580,14 +612,14 @@ func apiMirrorsUpdate(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
err = remote.DownloadPackageIndexes(out, downloader, verifier, collectionFactory, b.IgnoreSignatures, remote.SkipComponentCheck)
|
||||
err = remote.DownloadPackageIndexes(out, downloader, verifier, taskCollectionFactory, b.IgnoreSignatures, remote.SkipComponentCheck)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
if remote.DownloadAppStream && !remote.IsFlat() {
|
||||
err = remote.DownloadAppStreamFiles(out, downloader,
|
||||
context.PackagePool(), collectionFactory.ChecksumCollection(nil), b.IgnoreChecksums)
|
||||
context.PackagePool(), taskCollectionFactory.ChecksumCollection(nil), b.IgnoreChecksums)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
@@ -607,8 +639,8 @@ func apiMirrorsUpdate(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
queue, downloadSize, err := remote.BuildDownloadQueue(context.PackagePool(), collectionFactory.PackageCollection(),
|
||||
collectionFactory.ChecksumCollection(nil), b.SkipExistingPackages, b.LatestOnly)
|
||||
queue, downloadSize, err := remote.BuildDownloadQueue(context.PackagePool(), taskCollectionFactory.PackageCollection(),
|
||||
taskCollectionFactory.ChecksumCollection(nil), b.SkipExistingPackages, b.LatestOnly)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
@@ -618,12 +650,12 @@ func apiMirrorsUpdate(c *gin.Context) {
|
||||
e := context.ReOpenDatabase()
|
||||
if e == nil {
|
||||
remote.MarkAsIdle()
|
||||
_ = collection.Update(remote)
|
||||
_ = taskCollection.Update(remote)
|
||||
}
|
||||
}()
|
||||
|
||||
remote.MarkAsUpdating()
|
||||
err = collection.Update(remote)
|
||||
err = taskCollection.Update(remote)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
@@ -727,7 +759,7 @@ func apiMirrorsUpdate(c *gin.Context) {
|
||||
}
|
||||
|
||||
// and import it back to the pool
|
||||
task.File.PoolPath, err = context.PackagePool().Import(task.TempDownPath, task.File.Filename, &task.File.Checksums, true, collectionFactory.ChecksumCollection(nil))
|
||||
task.File.PoolPath, err = context.PackagePool().Import(task.TempDownPath, task.File.Filename, &task.File.Checksums, true, taskCollectionFactory.ChecksumCollection(nil))
|
||||
if err != nil {
|
||||
//return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to import file: %s", err)
|
||||
pushError(err)
|
||||
@@ -780,8 +812,8 @@ func apiMirrorsUpdate(c *gin.Context) {
|
||||
}
|
||||
|
||||
log.Info().Msgf("%s: Finalizing download...", b.Name)
|
||||
_ = remote.FinalizeDownload(collectionFactory, out)
|
||||
err = collectionFactory.RemoteRepoCollection().Update(remote)
|
||||
_ = remote.FinalizeDownload(taskCollectionFactory, out)
|
||||
err = taskCollection.Update(remote)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
+344
-199
@@ -267,7 +267,7 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resources = append(resources, string(snapshot.ResourceKey()))
|
||||
resources = append(resources, string(snapshot.Key()))
|
||||
sources = append(sources, snapshot)
|
||||
}
|
||||
} else if b.SourceKind == deb.SourceLocalRepo {
|
||||
@@ -298,11 +298,24 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
||||
multiDist = *b.MultiDist
|
||||
}
|
||||
|
||||
collection := collectionFactory.PublishedRepoCollection()
|
||||
// Non-MultiDist publishes share a single pool/ directory under the
|
||||
// prefix. Lock at the prefix level so that concurrent publish/drop
|
||||
// operations on sibling distributions cannot race during cleanup.
|
||||
if !multiDist {
|
||||
storagePrefix := prefix
|
||||
if storage != "" {
|
||||
storagePrefix = storage + ":" + prefix
|
||||
}
|
||||
|
||||
resources = append(resources, deb.PrefixPoolLockKey(storagePrefix))
|
||||
}
|
||||
|
||||
taskName := fmt.Sprintf("Publish %s repository %s/%s with components \"%s\" and sources \"%s\"",
|
||||
b.SourceKind, param, b.Distribution, strings.Join(components, `", "`), strings.Join(names, `", "`))
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(out aptly.Progress, detail *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.PublishedRepoCollection()
|
||||
|
||||
taskDetail := task.PublishDetail{
|
||||
Detail: detail,
|
||||
}
|
||||
@@ -314,10 +327,10 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
||||
for _, source := range sources {
|
||||
switch s := source.(type) {
|
||||
case *deb.Snapshot:
|
||||
snapshotCollection := collectionFactory.SnapshotCollection()
|
||||
snapshotCollection := taskCollectionFactory.SnapshotCollection()
|
||||
err = snapshotCollection.LoadComplete(s)
|
||||
case *deb.LocalRepo:
|
||||
localCollection := collectionFactory.LocalRepoCollection()
|
||||
localCollection := taskCollectionFactory.LocalRepoCollection()
|
||||
err = localCollection.LoadComplete(s)
|
||||
default:
|
||||
err = fmt.Errorf("unexpected type for source: %T", source)
|
||||
@@ -327,13 +340,11 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
published, err := deb.NewPublishedRepo(storage, prefix, b.Distribution, b.Architectures, components, sources, collectionFactory, multiDist)
|
||||
published, err := deb.NewPublishedRepo(storage, prefix, b.Distribution, b.Architectures, components, sources, taskCollectionFactory, multiDist)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to publish: %s", err)
|
||||
}
|
||||
|
||||
resources = append(resources, string(published.Key()))
|
||||
|
||||
if b.Origin != "" {
|
||||
published.Origin = b.Origin
|
||||
}
|
||||
@@ -367,18 +378,18 @@ func apiPublishRepoOrSnapshot(c *gin.Context) {
|
||||
published.Version = b.Version
|
||||
}
|
||||
|
||||
duplicate := collection.CheckDuplicate(published)
|
||||
duplicate := taskCollection.CheckDuplicate(published)
|
||||
if duplicate != nil {
|
||||
_ = collectionFactory.PublishedRepoCollection().LoadComplete(duplicate, collectionFactory)
|
||||
_ = taskCollectionFactory.PublishedRepoCollection().LoadComplete(duplicate, taskCollectionFactory)
|
||||
return &task.ProcessReturnValue{Code: http.StatusBadRequest, Value: nil}, fmt.Errorf("prefix/distribution already used by another published repo: %s", duplicate)
|
||||
}
|
||||
|
||||
err = published.Publish(context.PackagePool(), context, collectionFactory, signer, publishOutput, b.ForceOverwrite, context.SkelPath())
|
||||
err = published.Publish(context.PackagePool(), context, taskCollectionFactory, signer, publishOutput, b.ForceOverwrite, context.SkelPath())
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to publish: %s", err)
|
||||
}
|
||||
|
||||
err = collection.Add(published)
|
||||
err = taskCollection.Add(published)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save to DB: %s", err)
|
||||
}
|
||||
@@ -458,6 +469,7 @@ func apiPublishUpdateSwitch(c *gin.Context) {
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.PublishedRepoCollection()
|
||||
snapshotCollection := collectionFactory.SnapshotCollection()
|
||||
localRepoCollection := collectionFactory.LocalRepoCollection()
|
||||
|
||||
published, err := collection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
@@ -465,64 +477,88 @@ func apiPublishUpdateSwitch(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resources := []string{string(published.Key())}
|
||||
|
||||
if published.SourceKind == deb.SourceLocalRepo {
|
||||
if len(b.Snapshots) > 0 {
|
||||
AbortWithJSONError(c, http.StatusBadRequest, fmt.Errorf("snapshots shouldn't be given when updating local repo"))
|
||||
return
|
||||
}
|
||||
} else if published.SourceKind == deb.SourceSnapshot {
|
||||
for _, snapshotInfo := range b.Snapshots {
|
||||
_, err2 := snapshotCollection.ByName(snapshotInfo.Name)
|
||||
for _, uuid := range published.Sources {
|
||||
repo, err2 := localRepoCollection.ByUUID(uuid)
|
||||
if err2 != nil {
|
||||
AbortWithJSONError(c, http.StatusNotFound, err2)
|
||||
return
|
||||
}
|
||||
resources = append(resources, string(repo.Key()))
|
||||
}
|
||||
} else if published.SourceKind == deb.SourceSnapshot {
|
||||
for _, snapshotInfo := range b.Snapshots {
|
||||
snapshot, err2 := snapshotCollection.ByName(snapshotInfo.Name)
|
||||
if err2 != nil {
|
||||
AbortWithJSONError(c, http.StatusNotFound, err2)
|
||||
return
|
||||
}
|
||||
resources = append(resources, string(snapshot.Key()))
|
||||
}
|
||||
} else {
|
||||
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unknown published repository type"))
|
||||
return
|
||||
}
|
||||
|
||||
if b.SkipContents != nil {
|
||||
published.SkipContents = *b.SkipContents
|
||||
// Non-MultiDist distributions share a single pool/ directory under the
|
||||
// prefix. Acquire the prefix-level pool lock so that concurrent updates
|
||||
// on sibling distributions are serialised and cannot race during cleanup.
|
||||
if !published.MultiDist {
|
||||
resources = append(resources, deb.PrefixPoolLockKey(published.StoragePrefix()))
|
||||
}
|
||||
|
||||
if b.SkipBz2 != nil {
|
||||
published.SkipBz2 = *b.SkipBz2
|
||||
}
|
||||
|
||||
if b.AcquireByHash != nil {
|
||||
published.AcquireByHash = *b.AcquireByHash
|
||||
}
|
||||
|
||||
if b.SignedBy != nil {
|
||||
published.SignedBy = *b.SignedBy
|
||||
}
|
||||
|
||||
if b.MultiDist != nil {
|
||||
published.MultiDist = *b.MultiDist
|
||||
}
|
||||
|
||||
if b.Label != nil {
|
||||
published.Label = *b.Label
|
||||
}
|
||||
|
||||
if b.Origin != nil {
|
||||
published.Origin = *b.Origin
|
||||
}
|
||||
|
||||
if b.Version != nil {
|
||||
published.Version = *b.Version
|
||||
}
|
||||
|
||||
resources := []string{string(published.Key())}
|
||||
// Field mutations and fresh DB load are deferred to inside the task so
|
||||
// they always operate on a consistent state after the lock is held.
|
||||
taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(out aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err = collection.LoadComplete(published, collectionFactory)
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.PublishedRepoCollection()
|
||||
|
||||
published, err := taskCollection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
err = taskCollection.LoadComplete(published, taskCollectionFactory)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
// Capture MultiDist before mutations to detect a false→true transition.
|
||||
prevMultiDist := published.MultiDist
|
||||
|
||||
// Apply field mutations on the freshly loaded object.
|
||||
if b.SkipContents != nil {
|
||||
published.SkipContents = *b.SkipContents
|
||||
}
|
||||
if b.SkipBz2 != nil {
|
||||
published.SkipBz2 = *b.SkipBz2
|
||||
}
|
||||
if b.AcquireByHash != nil {
|
||||
published.AcquireByHash = *b.AcquireByHash
|
||||
}
|
||||
if b.SignedBy != nil {
|
||||
published.SignedBy = *b.SignedBy
|
||||
}
|
||||
if b.MultiDist != nil {
|
||||
published.MultiDist = *b.MultiDist
|
||||
}
|
||||
if b.Label != nil {
|
||||
published.Label = *b.Label
|
||||
}
|
||||
if b.Origin != nil {
|
||||
published.Origin = *b.Origin
|
||||
}
|
||||
if b.Version != nil {
|
||||
published.Version = *b.Version
|
||||
}
|
||||
|
||||
revision := published.ObtainRevision()
|
||||
sources := revision.Sources
|
||||
|
||||
@@ -534,17 +570,17 @@ func apiPublishUpdateSwitch(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
result, err := published.Update(collectionFactory, out)
|
||||
result, err := published.Update(taskCollectionFactory, out)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
err = published.Publish(context.PackagePool(), context, collectionFactory, signer, out, b.ForceOverwrite, context.SkelPath())
|
||||
err = published.Publish(context.PackagePool(), context, taskCollectionFactory, signer, out, b.ForceOverwrite, context.SkelPath())
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
err = collection.Update(published)
|
||||
err = taskCollection.Update(published)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save to DB: %s", err)
|
||||
}
|
||||
@@ -552,10 +588,19 @@ func apiPublishUpdateSwitch(c *gin.Context) {
|
||||
if b.SkipCleanup == nil || !*b.SkipCleanup {
|
||||
cleanComponents := make([]string, 0, len(result.UpdatedSources)+len(result.RemovedSources))
|
||||
cleanComponents = append(append(cleanComponents, result.UpdatedComponents()...), result.RemovedComponents()...)
|
||||
err = collection.CleanupPrefixComponentFiles(context, published, cleanComponents, collectionFactory, out)
|
||||
err = taskCollection.CleanupPrefixComponentFiles(context, published, cleanComponents, taskCollectionFactory, out)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
// When MultiDist is toggled, the old pool layout still has files that
|
||||
// CleanupPrefixComponentFiles won't touch (it only scans the new layout).
|
||||
// Run a second pass over the previous layout to remove stale files.
|
||||
if prevMultiDist != published.MultiDist {
|
||||
err = taskCollection.CleanupAfterMultiDistToggle(context, published, prevMultiDist, cleanComponents, taskCollectionFactory, out)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to clean legacy pool: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &task.ProcessReturnValue{Code: http.StatusOK, Value: published}, nil
|
||||
@@ -600,10 +645,19 @@ func apiPublishDrop(c *gin.Context) {
|
||||
}
|
||||
|
||||
resources := []string{string(published.Key())}
|
||||
// Non-MultiDist distributions share a single pool/ directory under the
|
||||
// prefix. Acquire the prefix-level pool lock so that a drop cannot race
|
||||
// with a concurrent update or drop of a sibling distribution during cleanup.
|
||||
if !published.MultiDist {
|
||||
resources = append(resources, deb.PrefixPoolLockKey(published.StoragePrefix()))
|
||||
}
|
||||
taskName := fmt.Sprintf("Delete published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(out aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err := collection.Remove(context, storage, prefix, distribution,
|
||||
collectionFactory, out, force, skipCleanup)
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.PublishedRepoCollection()
|
||||
|
||||
err := taskCollection.Remove(context, storage, prefix, distribution,
|
||||
taskCollectionFactory, out, force, skipCleanup)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to drop: %s", err)
|
||||
}
|
||||
@@ -639,43 +693,52 @@ func apiPublishAddSource(c *gin.Context) {
|
||||
storage, prefix := deb.ParsePrefix(param)
|
||||
distribution := slashEscape(c.Params.ByName("distribution"))
|
||||
|
||||
if c.Bind(&b) != nil {
|
||||
return
|
||||
}
|
||||
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.PublishedRepoCollection()
|
||||
|
||||
// Load shallowly (no LoadComplete) to verify existence and obtain the
|
||||
// resource key and task name. The actual mutation is performed inside
|
||||
// the task on a freshly loaded copy to prevent lost-update races.
|
||||
published, err := collection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to create: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
err = collection.LoadComplete(published, collectionFactory)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unable to create: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
if c.Bind(&b) != nil {
|
||||
return
|
||||
}
|
||||
|
||||
revision := published.ObtainRevision()
|
||||
sources := revision.Sources
|
||||
|
||||
component := b.Component
|
||||
name := b.Name
|
||||
|
||||
_, exists := sources[component]
|
||||
if exists {
|
||||
AbortWithJSONError(c, http.StatusBadRequest, fmt.Errorf("unable to create: Component '%s' already exists", component))
|
||||
return
|
||||
}
|
||||
|
||||
sources[component] = name
|
||||
|
||||
resources := []string{string(published.Key())}
|
||||
taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err = collection.Update(published)
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.PublishedRepoCollection()
|
||||
|
||||
published, err := taskCollection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusNotFound, Value: nil}, fmt.Errorf("unable to create: %s", err)
|
||||
}
|
||||
|
||||
err = taskCollection.LoadComplete(published, taskCollectionFactory)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to create: %s", err)
|
||||
}
|
||||
|
||||
revision := published.ObtainRevision()
|
||||
sources := revision.Sources
|
||||
|
||||
component := b.Component
|
||||
name := b.Name
|
||||
|
||||
_, exists := sources[component]
|
||||
if exists {
|
||||
return &task.ProcessReturnValue{Code: http.StatusBadRequest, Value: nil}, fmt.Errorf("unable to create: Component '%s' already exists", component)
|
||||
}
|
||||
|
||||
sources[component] = name
|
||||
|
||||
err = taskCollection.Update(published)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save to DB: %s", err)
|
||||
}
|
||||
@@ -757,39 +820,48 @@ func apiPublishSetSources(c *gin.Context) {
|
||||
storage, prefix := deb.ParsePrefix(param)
|
||||
distribution := slashEscape(c.Params.ByName("distribution"))
|
||||
|
||||
if c.Bind(&b) != nil {
|
||||
return
|
||||
}
|
||||
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.PublishedRepoCollection()
|
||||
|
||||
// Load shallowly for 404 check, resource key, and task name.
|
||||
// Full load and mutation happen inside the task.
|
||||
published, err := collection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to update: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
err = collection.LoadComplete(published, collectionFactory)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unable to update: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
if c.Bind(&b) != nil {
|
||||
return
|
||||
}
|
||||
|
||||
revision := published.ObtainRevision()
|
||||
sources := make(map[string]string, len(b))
|
||||
revision.Sources = sources
|
||||
|
||||
for _, source := range b {
|
||||
component := source.Component
|
||||
name := source.Name
|
||||
sources[component] = name
|
||||
}
|
||||
|
||||
resources := []string{string(published.Key())}
|
||||
taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err = collection.Update(published)
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.PublishedRepoCollection()
|
||||
|
||||
published, err := taskCollection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusNotFound, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
err = taskCollection.LoadComplete(published, taskCollectionFactory)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
revision := published.ObtainRevision()
|
||||
sources := make(map[string]string, len(b))
|
||||
revision.Sources = sources
|
||||
|
||||
for _, source := range b {
|
||||
component := source.Component
|
||||
name := source.Name
|
||||
sources[component] = name
|
||||
}
|
||||
|
||||
err = taskCollection.Update(published)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save to DB: %s", err)
|
||||
}
|
||||
@@ -822,24 +894,33 @@ func apiPublishDropChanges(c *gin.Context) {
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.PublishedRepoCollection()
|
||||
|
||||
// Load shallowly for 404 check, resource key, and task name.
|
||||
// Full load and DropRevision happen inside the task.
|
||||
published, err := collection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to delete: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
err = collection.LoadComplete(published, collectionFactory)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unable to delete: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
published.DropRevision()
|
||||
|
||||
resources := []string{string(published.Key())}
|
||||
taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err = collection.Update(published)
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.PublishedRepoCollection()
|
||||
|
||||
published, err := taskCollection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusNotFound, Value: nil}, fmt.Errorf("unable to delete: %s", err)
|
||||
}
|
||||
|
||||
err = taskCollection.LoadComplete(published, taskCollectionFactory)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to delete: %s", err)
|
||||
}
|
||||
|
||||
published.DropRevision()
|
||||
|
||||
err = taskCollection.Update(published)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save to DB: %s", err)
|
||||
}
|
||||
@@ -875,51 +956,58 @@ func apiPublishUpdateSource(c *gin.Context) {
|
||||
param := slashEscape(c.Params.ByName("prefix"))
|
||||
storage, prefix := deb.ParsePrefix(param)
|
||||
distribution := slashEscape(c.Params.ByName("distribution"))
|
||||
component := slashEscape(c.Params.ByName("component"))
|
||||
urlComponent := slashEscape(c.Params.ByName("component"))
|
||||
|
||||
// Default component to the URL path segment; the body may rename it.
|
||||
b.Component = urlComponent
|
||||
if c.Bind(&b) != nil {
|
||||
return
|
||||
}
|
||||
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.PublishedRepoCollection()
|
||||
|
||||
// Load shallowly for 404 check, resource key, and task name.
|
||||
// Full load and mutation happen inside the task.
|
||||
published, err := collection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to update: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
err = collection.LoadComplete(published, collectionFactory)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unable to update: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
revision := published.ObtainRevision()
|
||||
sources := revision.Sources
|
||||
|
||||
_, exists := sources[component]
|
||||
if !exists {
|
||||
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to update: Component '%s' does not exist", component))
|
||||
return
|
||||
}
|
||||
|
||||
b.Component = component
|
||||
b.Name = revision.Sources[component]
|
||||
|
||||
if c.Bind(&b) != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if b.Component != component {
|
||||
delete(sources, component)
|
||||
}
|
||||
|
||||
component = b.Component
|
||||
name := b.Name
|
||||
sources[component] = name
|
||||
|
||||
resources := []string{string(published.Key())}
|
||||
taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err = collection.Update(published)
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.PublishedRepoCollection()
|
||||
|
||||
published, err := taskCollection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusNotFound, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
err = taskCollection.LoadComplete(published, taskCollectionFactory)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
revision := published.ObtainRevision()
|
||||
sources := revision.Sources
|
||||
|
||||
_, exists := sources[urlComponent]
|
||||
if !exists {
|
||||
return &task.ProcessReturnValue{Code: http.StatusNotFound, Value: nil}, fmt.Errorf("unable to update: Component '%s' does not exist", urlComponent)
|
||||
}
|
||||
|
||||
if b.Component != urlComponent {
|
||||
delete(sources, urlComponent)
|
||||
}
|
||||
|
||||
newComponent := b.Component
|
||||
name := b.Name
|
||||
sources[newComponent] = name
|
||||
|
||||
err = taskCollection.Update(published)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save to DB: %s", err)
|
||||
}
|
||||
@@ -956,33 +1044,41 @@ func apiPublishRemoveSource(c *gin.Context) {
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.PublishedRepoCollection()
|
||||
|
||||
// Load shallowly for 404 check, resource key, and task name.
|
||||
// Full load and mutation happen inside the task.
|
||||
published, err := collection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to delete: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
err = collection.LoadComplete(published, collectionFactory)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unable to delete: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
revision := published.ObtainRevision()
|
||||
sources := revision.Sources
|
||||
|
||||
_, exists := sources[component]
|
||||
if !exists {
|
||||
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to delete: Component '%s' does not exist", component))
|
||||
return
|
||||
}
|
||||
|
||||
delete(sources, component)
|
||||
|
||||
resources := []string{string(published.Key())}
|
||||
taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err = collection.Update(published)
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.PublishedRepoCollection()
|
||||
|
||||
published, err := taskCollection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusNotFound, Value: nil}, fmt.Errorf("unable to delete: %s", err)
|
||||
}
|
||||
|
||||
err = taskCollection.LoadComplete(published, taskCollectionFactory)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to delete: %s", err)
|
||||
}
|
||||
|
||||
revision := published.ObtainRevision()
|
||||
sources := revision.Sources
|
||||
|
||||
_, exists := sources[component]
|
||||
if !exists {
|
||||
return &task.ProcessReturnValue{Code: http.StatusNotFound, Value: nil}, fmt.Errorf("unable to delete: Component '%s' does not exist", component)
|
||||
}
|
||||
|
||||
delete(sources, component)
|
||||
|
||||
err = taskCollection.Update(published)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save to DB: %s", err)
|
||||
}
|
||||
@@ -1054,64 +1150,104 @@ func apiPublishUpdate(c *gin.Context) {
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.PublishedRepoCollection()
|
||||
|
||||
// Load shallowly for 404 check, resource key, and task name.
|
||||
// Full load and field mutations happen inside the task.
|
||||
published, err := collection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("unable to update: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
err = collection.LoadComplete(published, collectionFactory)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unable to update: %s", err))
|
||||
return
|
||||
}
|
||||
|
||||
if b.SkipContents != nil {
|
||||
published.SkipContents = *b.SkipContents
|
||||
}
|
||||
|
||||
if b.SkipBz2 != nil {
|
||||
published.SkipBz2 = *b.SkipBz2
|
||||
}
|
||||
|
||||
if b.AcquireByHash != nil {
|
||||
published.AcquireByHash = *b.AcquireByHash
|
||||
}
|
||||
|
||||
if b.SignedBy != nil {
|
||||
published.SignedBy = *b.SignedBy
|
||||
}
|
||||
|
||||
if b.MultiDist != nil {
|
||||
published.MultiDist = *b.MultiDist
|
||||
}
|
||||
|
||||
if b.Label != nil {
|
||||
published.Label = *b.Label
|
||||
}
|
||||
|
||||
if b.Origin != nil {
|
||||
published.Origin = *b.Origin
|
||||
}
|
||||
|
||||
if b.Version != nil {
|
||||
published.Version = *b.Version
|
||||
}
|
||||
|
||||
resources := []string{string(published.Key())}
|
||||
|
||||
// Non-MultiDist distributions share a single pool/ directory under the
|
||||
// prefix. Acquire the prefix-level pool lock so that concurrent updates
|
||||
// on sibling distributions are serialised and cannot race during cleanup.
|
||||
if !published.MultiDist {
|
||||
resources = append(resources, deb.PrefixPoolLockKey(published.StoragePrefix()))
|
||||
}
|
||||
|
||||
// Lock source repos / snapshots the same way apiPublishUpdateSwitch does,
|
||||
// because published.Update() reads from them and concurrent modification
|
||||
// would produce an inconsistent view.
|
||||
snapshotCollection := collectionFactory.SnapshotCollection()
|
||||
localRepoCollection := collectionFactory.LocalRepoCollection()
|
||||
|
||||
if published.SourceKind == deb.SourceLocalRepo {
|
||||
for _, uuid := range published.Sources {
|
||||
repo, err2 := localRepoCollection.ByUUID(uuid)
|
||||
if err2 != nil {
|
||||
AbortWithJSONError(c, http.StatusNotFound, err2)
|
||||
return
|
||||
}
|
||||
resources = append(resources, string(repo.Key()))
|
||||
}
|
||||
} else if published.SourceKind == deb.SourceSnapshot {
|
||||
for _, uuid := range published.Sources {
|
||||
snapshot, err2 := snapshotCollection.ByUUID(uuid)
|
||||
if err2 != nil {
|
||||
AbortWithJSONError(c, http.StatusNotFound, err2)
|
||||
return
|
||||
}
|
||||
resources = append(resources, string(snapshot.Key()))
|
||||
}
|
||||
}
|
||||
|
||||
taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(out aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
result, err := published.Update(collectionFactory, out)
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.PublishedRepoCollection()
|
||||
|
||||
published, err := taskCollection.ByStoragePrefixDistribution(storage, prefix, distribution)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
err = published.Publish(context.PackagePool(), context, collectionFactory, signer, out, b.ForceOverwrite, context.SkelPath())
|
||||
err = taskCollection.LoadComplete(published, taskCollectionFactory)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
err = collection.Update(published)
|
||||
// Capture MultiDist before mutations to detect a false→true transition.
|
||||
prevMultiDist := published.MultiDist
|
||||
|
||||
// Apply field mutations on the freshly loaded object.
|
||||
if b.SkipContents != nil {
|
||||
published.SkipContents = *b.SkipContents
|
||||
}
|
||||
if b.SkipBz2 != nil {
|
||||
published.SkipBz2 = *b.SkipBz2
|
||||
}
|
||||
if b.AcquireByHash != nil {
|
||||
published.AcquireByHash = *b.AcquireByHash
|
||||
}
|
||||
if b.SignedBy != nil {
|
||||
published.SignedBy = *b.SignedBy
|
||||
}
|
||||
if b.MultiDist != nil {
|
||||
published.MultiDist = *b.MultiDist
|
||||
}
|
||||
if b.Label != nil {
|
||||
published.Label = *b.Label
|
||||
}
|
||||
if b.Origin != nil {
|
||||
published.Origin = *b.Origin
|
||||
}
|
||||
if b.Version != nil {
|
||||
published.Version = *b.Version
|
||||
}
|
||||
|
||||
result, err := published.Update(taskCollectionFactory, out)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
err = published.Publish(context.PackagePool(), context, taskCollectionFactory, signer, out, b.ForceOverwrite, context.SkelPath())
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
|
||||
err = taskCollection.Update(published)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save to DB: %s", err)
|
||||
}
|
||||
@@ -1119,10 +1255,19 @@ func apiPublishUpdate(c *gin.Context) {
|
||||
if b.SkipCleanup == nil || !*b.SkipCleanup {
|
||||
cleanComponents := make([]string, 0, len(result.UpdatedSources)+len(result.RemovedSources))
|
||||
cleanComponents = append(append(cleanComponents, result.UpdatedComponents()...), result.RemovedComponents()...)
|
||||
err = collection.CleanupPrefixComponentFiles(context, published, cleanComponents, collectionFactory, out)
|
||||
err = taskCollection.CleanupPrefixComponentFiles(context, published, cleanComponents, taskCollectionFactory, out)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to update: %s", err)
|
||||
}
|
||||
// When MultiDist is toggled, the old pool layout still has files that
|
||||
// CleanupPrefixComponentFiles won't touch (it only scans the new layout).
|
||||
// Run a second pass over the previous layout to remove stale files.
|
||||
if prevMultiDist != published.MultiDist {
|
||||
err = taskCollection.CleanupAfterMultiDistToggle(context, published, prevMultiDist, cleanComponents, taskCollectionFactory, out)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to clean legacy pool: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return &task.ProcessReturnValue{Code: http.StatusOK, Value: published}, nil
|
||||
|
||||
@@ -0,0 +1,737 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
ctx "github.com/aptly-dev/aptly/context"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/smira/flag"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
// PublishedFileMissingSuite reproduces the exact bug where:
|
||||
// - Package import succeeds
|
||||
// - Metadata is updated (Packages.gz shows the package)
|
||||
// - Publish reports success
|
||||
// - BUT the .deb file is missing from the published pool directory
|
||||
// - Result: apt-get returns 404 when trying to download the package
|
||||
type PublishedFileMissingSuite struct {
|
||||
context *ctx.AptlyContext
|
||||
flags *flag.FlagSet
|
||||
configFile *os.File
|
||||
router http.Handler
|
||||
tempDir string
|
||||
poolPath string
|
||||
publicPath string
|
||||
}
|
||||
|
||||
var _ = Suite(&PublishedFileMissingSuite{})
|
||||
|
||||
func (s *PublishedFileMissingSuite) SetUpSuite(c *C) {
|
||||
aptly.Version = "publishedFileMissingTest"
|
||||
|
||||
tempDir, err := os.MkdirTemp("", "aptly-published-missing-test")
|
||||
c.Assert(err, IsNil)
|
||||
s.tempDir = tempDir
|
||||
s.poolPath = filepath.Join(tempDir, "pool")
|
||||
s.publicPath = filepath.Join(tempDir, "public")
|
||||
|
||||
file, err := os.CreateTemp("", "aptly-published-missing-config")
|
||||
c.Assert(err, IsNil)
|
||||
s.configFile = file
|
||||
|
||||
config := gin.H{
|
||||
"rootDir": tempDir,
|
||||
"downloadDir": filepath.Join(tempDir, "download"),
|
||||
"architectures": []string{"amd64"},
|
||||
"dependencyFollowSuggests": false,
|
||||
"dependencyFollowRecommends": false,
|
||||
"gpgDisableSign": true,
|
||||
"gpgDisableVerify": true,
|
||||
"gpgProvider": "internal",
|
||||
"skipLegacyPool": true,
|
||||
"enableMetricsEndpoint": false,
|
||||
}
|
||||
|
||||
jsonString, err := json.Marshal(config)
|
||||
c.Assert(err, IsNil)
|
||||
_, err = file.Write(jsonString)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
flags := flag.NewFlagSet("publishedFileMissingTestFlags", flag.ContinueOnError)
|
||||
flags.Bool("no-lock", true, "disable database locking for test")
|
||||
flags.Int("db-open-attempts", 3, "dummy")
|
||||
flags.String("config", s.configFile.Name(), "config file")
|
||||
flags.String("architectures", "", "dummy")
|
||||
s.flags = flags
|
||||
|
||||
context, err := ctx.NewContext(s.flags)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
s.context = context
|
||||
s.router = Router(context)
|
||||
}
|
||||
|
||||
func (s *PublishedFileMissingSuite) TearDownSuite(c *C) {
|
||||
if s.configFile != nil {
|
||||
_ = os.Remove(s.configFile.Name())
|
||||
}
|
||||
if s.context != nil {
|
||||
s.context.Shutdown()
|
||||
}
|
||||
if s.tempDir != "" {
|
||||
_ = os.RemoveAll(s.tempDir)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *PublishedFileMissingSuite) SetUpTest(c *C) {
|
||||
collectionFactory := s.context.NewCollectionFactory()
|
||||
|
||||
localRepoCollection := collectionFactory.LocalRepoCollection()
|
||||
_ = localRepoCollection.ForEach(func(repo *deb.LocalRepo) error {
|
||||
_ = localRepoCollection.Drop(repo)
|
||||
return nil
|
||||
})
|
||||
|
||||
publishedCollection := collectionFactory.PublishedRepoCollection()
|
||||
_ = publishedCollection.ForEach(func(published *deb.PublishedRepo) error {
|
||||
_ = publishedCollection.Remove(s.context, published.Storage, published.Prefix,
|
||||
published.Distribution, collectionFactory, nil, true, true)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
func (s *PublishedFileMissingSuite) TearDownTest(c *C) {
|
||||
s.SetUpTest(c)
|
||||
}
|
||||
|
||||
func (s *PublishedFileMissingSuite) httpRequest(c *C, method string, url string, body []byte) *httptest.ResponseRecorder {
|
||||
w := httptest.NewRecorder()
|
||||
var req *http.Request
|
||||
var err error
|
||||
|
||||
if body != nil {
|
||||
req, err = http.NewRequest(method, url, bytes.NewReader(body))
|
||||
} else {
|
||||
req, err = http.NewRequest(method, url, nil)
|
||||
}
|
||||
c.Assert(err, IsNil)
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
s.router.ServeHTTP(w, req)
|
||||
return w
|
||||
}
|
||||
|
||||
func (s *PublishedFileMissingSuite) createDebPackage(c *C, uploadID, packageName, version string) {
|
||||
uploadPath := s.context.UploadPath()
|
||||
uploadDir := filepath.Join(uploadPath, uploadID)
|
||||
err := os.MkdirAll(uploadDir, 0755)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
tempDir, err := os.MkdirTemp("", "deb-build")
|
||||
c.Assert(err, IsNil)
|
||||
defer func() { _ = os.RemoveAll(tempDir) }()
|
||||
|
||||
debianDir := filepath.Join(tempDir, "DEBIAN")
|
||||
err = os.MkdirAll(debianDir, 0755)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
controlContent := fmt.Sprintf(`Package: %s
|
||||
Version: %s
|
||||
Section: libs
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Maintainer: Test <test@example.com>
|
||||
Description: Test package
|
||||
Test package for published file missing bug.
|
||||
`, packageName, version)
|
||||
|
||||
err = os.WriteFile(filepath.Join(debianDir, "control"), []byte(controlContent), 0644)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
usrDir := filepath.Join(tempDir, "usr", "lib")
|
||||
err = os.MkdirAll(usrDir, 0755)
|
||||
c.Assert(err, IsNil)
|
||||
err = os.WriteFile(filepath.Join(usrDir, "lib.so"), []byte("library"), 0644)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
debFile := filepath.Join(uploadDir, fmt.Sprintf("%s_%s_amd64.deb", packageName, version))
|
||||
cmd := exec.Command("dpkg-deb", "--build", tempDir, debFile)
|
||||
err = cmd.Run()
|
||||
c.Assert(err, IsNil)
|
||||
}
|
||||
|
||||
// TestPublishedFileGoMissing reproduces the exact production bug
|
||||
func (s *PublishedFileMissingSuite) TestPublishedFileGoMissing(c *C) {
|
||||
c.Log("=== Reproducing: Package in metadata but 404 on download ===")
|
||||
|
||||
// Create and publish a repository
|
||||
repoName := "test-repo"
|
||||
distribution := "bullseye"
|
||||
|
||||
createBody, _ := json.Marshal(gin.H{
|
||||
"Name": repoName,
|
||||
"DefaultDistribution": distribution,
|
||||
"DefaultComponent": "main",
|
||||
})
|
||||
resp := s.httpRequest(c, "POST", "/api/repos", createBody)
|
||||
c.Assert(resp.Code, Equals, 201, Commentf("Failed to create repo: %s", resp.Body.String()))
|
||||
|
||||
publishBody, _ := json.Marshal(gin.H{
|
||||
"SourceKind": "local",
|
||||
"Distribution": distribution,
|
||||
"Architectures": []string{"amd64"},
|
||||
"Sources": []gin.H{
|
||||
{"Component": "main", "Name": repoName},
|
||||
},
|
||||
"Signing": gin.H{"Skip": true},
|
||||
})
|
||||
resp = s.httpRequest(c, "POST", "/api/publish/hrt", publishBody)
|
||||
c.Assert(resp.Code, Equals, 201, Commentf("Failed to publish: %s", resp.Body.String()))
|
||||
|
||||
// Create package
|
||||
packageName := "hrt-libblobbyclient1"
|
||||
version := "20250926.152427+hrtdeb11"
|
||||
uploadID := "test-upload-1"
|
||||
|
||||
s.createDebPackage(c, uploadID, packageName, version)
|
||||
|
||||
// Add package
|
||||
resp = s.httpRequest(c, "POST", fmt.Sprintf("/api/repos/%s/file/%s?noRemove=0", repoName, uploadID), nil)
|
||||
c.Assert(resp.Code, Equals, 200, Commentf("Failed to add package: %s", resp.Body.String()))
|
||||
|
||||
// Update publish
|
||||
updateBody, _ := json.Marshal(gin.H{
|
||||
"Signing": gin.H{"Skip": true},
|
||||
"ForceOverwrite": true,
|
||||
})
|
||||
resp = s.httpRequest(c, "PUT", fmt.Sprintf("/api/publish/hrt/%s", distribution), updateBody)
|
||||
c.Assert(resp.Code, Equals, 200, Commentf("Failed to update publish: %s", resp.Body.String()))
|
||||
|
||||
// Now check if the file is actually accessible in the published location
|
||||
publishedStorage, err := s.context.GetPublishedStorage("")
|
||||
c.Assert(err, IsNil)
|
||||
publicPath := publishedStorage.(aptly.FileSystemPublishedStorage).PublicPath()
|
||||
|
||||
// Expected file path: hrt/pool/main/h/hrt-libblobbyclient1/hrt-libblobbyclient1_20250926.152427+hrtdeb11_amd64.deb
|
||||
expectedPath := filepath.Join(publicPath, "hrt", "pool", "main", "h", packageName,
|
||||
fmt.Sprintf("%s_%s_amd64.deb", packageName, version))
|
||||
|
||||
c.Logf("Checking for published file at: %s", expectedPath)
|
||||
|
||||
fileInfo, err := os.Stat(expectedPath)
|
||||
fileExists := err == nil
|
||||
|
||||
c.Logf("File exists: %v", fileExists)
|
||||
if fileExists {
|
||||
c.Logf("File size: %d bytes", fileInfo.Size())
|
||||
}
|
||||
|
||||
// Check metadata
|
||||
resp = s.httpRequest(c, "GET", fmt.Sprintf("/api/repos/%s/packages", repoName), nil)
|
||||
var packages []string
|
||||
err = json.Unmarshal(resp.Body.Bytes(), &packages)
|
||||
c.Assert(err, IsNil)
|
||||
c.Logf("Packages in metadata: %d", len(packages))
|
||||
|
||||
// THE BUG: Metadata says package exists, but file is missing from published location
|
||||
if len(packages) > 0 && !fileExists {
|
||||
c.Logf("★★★ BUG REPRODUCED! ★★★")
|
||||
c.Logf("Metadata shows %d package(s) but file is missing at: %s", len(packages), expectedPath)
|
||||
c.Logf("This is exactly what causes: 404 Not Found [IP: 10.20.72.62 3142]")
|
||||
|
||||
c.Fatal("BUG CONFIRMED: Package in metadata but missing from published directory!")
|
||||
}
|
||||
|
||||
c.Assert(fileExists, Equals, true, Commentf(
|
||||
"Published file should exist at %s when package is in metadata", expectedPath))
|
||||
}
|
||||
|
||||
// TestConcurrentPublishRace tries to trigger the race with concurrent publishes
|
||||
func (s *PublishedFileMissingSuite) TestConcurrentPublishRace(c *C) {
|
||||
c.Log("=== Testing concurrent publish race condition ===")
|
||||
|
||||
const numIterations = 4
|
||||
|
||||
for iteration := 0; iteration < numIterations; iteration++ {
|
||||
c.Logf("--- Iteration %d/%d ---", iteration+1, numIterations)
|
||||
|
||||
// Create repo
|
||||
repoName := fmt.Sprintf("race-repo-%d", iteration)
|
||||
distribution := fmt.Sprintf("dist-%d", iteration)
|
||||
|
||||
createBody, _ := json.Marshal(gin.H{
|
||||
"Name": repoName,
|
||||
"DefaultDistribution": distribution,
|
||||
"DefaultComponent": "main",
|
||||
})
|
||||
resp := s.httpRequest(c, "POST", "/api/repos", createBody)
|
||||
c.Assert(resp.Code, Equals, 201)
|
||||
|
||||
publishBody, _ := json.Marshal(gin.H{
|
||||
"SourceKind": "local",
|
||||
"Distribution": distribution,
|
||||
"Architectures": []string{"amd64"},
|
||||
"Sources": []gin.H{
|
||||
{"Component": "main", "Name": repoName},
|
||||
},
|
||||
"Signing": gin.H{"Skip": true},
|
||||
})
|
||||
resp = s.httpRequest(c, "POST", "/api/publish/concurrent", publishBody)
|
||||
c.Assert(resp.Code, Equals, 201)
|
||||
|
||||
// Create multiple packages
|
||||
var wg sync.WaitGroup
|
||||
numPackages := 5
|
||||
|
||||
for i := 0; i < numPackages; i++ {
|
||||
wg.Add(1)
|
||||
go func(idx int) {
|
||||
defer wg.Done()
|
||||
|
||||
packageName := fmt.Sprintf("pkg-%d-%d", iteration, idx)
|
||||
version := "1.0.0"
|
||||
uploadID := fmt.Sprintf("upload-%d-%d", iteration, idx)
|
||||
|
||||
s.createDebPackage(c, uploadID, packageName, version)
|
||||
|
||||
// Add package
|
||||
resp := s.httpRequest(c, "POST", fmt.Sprintf("/api/repos/%s/file/%s?noRemove=0", repoName, uploadID), nil)
|
||||
c.Logf("Package %d add: %d", idx, resp.Code)
|
||||
|
||||
// Small delay
|
||||
time.Sleep(time.Duration(5+idx*2) * time.Millisecond)
|
||||
|
||||
// Publish
|
||||
updateBody, _ := json.Marshal(gin.H{
|
||||
"Signing": gin.H{"Skip": true},
|
||||
"ForceOverwrite": true,
|
||||
})
|
||||
resp = s.httpRequest(c, "PUT", fmt.Sprintf("/api/publish/concurrent/%s", distribution), updateBody)
|
||||
c.Logf("Publish %d: %d", idx, resp.Code)
|
||||
}(i)
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
|
||||
// Check all packages
|
||||
resp = s.httpRequest(c, "GET", fmt.Sprintf("/api/repos/%s/packages", repoName), nil)
|
||||
var packages []string
|
||||
err := json.Unmarshal(resp.Body.Bytes(), &packages)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
// Check published files
|
||||
publishedStorage, err := s.context.GetPublishedStorage("")
|
||||
c.Assert(err, IsNil)
|
||||
publicPath := publishedStorage.(aptly.FileSystemPublishedStorage).PublicPath()
|
||||
|
||||
missingFiles := []string{}
|
||||
for i := 0; i < numPackages; i++ {
|
||||
packageName := fmt.Sprintf("pkg-%d-%d", iteration, i)
|
||||
version := "1.0.0"
|
||||
|
||||
// Calculate pool path
|
||||
poolSubdir := string(packageName[0])
|
||||
expectedPath := filepath.Join(publicPath, "concurrent", "pool", "main", poolSubdir, packageName,
|
||||
fmt.Sprintf("%s_%s_amd64.deb", packageName, version))
|
||||
|
||||
if _, err := os.Stat(expectedPath); os.IsNotExist(err) {
|
||||
missingFiles = append(missingFiles, expectedPath)
|
||||
}
|
||||
}
|
||||
|
||||
if len(missingFiles) > 0 {
|
||||
c.Logf("★★★ BUG DETECTED in iteration %d/%d! ★★★", iteration+1, numIterations)
|
||||
c.Logf("Metadata shows %d packages, but %d files are MISSING:", len(packages), len(missingFiles))
|
||||
for i, f := range missingFiles {
|
||||
c.Logf(" [iter %d] File MISSING %d/%d: %s", iteration+1, i+1, len(missingFiles), f)
|
||||
}
|
||||
|
||||
c.Fatalf("BUG REPRODUCED in iteration %d/%d: %d published files missing", iteration+1, numIterations, len(missingFiles))
|
||||
} else {
|
||||
c.Logf("[iter %d/%d] All %d files present - OK", iteration+1, numIterations, numPackages)
|
||||
}
|
||||
}
|
||||
|
||||
c.Logf("All %d iterations passed - bug not reproduced with current timing", numIterations)
|
||||
}
|
||||
|
||||
// TestIdenticalPackageRace tests the specific case of identical SHA256 packages
|
||||
func (s *PublishedFileMissingSuite) TestIdenticalPackageRace(c *C) {
|
||||
c.Log("=== AGGRESSIVE test: identical package (same SHA256) race ===")
|
||||
|
||||
const numIterations = 4
|
||||
packageName := "shared-package"
|
||||
|
||||
for iter := 0; iter < numIterations; iter++ {
|
||||
c.Logf("Iteration %d/%d", iter+1, numIterations)
|
||||
|
||||
// Create two repos that will get the SAME package (unique per iteration)
|
||||
repos := []string{fmt.Sprintf("identical-a-%d", iter), fmt.Sprintf("identical-b-%d", iter)}
|
||||
dists := []string{fmt.Sprintf("dist-a-%d", iter), fmt.Sprintf("dist-b-%d", iter)}
|
||||
|
||||
for i := range repos {
|
||||
createBody, _ := json.Marshal(gin.H{
|
||||
"Name": repos[i],
|
||||
"DefaultDistribution": dists[i],
|
||||
"DefaultComponent": "main",
|
||||
})
|
||||
resp := s.httpRequest(c, "POST", "/api/repos", createBody)
|
||||
c.Assert(resp.Code, Equals, 201)
|
||||
|
||||
publishBody, _ := json.Marshal(gin.H{
|
||||
"SourceKind": "local",
|
||||
"Distribution": dists[i],
|
||||
"Architectures": []string{"amd64"},
|
||||
"Sources": []gin.H{
|
||||
{"Component": "main", "Name": repos[i]},
|
||||
},
|
||||
"Signing": gin.H{"Skip": true},
|
||||
"SkipBz2": true,
|
||||
})
|
||||
resp = s.httpRequest(c, "POST", "/api/publish/identical", publishBody)
|
||||
c.Assert(resp.Code, Equals, 201)
|
||||
}
|
||||
|
||||
// Create IDENTICAL package file with UNIQUE VERSION per iteration
|
||||
version := fmt.Sprintf("1.0.%d", iter)
|
||||
uploadID1 := fmt.Sprintf("identical-upload-1-%d", iter)
|
||||
uploadID2 := fmt.Sprintf("identical-upload-2-%d", iter)
|
||||
|
||||
s.createDebPackage(c, uploadID1, packageName, version)
|
||||
|
||||
// Copy to second upload (same SHA256)
|
||||
uploadPath := s.context.UploadPath()
|
||||
src := filepath.Join(uploadPath, uploadID1, fmt.Sprintf("%s_%s_amd64.deb", packageName, version))
|
||||
destDir := filepath.Join(uploadPath, uploadID2)
|
||||
err := os.MkdirAll(destDir, 0755)
|
||||
c.Assert(err, IsNil)
|
||||
dest := filepath.Join(destDir, fmt.Sprintf("%s_%s_amd64.deb", packageName, version))
|
||||
|
||||
srcData, readErr := os.ReadFile(src)
|
||||
c.Assert(readErr, IsNil)
|
||||
err = os.WriteFile(dest, srcData, 0644)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
// Race: add and publish both simultaneously
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(2)
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
s.httpRequest(c, "POST", fmt.Sprintf("/api/repos/%s/file/%s?noRemove=0", repos[0], uploadID1), nil)
|
||||
updateBody, _ := json.Marshal(gin.H{"Signing": gin.H{"Skip": true}, "ForceOverwrite": true, "SkipBz2": true})
|
||||
s.httpRequest(c, "PUT", fmt.Sprintf("/api/publish/identical/%s", dists[0]), updateBody)
|
||||
}()
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
s.httpRequest(c, "POST", fmt.Sprintf("/api/repos/%s/file/%s?noRemove=0", repos[1], uploadID2), nil)
|
||||
updateBody, _ := json.Marshal(gin.H{"Signing": gin.H{"Skip": true}, "ForceOverwrite": true, "SkipBz2": true})
|
||||
s.httpRequest(c, "PUT", fmt.Sprintf("/api/publish/identical/%s", dists[1]), updateBody)
|
||||
}()
|
||||
|
||||
wg.Wait()
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
c.Logf("[iter %d] All operations complete", iter)
|
||||
|
||||
// Check the shared pool location
|
||||
publishedStorage, err := s.context.GetPublishedStorage("")
|
||||
c.Assert(err, IsNil)
|
||||
publicPath := publishedStorage.(aptly.FileSystemPublishedStorage).PublicPath()
|
||||
|
||||
poolSubdir := string(packageName[0])
|
||||
sharedPoolPath := filepath.Join(publicPath, "identical", "pool", "main", poolSubdir, packageName,
|
||||
fmt.Sprintf("%s_%s_amd64.deb", packageName, version))
|
||||
|
||||
fileInfo, err := os.Stat(sharedPoolPath)
|
||||
fileExists := err == nil
|
||||
|
||||
if fileExists {
|
||||
c.Logf("[iter %d] File EXISTS at %s (size: %d)", iter, sharedPoolPath, fileInfo.Size())
|
||||
} else {
|
||||
c.Logf("[iter %d] File MISSING at %s (error: %v)", iter, sharedPoolPath, err)
|
||||
}
|
||||
|
||||
// Check metadata
|
||||
var packagesA, packagesB []string
|
||||
resp := s.httpRequest(c, "GET", fmt.Sprintf("/api/repos/%s/packages", repos[0]), nil)
|
||||
err = json.Unmarshal(resp.Body.Bytes(), &packagesA)
|
||||
c.Assert(err, IsNil)
|
||||
resp = s.httpRequest(c, "GET", fmt.Sprintf("/api/repos/%s/packages", repos[1]), nil)
|
||||
err = json.Unmarshal(resp.Body.Bytes(), &packagesB)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
c.Logf("[iter %d] Packages in metadata: A=%d, B=%d", iter, len(packagesA), len(packagesB))
|
||||
|
||||
// THE BUG: Both repos show packages in metadata, but the shared pool file is missing
|
||||
if (len(packagesA) > 0 || len(packagesB) > 0) && !fileExists {
|
||||
c.Logf("★★★ BUG REPRODUCED in iteration %d! ★★★", iter+1)
|
||||
c.Logf("Packages in metadata A: %d, B: %d", len(packagesA), len(packagesB))
|
||||
c.Logf("Shared pool file exists: %v", fileExists)
|
||||
c.Logf("Pool path: %s", sharedPoolPath)
|
||||
|
||||
// List what files ARE in the pool directory
|
||||
poolDir := filepath.Dir(sharedPoolPath)
|
||||
if entries, err := os.ReadDir(poolDir); err == nil {
|
||||
c.Logf("Files in pool directory %s:", poolDir)
|
||||
for _, entry := range entries {
|
||||
c.Logf(" - %s", entry.Name())
|
||||
}
|
||||
}
|
||||
|
||||
c.Fatalf("Metadata shows packages but shared pool file is missing (iteration %d)", iter+1)
|
||||
}
|
||||
}
|
||||
|
||||
c.Logf("All %d iterations passed - bug not reproduced", numIterations)
|
||||
}
|
||||
|
||||
// TestConcurrentSnapshotPublishToSamePrefix reproduces the EXACT production bug:
|
||||
// Multiple snapshots are published concurrently to the SAME prefix but different distributions.
|
||||
// Example from production logs:
|
||||
// - trixie-pgdg published to "external/postgres-auto/trixie"
|
||||
// - bullseye-pgdg published to "external/postgres-auto/bullseye"
|
||||
// Both share the same pool directory, causing cleanup race conditions.
|
||||
func (s *PublishedFileMissingSuite) TestConcurrentSnapshotPublishToSamePrefix(c *C) {
|
||||
const numIterations = 4
|
||||
|
||||
for iter := 0; iter < numIterations; iter++ {
|
||||
c.Logf("--- Iteration %d/%d ---", iter+1, numIterations)
|
||||
|
||||
// Create two repos with different packages (simulating trixie-pgdg and bullseye-pgdg)
|
||||
repoTrixie := fmt.Sprintf("trixie-pgdg-%d", iter)
|
||||
repoBullseye := fmt.Sprintf("bullseye-pgdg-%d", iter)
|
||||
|
||||
// Create trixie repo
|
||||
createBody, _ := json.Marshal(gin.H{
|
||||
"Name": repoTrixie,
|
||||
"DefaultDistribution": "trixie",
|
||||
"DefaultComponent": "main",
|
||||
})
|
||||
resp := s.httpRequest(c, "POST", "/api/repos", createBody)
|
||||
c.Assert(resp.Code, Equals, 201, Commentf("Failed to create trixie repo"))
|
||||
|
||||
// Create bullseye repo
|
||||
createBody, _ = json.Marshal(gin.H{
|
||||
"Name": repoBullseye,
|
||||
"DefaultDistribution": "bullseye",
|
||||
"DefaultComponent": "main",
|
||||
})
|
||||
resp = s.httpRequest(c, "POST", "/api/repos", createBody)
|
||||
c.Assert(resp.Code, Equals, 201, Commentf("Failed to create bullseye repo"))
|
||||
|
||||
// Add packages to both repos
|
||||
numPackages := 3
|
||||
|
||||
// Add packages to trixie repo
|
||||
for i := 0; i < numPackages; i++ {
|
||||
packageName := fmt.Sprintf("postgresql-17-trixie-pkg%d", i)
|
||||
version := fmt.Sprintf("17.0.%d", iter)
|
||||
uploadID := fmt.Sprintf("trixie-upload-%d-%d", iter, i)
|
||||
|
||||
s.createDebPackage(c, uploadID, packageName, version)
|
||||
resp = s.httpRequest(c, "POST", fmt.Sprintf("/api/repos/%s/file/%s?noRemove=0", repoTrixie, uploadID), nil)
|
||||
c.Assert(resp.Code, Equals, 200, Commentf("Failed to add package to trixie"))
|
||||
}
|
||||
|
||||
// Add packages to bullseye repo
|
||||
for i := 0; i < numPackages; i++ {
|
||||
packageName := fmt.Sprintf("postgresql-17-bullseye-pkg%d", i)
|
||||
version := fmt.Sprintf("17.0.%d", iter)
|
||||
uploadID := fmt.Sprintf("bullseye-upload-%d-%d", iter, i)
|
||||
|
||||
s.createDebPackage(c, uploadID, packageName, version)
|
||||
resp = s.httpRequest(c, "POST", fmt.Sprintf("/api/repos/%s/file/%s?noRemove=0", repoBullseye, uploadID), nil)
|
||||
c.Assert(resp.Code, Equals, 200, Commentf("Failed to add package to bullseye"))
|
||||
}
|
||||
|
||||
// Create snapshots from both repos
|
||||
snapshotTrixie := fmt.Sprintf("%s-snap", repoTrixie)
|
||||
snapshotBullseye := fmt.Sprintf("%s-snap", repoBullseye)
|
||||
|
||||
createSnapshotBody, _ := json.Marshal(gin.H{"Name": snapshotTrixie})
|
||||
resp = s.httpRequest(c, "POST", fmt.Sprintf("/api/repos/%s/snapshots", repoTrixie), createSnapshotBody)
|
||||
c.Assert(resp.Code, Equals, 201, Commentf("Failed to create trixie snapshot"))
|
||||
|
||||
createSnapshotBody, _ = json.Marshal(gin.H{"Name": snapshotBullseye})
|
||||
resp = s.httpRequest(c, "POST", fmt.Sprintf("/api/repos/%s/snapshots", repoBullseye), createSnapshotBody)
|
||||
c.Assert(resp.Code, Equals, 201, Commentf("Failed to create bullseye snapshot"))
|
||||
|
||||
// Publish both snapshots CONCURRENTLY to the SAME prefix
|
||||
// This mimics production where both are published to "external/postgres-auto"
|
||||
// Use the SAME prefix across all iterations to trigger the race more aggressively
|
||||
sharedPrefix := "postgres-auto"
|
||||
|
||||
var wg sync.WaitGroup
|
||||
var trixiePublishCode, bullseyePublishCode int
|
||||
|
||||
wg.Add(2)
|
||||
|
||||
// Publish or update trixie snapshot
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
var resp *httptest.ResponseRecorder
|
||||
if iter == 0 {
|
||||
// First iteration: CREATE
|
||||
publishBody, _ := json.Marshal(gin.H{
|
||||
"SourceKind": "snapshot",
|
||||
"Distribution": "trixie",
|
||||
"Architectures": []string{"amd64"},
|
||||
"Sources": []gin.H{
|
||||
{"Name": snapshotTrixie},
|
||||
},
|
||||
"Signing": gin.H{"Skip": true},
|
||||
"SkipBz2": true,
|
||||
"ForceOverwrite": true,
|
||||
"SkipCleanup": false, // Force cleanup to run
|
||||
})
|
||||
resp = s.httpRequest(c, "POST", fmt.Sprintf("/api/publish/%s", sharedPrefix), publishBody)
|
||||
} else {
|
||||
// Subsequent iterations: UPDATE (this is what happens in production)
|
||||
updateBody, _ := json.Marshal(gin.H{
|
||||
"Snapshots": []gin.H{
|
||||
{"Component": "main", "Name": snapshotTrixie},
|
||||
},
|
||||
"Signing": gin.H{"Skip": true},
|
||||
"SkipBz2": true,
|
||||
"ForceOverwrite": true,
|
||||
"SkipCleanup": false,
|
||||
})
|
||||
resp = s.httpRequest(c, "PUT", fmt.Sprintf("/api/publish/%s/trixie", sharedPrefix), updateBody)
|
||||
}
|
||||
trixiePublishCode = resp.Code
|
||||
c.Logf("[iter %d] Trixie publish/update completed: %d", iter, resp.Code)
|
||||
}()
|
||||
|
||||
// Publish or update bullseye snapshot
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
|
||||
var resp *httptest.ResponseRecorder
|
||||
if iter == 0 {
|
||||
// First iteration: CREATE
|
||||
publishBody, _ := json.Marshal(gin.H{
|
||||
"SourceKind": "snapshot",
|
||||
"Distribution": "bullseye",
|
||||
"Architectures": []string{"amd64"},
|
||||
"Sources": []gin.H{
|
||||
{"Name": snapshotBullseye},
|
||||
},
|
||||
"Signing": gin.H{"Skip": true},
|
||||
"SkipBz2": true,
|
||||
"ForceOverwrite": true,
|
||||
"SkipCleanup": false,
|
||||
})
|
||||
resp = s.httpRequest(c, "POST", fmt.Sprintf("/api/publish/%s", sharedPrefix), publishBody)
|
||||
} else {
|
||||
// Subsequent iterations: UPDATE
|
||||
updateBody, _ := json.Marshal(gin.H{
|
||||
"Snapshots": []gin.H{
|
||||
{"Component": "main", "Name": snapshotBullseye},
|
||||
},
|
||||
"Signing": gin.H{"Skip": true},
|
||||
"SkipBz2": true,
|
||||
"ForceOverwrite": true,
|
||||
"SkipCleanup": false,
|
||||
})
|
||||
resp = s.httpRequest(c, "PUT", fmt.Sprintf("/api/publish/%s/bullseye", sharedPrefix), updateBody)
|
||||
}
|
||||
bullseyePublishCode = resp.Code
|
||||
c.Logf("[iter %d] Bullseye publish/update completed: %d", iter, resp.Code)
|
||||
}()
|
||||
|
||||
wg.Wait()
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
|
||||
// Verify publishes succeeded (201 for create, 200 for update)
|
||||
expectedCode := 201
|
||||
if iter > 0 {
|
||||
expectedCode = 200
|
||||
}
|
||||
c.Assert(trixiePublishCode, Equals, expectedCode, Commentf("Trixie publish/update should succeed"))
|
||||
c.Assert(bullseyePublishCode, Equals, expectedCode, Commentf("Bullseye publish/update should succeed"))
|
||||
|
||||
// Verify ALL package files exist in the published pool
|
||||
publishedStorage, err := s.context.GetPublishedStorage("")
|
||||
c.Assert(err, IsNil)
|
||||
publicPath := publishedStorage.(aptly.FileSystemPublishedStorage).PublicPath()
|
||||
|
||||
missingFiles := []string{}
|
||||
expectedFiles := []string{}
|
||||
|
||||
// Check trixie packages
|
||||
for i := 0; i < numPackages; i++ {
|
||||
packageName := fmt.Sprintf("postgresql-17-trixie-pkg%d", i)
|
||||
version := fmt.Sprintf("17.0.%d", iter)
|
||||
|
||||
poolSubdir := string(packageName[0])
|
||||
expectedPath := filepath.Join(publicPath, sharedPrefix, "pool", "main", poolSubdir, packageName,
|
||||
fmt.Sprintf("%s_%s_amd64.deb", packageName, version))
|
||||
|
||||
expectedFiles = append(expectedFiles, expectedPath)
|
||||
if _, err := os.Stat(expectedPath); os.IsNotExist(err) {
|
||||
missingFiles = append(missingFiles, fmt.Sprintf("TRIXIE: %s", filepath.Base(expectedPath)))
|
||||
}
|
||||
}
|
||||
|
||||
// Check bullseye packages
|
||||
for i := 0; i < numPackages; i++ {
|
||||
packageName := fmt.Sprintf("postgresql-17-bullseye-pkg%d", i)
|
||||
version := fmt.Sprintf("17.0.%d", iter)
|
||||
|
||||
poolSubdir := string(packageName[0])
|
||||
expectedPath := filepath.Join(publicPath, sharedPrefix, "pool", "main", poolSubdir, packageName,
|
||||
fmt.Sprintf("%s_%s_amd64.deb", packageName, version))
|
||||
|
||||
expectedFiles = append(expectedFiles, expectedPath)
|
||||
if _, err := os.Stat(expectedPath); os.IsNotExist(err) {
|
||||
missingFiles = append(missingFiles, fmt.Sprintf("BULLSEYE: %s", filepath.Base(expectedPath)))
|
||||
}
|
||||
}
|
||||
|
||||
// BUG: Files from one distribution are deleted by the other's cleanup
|
||||
if len(missingFiles) > 0 {
|
||||
c.Logf("★★★ BUG REPRODUCED in iteration %d/%d! ★★★", iter+1, numIterations)
|
||||
c.Logf("Both publishes to prefix '%s' succeeded, but %d files are MISSING:", sharedPrefix, len(missingFiles))
|
||||
for i, f := range missingFiles {
|
||||
c.Logf(" Missing file %d/%d: %s", i+1, len(missingFiles), f)
|
||||
}
|
||||
|
||||
c.Logf("\nThis reproduces the exact production bug where:")
|
||||
c.Logf(" 1. Mirror updates complete successfully")
|
||||
c.Logf(" 2. Snapshots are created")
|
||||
c.Logf(" 3. Both snapshots publish to same prefix (different distributions)")
|
||||
c.Logf(" 4. Cleanup from one publish DELETES files from the other")
|
||||
c.Logf(" 5. Result: apt-get returns 404 when downloading packages")
|
||||
|
||||
// List what's actually in the pool
|
||||
poolDir := filepath.Join(publicPath, sharedPrefix, "pool", "main")
|
||||
if entries, err := os.ReadDir(poolDir); err == nil {
|
||||
c.Logf("\nActual pool directory contents (%s):", poolDir)
|
||||
for _, entry := range entries {
|
||||
c.Logf(" - %s/", entry.Name())
|
||||
}
|
||||
}
|
||||
|
||||
c.Fatalf("BUG CONFIRMED (iteration %d/%d): %d files missing from shared pool",
|
||||
iter+1, numIterations, len(missingFiles))
|
||||
} else {
|
||||
c.Logf("[iter %d/%d] All %d files present - OK", iter+1, numIterations, len(expectedFiles))
|
||||
}
|
||||
}
|
||||
c.Logf("✓ All %d iterations passed - no files missing", numIterations)
|
||||
}
|
||||
+172
-71
@@ -60,7 +60,12 @@ func reposServeInAPIMode(c *gin.Context) {
|
||||
storage = "filesystem:" + storage
|
||||
}
|
||||
|
||||
publicPath := context.GetPublishedStorage(storage).(aptly.FileSystemPublishedStorage).PublicPath()
|
||||
ps, err := context.GetPublishedStorage(storage)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusNotFound, err)
|
||||
return
|
||||
}
|
||||
publicPath := ps.(aptly.FileSystemPublishedStorage).PublicPath()
|
||||
c.FileFromFS(pkgpath, http.Dir(publicPath))
|
||||
}
|
||||
|
||||
@@ -131,51 +136,67 @@ func apiReposCreate(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
repo := deb.NewLocalRepo(b.Name, b.Comment)
|
||||
repo.DefaultComponent = b.DefaultComponent
|
||||
repo.DefaultDistribution = b.DefaultDistribution
|
||||
|
||||
// Handler: Pre-task validations (shallow)
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
|
||||
var resources []string
|
||||
if b.FromSnapshot != "" {
|
||||
var snapshot *deb.Snapshot
|
||||
|
||||
snapshotCollection := collectionFactory.SnapshotCollection()
|
||||
|
||||
snapshot, err := snapshotCollection.ByName(b.FromSnapshot)
|
||||
snapshot, err := collectionFactory.SnapshotCollection().ByName(b.FromSnapshot)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusNotFound, fmt.Errorf("source snapshot not found: %s", err))
|
||||
return
|
||||
}
|
||||
resources = append(resources, string(snapshot.Key()))
|
||||
}
|
||||
|
||||
err = snapshotCollection.LoadComplete(snapshot)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusInternalServerError, fmt.Errorf("unable to load source snapshot: %s", err))
|
||||
return
|
||||
taskName := fmt.Sprintf("Create repository %s", b.Name)
|
||||
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
// Task: Create fresh collection and check/create ATOMIC inside task
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.LocalRepoCollection()
|
||||
|
||||
// Check duplicate inside lock
|
||||
if _, err := taskCollection.ByName(b.Name); err == nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusConflict, Value: nil},
|
||||
fmt.Errorf("local repo with name %s already exists", b.Name)
|
||||
}
|
||||
|
||||
repo.UpdateRefList(snapshot.RefList())
|
||||
}
|
||||
// Create repo
|
||||
repo := deb.NewLocalRepo(b.Name, b.Comment)
|
||||
repo.DefaultComponent = b.DefaultComponent
|
||||
repo.DefaultDistribution = b.DefaultDistribution
|
||||
|
||||
localRepoCollection := collectionFactory.LocalRepoCollection()
|
||||
if b.FromSnapshot != "" {
|
||||
snapshotCollection := taskCollectionFactory.SnapshotCollection()
|
||||
|
||||
if _, err := localRepoCollection.ByName(b.Name); err == nil {
|
||||
AbortWithJSONError(c, http.StatusConflict, fmt.Errorf("local repo with name %s already exists", b.Name))
|
||||
return
|
||||
}
|
||||
snapshot, err := snapshotCollection.ByName(b.FromSnapshot)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusNotFound, Value: nil},
|
||||
fmt.Errorf("source snapshot not found: %s", err)
|
||||
}
|
||||
|
||||
err := localRepoCollection.Add(repo)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, http.StatusInternalServerError, err)
|
||||
return
|
||||
}
|
||||
err = snapshotCollection.LoadComplete(snapshot)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil},
|
||||
fmt.Errorf("unable to load source snapshot: %s", err)
|
||||
}
|
||||
|
||||
c.JSON(http.StatusCreated, repo)
|
||||
repo.UpdateRefList(snapshot.RefList())
|
||||
}
|
||||
|
||||
err := taskCollection.Add(repo)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
|
||||
return &task.ProcessReturnValue{Code: http.StatusCreated, Value: repo}, nil
|
||||
})
|
||||
}
|
||||
|
||||
type reposEditParams struct {
|
||||
// Name of repository to modify
|
||||
Name *string `binding:"required" json:"Name" example:"repo1"`
|
||||
Name *string ` json:"Name" example:"new-repo-name"`
|
||||
// Change Comment of repository
|
||||
Comment *string ` json:"Comment" example:"example repo"`
|
||||
// Change Default Distribution for publishing
|
||||
@@ -187,7 +208,7 @@ type reposEditParams struct {
|
||||
// @Summary Update Repository
|
||||
// @Description **Update local repository meta information**
|
||||
// @Tags Repos
|
||||
// @Param name path string true "Repository name"
|
||||
// @Param name path string true "Repository name to modify"
|
||||
// @Consume json
|
||||
// @Param request body reposEditParams true "Parameters"
|
||||
// @Produce json
|
||||
@@ -200,7 +221,8 @@ func apiReposEdit(c *gin.Context) {
|
||||
if c.Bind(&b) != nil {
|
||||
return
|
||||
}
|
||||
|
||||
// Load shallowly for 404 check and resource key.
|
||||
// Mutation and duplicate check happen inside the task for atomicity.
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.LocalRepoCollection()
|
||||
|
||||
@@ -212,31 +234,53 @@ func apiReposEdit(c *gin.Context) {
|
||||
}
|
||||
|
||||
if b.Name != nil && *b.Name != name {
|
||||
_, err := collection.ByName(*b.Name)
|
||||
if err == nil {
|
||||
// already exists
|
||||
AbortWithJSONError(c, 404, fmt.Errorf("local repo with name %q already exists", *b.Name))
|
||||
if _, err = collection.ByName(*b.Name); err == nil {
|
||||
AbortWithJSONError(c, 409, fmt.Errorf("unable to rename: local repo %q already exists", *b.Name))
|
||||
return
|
||||
}
|
||||
repo.Name = *b.Name
|
||||
}
|
||||
if b.Comment != nil {
|
||||
repo.Comment = *b.Comment
|
||||
}
|
||||
if b.DefaultDistribution != nil {
|
||||
repo.DefaultDistribution = *b.DefaultDistribution
|
||||
}
|
||||
if b.DefaultComponent != nil {
|
||||
repo.DefaultComponent = *b.DefaultComponent
|
||||
}
|
||||
|
||||
err = collection.Update(repo)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, 500, err)
|
||||
return
|
||||
}
|
||||
resources := []string{string(repo.Key())}
|
||||
taskName := fmt.Sprintf("Edit repository %s", name)
|
||||
|
||||
c.JSON(200, repo)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
// Task: Create fresh collection inside task after lock
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.LocalRepoCollection()
|
||||
|
||||
// Fresh load after lock acquired
|
||||
repo, err := taskCollection.ByName(name)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusNotFound, Value: nil}, err
|
||||
}
|
||||
|
||||
// Check and update ATOMIC (inside lock)
|
||||
if b.Name != nil && *b.Name != name {
|
||||
_, err := taskCollection.ByName(*b.Name)
|
||||
if err == nil {
|
||||
// already exists
|
||||
return &task.ProcessReturnValue{Code: http.StatusConflict, Value: nil},
|
||||
fmt.Errorf("local repo with name %q already exists", *b.Name)
|
||||
}
|
||||
repo.Name = *b.Name
|
||||
}
|
||||
if b.Comment != nil {
|
||||
repo.Comment = *b.Comment
|
||||
}
|
||||
if b.DefaultDistribution != nil {
|
||||
repo.DefaultDistribution = *b.DefaultDistribution
|
||||
}
|
||||
if b.DefaultComponent != nil {
|
||||
repo.DefaultComponent = *b.DefaultComponent
|
||||
}
|
||||
|
||||
err = taskCollection.Update(repo)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
|
||||
return &task.ProcessReturnValue{Code: http.StatusOK, Value: repo}, nil
|
||||
})
|
||||
}
|
||||
|
||||
// GET /api/repos/:name
|
||||
@@ -278,10 +322,10 @@ func apiReposDrop(c *gin.Context) {
|
||||
force := c.Request.URL.Query().Get("force") == "1"
|
||||
name := c.Params.ByName("name")
|
||||
|
||||
// Load shallowly for 404 check, resource key, and task name.
|
||||
// Full checks (published/snapshots) happen inside the task.
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.LocalRepoCollection()
|
||||
snapshotCollection := collectionFactory.SnapshotCollection()
|
||||
publishedCollection := collectionFactory.PublishedRepoCollection()
|
||||
|
||||
repo, err := collection.ByName(name)
|
||||
if err != nil {
|
||||
@@ -292,19 +336,32 @@ func apiReposDrop(c *gin.Context) {
|
||||
resources := []string{string(repo.Key())}
|
||||
taskName := fmt.Sprintf("Delete repo %s", name)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
published := publishedCollection.ByLocalRepo(repo)
|
||||
// Task: Create fresh collections inside task after lock acquired
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.LocalRepoCollection()
|
||||
taskSnapshotCollection := taskCollectionFactory.SnapshotCollection()
|
||||
taskPublishedCollection := taskCollectionFactory.PublishedRepoCollection()
|
||||
|
||||
// Re-read repo with fresh collection after lock
|
||||
repo, err := taskCollection.ByName(name)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusConflict, Value: nil}, fmt.Errorf("unable to drop: %s", err)
|
||||
}
|
||||
|
||||
// Check with fresh collections
|
||||
published := taskPublishedCollection.ByLocalRepo(repo)
|
||||
if len(published) > 0 {
|
||||
return &task.ProcessReturnValue{Code: http.StatusConflict, Value: nil}, fmt.Errorf("unable to drop, local repo is published")
|
||||
}
|
||||
|
||||
if !force {
|
||||
snapshots := snapshotCollection.ByLocalRepoSource(repo)
|
||||
snapshots := taskSnapshotCollection.ByLocalRepoSource(repo)
|
||||
if len(snapshots) > 0 {
|
||||
return &task.ProcessReturnValue{Code: http.StatusConflict, Value: nil}, fmt.Errorf("unable to drop, local repo has snapshots, use ?force=1 to override")
|
||||
}
|
||||
}
|
||||
|
||||
return &task.ProcessReturnValue{Code: http.StatusOK, Value: gin.H{}}, collection.Drop(repo)
|
||||
return &task.ProcessReturnValue{Code: http.StatusOK, Value: gin.H{}}, taskCollection.Drop(repo)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -361,10 +418,13 @@ func apiReposPackagesAddDelete(c *gin.Context, taskNamePrefix string, cb func(li
|
||||
return
|
||||
}
|
||||
|
||||
// Load shallowly for 404 check and resource key.
|
||||
// Full load and mutations happen inside the task.
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.LocalRepoCollection()
|
||||
|
||||
repo, err := collection.ByName(c.Params.ByName("name"))
|
||||
name := c.Params.ByName("name")
|
||||
repo, err := collection.ByName(name)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, 404, err)
|
||||
return
|
||||
@@ -373,13 +433,23 @@ func apiReposPackagesAddDelete(c *gin.Context, taskNamePrefix string, cb func(li
|
||||
resources := []string{string(repo.Key())}
|
||||
|
||||
maybeRunTaskInBackground(c, taskNamePrefix+repo.Name, resources, func(out aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err = collection.LoadComplete(repo)
|
||||
// Task: Create fresh factory and collection inside task after lock
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.LocalRepoCollection()
|
||||
|
||||
// Fresh load after lock acquired (use captured `name` variable, not gin context)
|
||||
repo, err := taskCollection.ByName(name)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusNotFound, Value: nil}, err
|
||||
}
|
||||
|
||||
err = taskCollection.LoadComplete(repo)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
|
||||
out.Printf("Loading packages...\n")
|
||||
list, err := deb.NewPackageListFromRefList(repo.RefList(), collectionFactory.PackageCollection(), nil)
|
||||
list, err := deb.NewPackageListFromRefList(repo.RefList(), taskCollectionFactory.PackageCollection(), nil)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
@@ -388,7 +458,7 @@ func apiReposPackagesAddDelete(c *gin.Context, taskNamePrefix string, cb func(li
|
||||
for _, ref := range b.PackageRefs {
|
||||
var p *deb.Package
|
||||
|
||||
p, err = collectionFactory.PackageCollection().ByKey([]byte(ref))
|
||||
p, err = taskCollectionFactory.PackageCollection().ByKey([]byte(ref))
|
||||
if err != nil {
|
||||
if err == database.ErrNotFound {
|
||||
return &task.ProcessReturnValue{Code: http.StatusNotFound, Value: nil}, fmt.Errorf("packages %s: %s", ref, err)
|
||||
@@ -404,7 +474,7 @@ func apiReposPackagesAddDelete(c *gin.Context, taskNamePrefix string, cb func(li
|
||||
|
||||
repo.UpdateRefList(deb.NewPackageRefListFromPackageList(list))
|
||||
|
||||
err = collectionFactory.LocalRepoCollection().Update(repo)
|
||||
err = taskCollection.Update(repo)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save: %s", err)
|
||||
}
|
||||
@@ -511,6 +581,8 @@ func apiReposPackageFromDir(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Load shallowly for 404 check and resource key.
|
||||
// Full load and mutations happen inside the task.
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.LocalRepoCollection()
|
||||
|
||||
@@ -534,7 +606,17 @@ func apiReposPackageFromDir(c *gin.Context) {
|
||||
resources := []string{string(repo.Key())}
|
||||
resources = append(resources, sources...)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(out aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err = collection.LoadComplete(repo)
|
||||
// Task: Create fresh factory and collection inside task after lock
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.LocalRepoCollection()
|
||||
|
||||
// Fresh load after lock acquired
|
||||
repo, err := taskCollection.ByName(name)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
|
||||
err = taskCollection.LoadComplete(repo)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
@@ -555,13 +637,13 @@ func apiReposPackageFromDir(c *gin.Context) {
|
||||
|
||||
packageFiles, otherFiles, failedFiles = deb.CollectPackageFiles(sources, reporter)
|
||||
|
||||
list, err := deb.NewPackageListFromRefList(repo.RefList(), collectionFactory.PackageCollection(), nil)
|
||||
list, err = deb.NewPackageListFromRefList(repo.RefList(), taskCollectionFactory.PackageCollection(), nil)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to load packages: %s", err)
|
||||
}
|
||||
|
||||
processedFiles, failedFiles2, err = deb.ImportPackageFiles(list, packageFiles, forceReplace, verifier, context.PackagePool(),
|
||||
collectionFactory.PackageCollection(), reporter, nil, collectionFactory.ChecksumCollection)
|
||||
taskCollectionFactory.PackageCollection(), reporter, nil, taskCollectionFactory.ChecksumCollection)
|
||||
failedFiles = append(failedFiles, failedFiles2...)
|
||||
processedFiles = append(processedFiles, otherFiles...)
|
||||
|
||||
@@ -571,7 +653,7 @@ func apiReposPackageFromDir(c *gin.Context) {
|
||||
|
||||
repo.UpdateRefList(deb.NewPackageRefListFromPackageList(list))
|
||||
|
||||
err = collectionFactory.LocalRepoCollection().Update(repo)
|
||||
err = taskCollection.Update(repo)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save: %s", err)
|
||||
}
|
||||
@@ -650,6 +732,8 @@ func apiReposCopyPackage(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Load shallowly for 404 check and resource keys.
|
||||
// Full load and mutations happen inside the task.
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
dstRepo, err := collectionFactory.LocalRepoCollection().ByName(dstRepoName)
|
||||
if err != nil {
|
||||
@@ -673,12 +757,26 @@ func apiReposCopyPackage(c *gin.Context) {
|
||||
resources := []string{string(dstRepo.Key()), string(srcRepo.Key())}
|
||||
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err = collectionFactory.LocalRepoCollection().LoadComplete(dstRepo)
|
||||
// Task: Create fresh factory and collections inside task after lock
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
|
||||
// Fresh load of both repos after lock acquired
|
||||
dstRepo, err := taskCollectionFactory.LocalRepoCollection().ByName(dstRepoName)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusBadRequest, Value: nil}, fmt.Errorf("dest repo error: %s", err)
|
||||
}
|
||||
|
||||
err = collectionFactory.LocalRepoCollection().LoadComplete(srcRepo)
|
||||
srcRepo, err := taskCollectionFactory.LocalRepoCollection().ByName(srcRepoName)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusBadRequest, Value: nil}, fmt.Errorf("src repo error: %s", err)
|
||||
}
|
||||
|
||||
err = taskCollectionFactory.LocalRepoCollection().LoadComplete(dstRepo)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusBadRequest, Value: nil}, fmt.Errorf("dest repo error: %s", err)
|
||||
}
|
||||
|
||||
err = taskCollectionFactory.LocalRepoCollection().LoadComplete(srcRepo)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusBadRequest, Value: nil}, fmt.Errorf("src repo error: %s", err)
|
||||
}
|
||||
@@ -691,12 +789,12 @@ func apiReposCopyPackage(c *gin.Context) {
|
||||
RemovedLines: []string{},
|
||||
}
|
||||
|
||||
dstList, err := deb.NewPackageListFromRefList(dstRepo.RefList(), collectionFactory.PackageCollection(), context.Progress())
|
||||
dstList, err := deb.NewPackageListFromRefList(dstRepo.RefList(), taskCollectionFactory.PackageCollection(), context.Progress())
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to load packages in dest: %s", err)
|
||||
}
|
||||
|
||||
srcList, err := deb.NewPackageListFromRefList(srcRefList, collectionFactory.PackageCollection(), context.Progress())
|
||||
srcList, err := deb.NewPackageListFromRefList(srcRefList, taskCollectionFactory.PackageCollection(), context.Progress())
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to load packages in src: %s", err)
|
||||
}
|
||||
@@ -764,7 +862,7 @@ func apiReposCopyPackage(c *gin.Context) {
|
||||
} else {
|
||||
dstRepo.UpdateRefList(deb.NewPackageRefListFromPackageList(dstList))
|
||||
|
||||
err = collectionFactory.LocalRepoCollection().Update(dstRepo)
|
||||
err = taskCollectionFactory.LocalRepoCollection().Update(dstRepo)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to save: %s", err)
|
||||
}
|
||||
@@ -867,6 +965,9 @@ func apiReposIncludePackageFromDir(c *gin.Context) {
|
||||
resources = append(resources, sources...)
|
||||
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(out aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
// Task: Create fresh factory and collection inside task after lock
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
|
||||
var (
|
||||
err error
|
||||
verifier = context.GetVerifier()
|
||||
@@ -882,8 +983,8 @@ func apiReposIncludePackageFromDir(c *gin.Context) {
|
||||
changesFiles, failedFiles = deb.CollectChangesFiles(sources, reporter)
|
||||
_, failedFiles2, err = deb.ImportChangesFiles(
|
||||
changesFiles, reporter, acceptUnsigned, ignoreSignature, forceReplace, noRemoveFiles, verifier,
|
||||
repoTemplate, context.Progress(), collectionFactory.LocalRepoCollection(), collectionFactory.PackageCollection(),
|
||||
context.PackagePool(), collectionFactory.ChecksumCollection, nil, query.Parse)
|
||||
repoTemplate, context.Progress(), taskCollectionFactory.LocalRepoCollection(), taskCollectionFactory.PackageCollection(),
|
||||
context.PackagePool(), taskCollectionFactory.ChecksumCollection, nil, query.Parse)
|
||||
failedFiles = append(failedFiles, failedFiles2...)
|
||||
|
||||
if err != nil {
|
||||
|
||||
+14
-11
@@ -11,9 +11,9 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
// _ "github.com/aptly-dev/aptly/docs" // import docs
|
||||
// swaggerFiles "github.com/swaggo/files"
|
||||
// ginSwagger "github.com/swaggo/gin-swagger"
|
||||
"github.com/aptly-dev/aptly/docs"
|
||||
swaggerFiles "github.com/swaggo/files"
|
||||
ginSwagger "github.com/swaggo/gin-swagger"
|
||||
)
|
||||
|
||||
var context *ctx.AptlyContext
|
||||
@@ -69,14 +69,14 @@ func Router(c *ctx.AptlyContext) http.Handler {
|
||||
|
||||
router.Use(gin.Recovery(), gin.ErrorLogger())
|
||||
|
||||
// if c.Config().EnableSwaggerEndpoint {
|
||||
// router.GET("docs.html", func(c *gin.Context) {
|
||||
// c.Data(http.StatusOK, "text/html; charset=utf-8", docs.DocsHTML)
|
||||
// })
|
||||
// router.Use(redirectSwagger)
|
||||
// url := ginSwagger.URL("/docs/doc.json")
|
||||
// router.GET("/docs/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url))
|
||||
// }
|
||||
if c.Config().EnableSwaggerEndpoint {
|
||||
router.GET("docs.html", func(c *gin.Context) {
|
||||
c.Data(http.StatusOK, "text/html; charset=utf-8", docs.DocsHTML)
|
||||
})
|
||||
router.Use(redirectSwagger)
|
||||
url := ginSwagger.URL("/docs/doc.json")
|
||||
router.GET("/docs/*any", ginSwagger.WrapHandler(swaggerFiles.Handler, url))
|
||||
}
|
||||
|
||||
if c.Config().EnableMetricsEndpoint {
|
||||
MetricsCollectorRegistrar.Register(router)
|
||||
@@ -177,11 +177,14 @@ func Router(c *ctx.AptlyContext) http.Handler {
|
||||
|
||||
{
|
||||
api.GET("/s3", apiS3List)
|
||||
api.GET("/gcs", apiGCSList)
|
||||
api.GET("/jfrog", apiJFrogList)
|
||||
}
|
||||
|
||||
{
|
||||
api.GET("/files", apiFilesListDirs)
|
||||
api.POST("/files/:dir", apiFilesUpload)
|
||||
api.PUT("/files/:dir/:file", apiFilesUploadOne)
|
||||
api.GET("/files/:dir", apiFilesListFiles)
|
||||
api.DELETE("/files/:dir", apiFilesDeleteDir)
|
||||
api.DELETE("/files/:dir/:name", apiFilesDeleteFile)
|
||||
|
||||
@@ -14,7 +14,8 @@ import (
|
||||
// @Router /api/s3 [get]
|
||||
func apiS3List(c *gin.Context) {
|
||||
keys := []string{}
|
||||
for k := range context.Config().S3PublishRoots {
|
||||
s3Roots := context.Config().S3PublishRoots
|
||||
for k := range s3Roots {
|
||||
keys = append(keys, k)
|
||||
}
|
||||
c.JSON(200, keys)
|
||||
|
||||
+161
-62
@@ -83,26 +83,33 @@ func apiSnapshotsCreateFromMirror(c *gin.Context) {
|
||||
}
|
||||
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.RemoteRepoCollection()
|
||||
snapshotCollection := collectionFactory.SnapshotCollection()
|
||||
name := c.Params.ByName("name")
|
||||
|
||||
repo, err = collection.ByName(name)
|
||||
repo, err = collectionFactory.RemoteRepoCollection().ByName(name)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, 404, err)
|
||||
return
|
||||
}
|
||||
|
||||
// including snapshot resource key
|
||||
resources := []string{string(repo.Key()), "S" + b.Name}
|
||||
resources := []string{string(repo.Key())}
|
||||
taskName := fmt.Sprintf("Create snapshot of mirror %s", name)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err := repo.CheckLock()
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskMirrorCollection := taskCollectionFactory.RemoteRepoCollection()
|
||||
taskSnapshotCollection := taskCollectionFactory.SnapshotCollection()
|
||||
|
||||
repo, err := taskMirrorCollection.ByName(name)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
|
||||
err = repo.CheckLock()
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusConflict, Value: nil}, err
|
||||
}
|
||||
|
||||
err = collection.LoadComplete(repo)
|
||||
err = taskMirrorCollection.LoadComplete(repo)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
@@ -116,7 +123,7 @@ func apiSnapshotsCreateFromMirror(c *gin.Context) {
|
||||
snapshot.Description = b.Description
|
||||
}
|
||||
|
||||
err = snapshotCollection.Add(snapshot)
|
||||
err = taskSnapshotCollection.Add(snapshot)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusBadRequest, Value: nil}, err
|
||||
}
|
||||
@@ -165,6 +172,7 @@ func apiSnapshotsCreate(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
// Phase 1: Pre-task validation (shallow load for 404 checks only)
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
snapshotCollection := collectionFactory.SnapshotCollection()
|
||||
var resources []string
|
||||
@@ -178,37 +186,62 @@ func apiSnapshotsCreate(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resources = append(resources, string(sources[i].ResourceKey()))
|
||||
resources = append(resources, string(sources[i].Key()))
|
||||
}
|
||||
|
||||
maybeRunTaskInBackground(c, "Create snapshot "+b.Name, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
for i := range sources {
|
||||
err = snapshotCollection.LoadComplete(sources[i])
|
||||
// Phase 2: Inside task lock - create fresh factory
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskSnapshotCollection := taskCollectionFactory.SnapshotCollection()
|
||||
taskPackageCollection := taskCollectionFactory.PackageCollection()
|
||||
|
||||
// Fresh load of all sources after lock acquired
|
||||
freshSources := make([]*deb.Snapshot, len(b.SourceSnapshots))
|
||||
for i := range b.SourceSnapshots {
|
||||
freshSources[i], err = taskSnapshotCollection.ByName(b.SourceSnapshots[i])
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
// LoadComplete on fresh copy
|
||||
err = taskSnapshotCollection.LoadComplete(freshSources[i])
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
}
|
||||
|
||||
list := deb.NewPackageList()
|
||||
// Merge packages from all source snapshots
|
||||
var refList *deb.PackageRefList
|
||||
if len(freshSources) > 0 {
|
||||
refList = freshSources[0].RefList()
|
||||
for i := 1; i < len(freshSources); i++ {
|
||||
refList = refList.Merge(freshSources[i].RefList(), true, false)
|
||||
}
|
||||
} else {
|
||||
refList = deb.NewPackageRefList()
|
||||
}
|
||||
|
||||
// verify package refs and build package list
|
||||
for _, ref := range b.PackageRefs {
|
||||
p, err := collectionFactory.PackageCollection().ByKey([]byte(ref))
|
||||
if err != nil {
|
||||
if err == database.ErrNotFound {
|
||||
return &task.ProcessReturnValue{Code: http.StatusNotFound, Value: nil}, fmt.Errorf("package %s: %s", ref, err)
|
||||
// Add any explicitly specified package refs on top
|
||||
if len(b.PackageRefs) > 0 {
|
||||
list := deb.NewPackageList()
|
||||
for _, ref := range b.PackageRefs {
|
||||
p, err := taskPackageCollection.ByKey([]byte(ref))
|
||||
if err != nil {
|
||||
if err == database.ErrNotFound {
|
||||
return &task.ProcessReturnValue{Code: http.StatusNotFound, Value: nil}, fmt.Errorf("package %s: %s", ref, err)
|
||||
}
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
err = list.Add(p)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusBadRequest, Value: nil}, err
|
||||
}
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
err = list.Add(p)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusBadRequest, Value: nil}, err
|
||||
}
|
||||
refList = refList.Merge(deb.NewPackageRefListFromPackageList(list), true, false)
|
||||
}
|
||||
|
||||
snapshot = deb.NewSnapshotFromRefList(b.Name, sources, deb.NewPackageRefListFromPackageList(list), b.Description)
|
||||
snapshot = deb.NewSnapshotFromRefList(b.Name, freshSources, refList, b.Description)
|
||||
|
||||
err = snapshotCollection.Add(snapshot)
|
||||
err = taskSnapshotCollection.Add(snapshot)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusBadRequest, Value: nil}, err
|
||||
}
|
||||
@@ -249,21 +282,28 @@ func apiSnapshotsCreateFromRepository(c *gin.Context) {
|
||||
}
|
||||
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.LocalRepoCollection()
|
||||
snapshotCollection := collectionFactory.SnapshotCollection()
|
||||
name := c.Params.ByName("name")
|
||||
|
||||
repo, err = collection.ByName(name)
|
||||
repo, err = collectionFactory.LocalRepoCollection().ByName(name)
|
||||
if err != nil {
|
||||
AbortWithJSONError(c, 404, err)
|
||||
return
|
||||
}
|
||||
|
||||
// including snapshot resource key
|
||||
resources := []string{string(repo.Key()), "S" + b.Name}
|
||||
resources := []string{string(repo.Key())}
|
||||
taskName := fmt.Sprintf("Create snapshot of repo %s", name)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err := collection.LoadComplete(repo)
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskRepoCollection := taskCollectionFactory.LocalRepoCollection()
|
||||
taskSnapshotCollection := taskCollectionFactory.SnapshotCollection()
|
||||
|
||||
repo, err := taskRepoCollection.ByName(name)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
|
||||
err = taskRepoCollection.LoadComplete(repo)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
@@ -277,7 +317,7 @@ func apiSnapshotsCreateFromRepository(c *gin.Context) {
|
||||
snapshot.Description = b.Description
|
||||
}
|
||||
|
||||
err = snapshotCollection.Add(snapshot)
|
||||
err = taskSnapshotCollection.Add(snapshot)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusBadRequest, Value: nil}, err
|
||||
}
|
||||
@@ -315,6 +355,7 @@ func apiSnapshotsUpdate(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Phase 1: Pre-task validation (shallow load for 404 check only)
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
collection := collectionFactory.SnapshotCollection()
|
||||
name := c.Params.ByName("name")
|
||||
@@ -325,14 +366,38 @@ func apiSnapshotsUpdate(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resources := []string{string(snapshot.ResourceKey()), "S" + b.Name}
|
||||
taskName := fmt.Sprintf("Update snapshot %s", name)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
_, err := collection.ByName(b.Name)
|
||||
// Pre-task validation of new name if provided (skip if renaming to same name)
|
||||
if b.Name != "" && b.Name != name {
|
||||
_, err = collection.ByName(b.Name)
|
||||
if err == nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusConflict, Value: nil}, fmt.Errorf("unable to rename: snapshot %s already exists", b.Name)
|
||||
AbortWithJSONError(c, 409, fmt.Errorf("unable to rename: snapshot %s already exists", b.Name))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
resources := []string{string(snapshot.Key())}
|
||||
taskName := fmt.Sprintf("Update snapshot %s", name)
|
||||
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
// Phase 2: Inside task lock - create fresh factory
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskCollection := taskCollectionFactory.SnapshotCollection()
|
||||
|
||||
// Fresh load after lock acquired
|
||||
snapshot, err = taskCollection.ByName(name)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
|
||||
// Fresh duplicate check inside lock
|
||||
if b.Name != "" {
|
||||
_, err := taskCollection.ByName(b.Name)
|
||||
if err == nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusConflict, Value: nil}, fmt.Errorf("unable to rename: snapshot %s already exists", b.Name)
|
||||
}
|
||||
}
|
||||
|
||||
// Update fresh copy
|
||||
if b.Name != "" {
|
||||
snapshot.Name = b.Name
|
||||
}
|
||||
@@ -341,7 +406,7 @@ func apiSnapshotsUpdate(c *gin.Context) {
|
||||
snapshot.Description = b.Description
|
||||
}
|
||||
|
||||
err = collectionFactory.SnapshotCollection().Update(snapshot)
|
||||
err = taskCollection.Update(snapshot)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
@@ -395,9 +460,9 @@ func apiSnapshotsDrop(c *gin.Context) {
|
||||
name := c.Params.ByName("name")
|
||||
force := c.Request.URL.Query().Get("force") == "1"
|
||||
|
||||
// Phase 1: Pre-task validation (shallow load for 404 check only)
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
snapshotCollection := collectionFactory.SnapshotCollection()
|
||||
publishedCollection := collectionFactory.PublishedRepoCollection()
|
||||
|
||||
snapshot, err := snapshotCollection.ByName(name)
|
||||
if err != nil {
|
||||
@@ -405,23 +470,37 @@ func apiSnapshotsDrop(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resources := []string{string(snapshot.ResourceKey())}
|
||||
resources := []string{string(snapshot.Key())}
|
||||
taskName := fmt.Sprintf("Delete snapshot %s", name)
|
||||
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
published := publishedCollection.BySnapshot(snapshot)
|
||||
// Phase 2: Inside task lock - create fresh collections
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskSnapshotCollection := taskCollectionFactory.SnapshotCollection()
|
||||
taskPublishedCollection := taskCollectionFactory.PublishedRepoCollection()
|
||||
|
||||
// Fresh load after lock acquired
|
||||
snapshot, err := taskSnapshotCollection.ByName(name)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
|
||||
// Fresh checks with current collections
|
||||
published := taskPublishedCollection.BySnapshot(snapshot)
|
||||
|
||||
if len(published) > 0 {
|
||||
return &task.ProcessReturnValue{Code: http.StatusConflict, Value: nil}, fmt.Errorf("unable to drop: snapshot is published")
|
||||
}
|
||||
|
||||
if !force {
|
||||
snapshots := snapshotCollection.BySnapshotSource(snapshot)
|
||||
// Using fresh collection for dependency check
|
||||
snapshots := taskSnapshotCollection.BySnapshotSource(snapshot)
|
||||
if len(snapshots) > 0 {
|
||||
return &task.ProcessReturnValue{Code: http.StatusConflict, Value: nil}, fmt.Errorf("won't delete snapshot that was used as source for other snapshots, use ?force=1 to override")
|
||||
}
|
||||
}
|
||||
|
||||
err = snapshotCollection.Drop(snapshot)
|
||||
err = taskSnapshotCollection.Drop(snapshot)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
@@ -576,6 +655,7 @@ func apiSnapshotsMerge(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// Phase 1: Pre-task validation (shallow load for 404 checks only)
|
||||
collectionFactory := context.NewCollectionFactory()
|
||||
snapshotCollection := collectionFactory.SnapshotCollection()
|
||||
|
||||
@@ -588,36 +668,47 @@ func apiSnapshotsMerge(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resources[i] = string(sources[i].ResourceKey())
|
||||
resources[i] = string(sources[i].Key())
|
||||
}
|
||||
|
||||
maybeRunTaskInBackground(c, "Merge snapshot "+name, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err = snapshotCollection.LoadComplete(sources[0])
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
result := sources[0].RefList()
|
||||
for i := 1; i < len(sources); i++ {
|
||||
err = snapshotCollection.LoadComplete(sources[i])
|
||||
// Phase 2: Inside task lock - create fresh factory
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
taskSnapshotCollection := taskCollectionFactory.SnapshotCollection()
|
||||
|
||||
// Fresh load of all sources inside task
|
||||
freshSources := make([]*deb.Snapshot, len(body.Sources))
|
||||
for i := range body.Sources {
|
||||
freshSources[i], err = taskSnapshotCollection.ByName(body.Sources[i])
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
result = result.Merge(sources[i].RefList(), overrideMatching, false)
|
||||
// LoadComplete on fresh copy
|
||||
err = taskSnapshotCollection.LoadComplete(freshSources[i])
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
}
|
||||
|
||||
// Merge using fresh sources
|
||||
result := freshSources[0].RefList()
|
||||
for i := 1; i < len(freshSources); i++ {
|
||||
result = result.Merge(freshSources[i].RefList(), overrideMatching, false)
|
||||
}
|
||||
|
||||
if latest {
|
||||
result.FilterLatestRefs()
|
||||
}
|
||||
|
||||
sourceDescription := make([]string, len(sources))
|
||||
for i, s := range sources {
|
||||
sourceDescription := make([]string, len(freshSources))
|
||||
for i, s := range freshSources {
|
||||
sourceDescription[i] = fmt.Sprintf("'%s'", s.Name)
|
||||
}
|
||||
|
||||
snapshot = deb.NewSnapshotFromRefList(name, sources, result,
|
||||
snapshot = deb.NewSnapshotFromRefList(name, freshSources, result,
|
||||
fmt.Sprintf("Merged from sources: %s", strings.Join(sourceDescription, ", ")))
|
||||
|
||||
err = collectionFactory.SnapshotCollection().Add(snapshot)
|
||||
err = taskCollectionFactory.SnapshotCollection().Add(snapshot)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to create snapshot: %s", err)
|
||||
}
|
||||
@@ -698,24 +789,32 @@ func apiSnapshotsPull(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
resources := []string{string(sourceSnapshot.ResourceKey()), string(toSnapshot.ResourceKey())}
|
||||
resources := []string{string(sourceSnapshot.Key()), string(toSnapshot.Key())}
|
||||
taskName := fmt.Sprintf("Pull snapshot %s into %s and save as %s", body.Source, name, body.Destination)
|
||||
maybeRunTaskInBackground(c, taskName, resources, func(_ aptly.Progress, _ *task.Detail) (*task.ProcessReturnValue, error) {
|
||||
err = collectionFactory.SnapshotCollection().LoadComplete(toSnapshot)
|
||||
// Phase 2: Inside task lock - create fresh factory
|
||||
taskCollectionFactory := context.NewCollectionFactory()
|
||||
|
||||
// Fresh load of snapshots after lock acquired
|
||||
freshToSnapshot, err := taskCollectionFactory.SnapshotCollection().ByName(name)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
err = collectionFactory.SnapshotCollection().LoadComplete(sourceSnapshot)
|
||||
freshSourceSnapshot, err := taskCollectionFactory.SnapshotCollection().ByName(body.Source)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
err = taskCollectionFactory.SnapshotCollection().LoadComplete(freshSourceSnapshot)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
|
||||
// convert snapshots to package list
|
||||
toPackageList, err := deb.NewPackageListFromRefList(toSnapshot.RefList(), collectionFactory.PackageCollection(), context.Progress())
|
||||
toPackageList, err := deb.NewPackageListFromRefList(freshToSnapshot.RefList(), taskCollectionFactory.PackageCollection(), context.Progress())
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
sourcePackageList, err := deb.NewPackageListFromRefList(sourceSnapshot.RefList(), collectionFactory.PackageCollection(), context.Progress())
|
||||
sourcePackageList, err := deb.NewPackageListFromRefList(freshSourceSnapshot.RefList(), taskCollectionFactory.PackageCollection(), context.Progress())
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
@@ -812,10 +911,10 @@ func apiSnapshotsPull(c *gin.Context) {
|
||||
}
|
||||
|
||||
// Create <destination> snapshot
|
||||
destinationSnapshot = deb.NewSnapshotFromPackageList(body.Destination, []*deb.Snapshot{toSnapshot, sourceSnapshot}, toPackageList,
|
||||
fmt.Sprintf("Pulled into '%s' with '%s' as source, pull request was: '%s'", toSnapshot.Name, sourceSnapshot.Name, strings.Join(body.Queries, ", ")))
|
||||
destinationSnapshot = deb.NewSnapshotFromPackageList(body.Destination, []*deb.Snapshot{freshToSnapshot, freshSourceSnapshot}, toPackageList,
|
||||
fmt.Sprintf("Pulled into '%s' with '%s' as source, pull request was: '%s'", freshToSnapshot.Name, freshSourceSnapshot.Name, strings.Join(body.Queries, ", ")))
|
||||
|
||||
err = collectionFactory.SnapshotCollection().Add(destinationSnapshot)
|
||||
err = taskCollectionFactory.SnapshotCollection().Add(destinationSnapshot)
|
||||
if err != nil {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, err
|
||||
}
|
||||
|
||||
+2
-2
@@ -95,8 +95,8 @@ type FileSystemPublishedStorage interface {
|
||||
|
||||
// PublishedStorageProvider is a thing that returns PublishedStorage by name
|
||||
type PublishedStorageProvider interface {
|
||||
// GetPublishedStorage returns PublishedStorage by name
|
||||
GetPublishedStorage(name string) PublishedStorage
|
||||
// GetPublishedStorage returns PublishedStorage by name, or an error if the storage is not configured
|
||||
GetPublishedStorage(name string) (PublishedStorage, error)
|
||||
}
|
||||
|
||||
// BarType used to differentiate between different progress bars
|
||||
|
||||
+46
-39
@@ -5,28 +5,35 @@ package azure
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-storage-blob-go/azblob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
)
|
||||
|
||||
func isBlobNotFound(err error) bool {
|
||||
storageError, ok := err.(azblob.StorageError)
|
||||
return ok && storageError.ServiceCode() == azblob.ServiceCodeBlobNotFound
|
||||
var respErr *azcore.ResponseError
|
||||
if errors.As(err, &respErr) {
|
||||
return respErr.StatusCode == 404 // BlobNotFound
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type azContext struct {
|
||||
container azblob.ContainerURL
|
||||
client *azblob.Client
|
||||
container string
|
||||
prefix string
|
||||
}
|
||||
|
||||
func newAzContext(accountName, accountKey, container, prefix, endpoint string) (*azContext, error) {
|
||||
credential, err := azblob.NewSharedKeyCredential(accountName, accountKey)
|
||||
cred, err := azblob.NewSharedKeyCredential(accountName, accountKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -35,15 +42,14 @@ func newAzContext(accountName, accountKey, container, prefix, endpoint string) (
|
||||
endpoint = fmt.Sprintf("https://%s.blob.core.windows.net", accountName)
|
||||
}
|
||||
|
||||
url, err := url.Parse(fmt.Sprintf("%s/%s", endpoint, container))
|
||||
serviceClient, err := azblob.NewClientWithSharedKeyCredential(endpoint, cred, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
containerURL := azblob.NewContainerURL(*url, azblob.NewPipeline(credential, azblob.PipelineOptions{}))
|
||||
|
||||
result := &azContext{
|
||||
container: containerURL,
|
||||
client: serviceClient,
|
||||
container: container,
|
||||
prefix: prefix,
|
||||
}
|
||||
|
||||
@@ -54,10 +60,6 @@ func (az *azContext) blobPath(path string) string {
|
||||
return filepath.Join(az.prefix, path)
|
||||
}
|
||||
|
||||
func (az *azContext) blobURL(path string) azblob.BlobURL {
|
||||
return az.container.NewBlobURL(az.blobPath(path))
|
||||
}
|
||||
|
||||
func (az *azContext) internalFilelist(prefix string, progress aptly.Progress) (paths []string, md5s []string, err error) {
|
||||
const delimiter = "/"
|
||||
paths = make([]string, 0, 1024)
|
||||
@@ -67,27 +69,33 @@ func (az *azContext) internalFilelist(prefix string, progress aptly.Progress) (p
|
||||
prefix += delimiter
|
||||
}
|
||||
|
||||
for marker := (azblob.Marker{}); marker.NotDone(); {
|
||||
listBlob, err := az.container.ListBlobsFlatSegment(
|
||||
context.Background(), marker, azblob.ListBlobsSegmentOptions{
|
||||
Prefix: prefix,
|
||||
MaxResults: 1,
|
||||
Details: azblob.BlobListingDetails{Metadata: true}})
|
||||
ctx := context.Background()
|
||||
maxResults := int32(1)
|
||||
pager := az.client.NewListBlobsFlatPager(az.container, &azblob.ListBlobsFlatOptions{
|
||||
Prefix: &prefix,
|
||||
MaxResults: &maxResults,
|
||||
Include: azblob.ListBlobsInclude{Metadata: true},
|
||||
})
|
||||
|
||||
// Iterate over each page
|
||||
for pager.More() {
|
||||
page, err := pager.NextPage(ctx)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("error listing under prefix %s in %s: %s", prefix, az, err)
|
||||
}
|
||||
|
||||
marker = listBlob.NextMarker
|
||||
|
||||
for _, blob := range listBlob.Segment.BlobItems {
|
||||
for _, blob := range page.Segment.BlobItems {
|
||||
if prefix == "" {
|
||||
paths = append(paths, blob.Name)
|
||||
paths = append(paths, *blob.Name)
|
||||
} else {
|
||||
paths = append(paths, blob.Name[len(prefix):])
|
||||
name := *blob.Name
|
||||
paths = append(paths, name[len(prefix):])
|
||||
}
|
||||
md5s = append(md5s, fmt.Sprintf("%x", blob.Properties.ContentMD5))
|
||||
}
|
||||
b := *blob
|
||||
md5 := b.Properties.ContentMD5
|
||||
md5s = append(md5s, fmt.Sprintf("%x", md5))
|
||||
|
||||
}
|
||||
if progress != nil {
|
||||
time.Sleep(time.Duration(500) * time.Millisecond)
|
||||
progress.AddBar(1)
|
||||
@@ -97,28 +105,27 @@ func (az *azContext) internalFilelist(prefix string, progress aptly.Progress) (p
|
||||
return paths, md5s, nil
|
||||
}
|
||||
|
||||
func (az *azContext) putFile(blob azblob.BlobURL, source io.Reader, sourceMD5 string) error {
|
||||
uploadOptions := azblob.UploadStreamToBlockBlobOptions{
|
||||
BufferSize: 4 * 1024 * 1024,
|
||||
MaxBuffers: 8,
|
||||
func (az *azContext) putFile(blobName string, source io.Reader, sourceMD5 string) error {
|
||||
uploadOptions := &azblob.UploadFileOptions{
|
||||
BlockSize: 4 * 1024 * 1024,
|
||||
Concurrency: 8,
|
||||
}
|
||||
|
||||
path := az.blobPath(blobName)
|
||||
if len(sourceMD5) > 0 {
|
||||
decodedMD5, err := hex.DecodeString(sourceMD5)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
uploadOptions.BlobHTTPHeaders = azblob.BlobHTTPHeaders{
|
||||
ContentMD5: decodedMD5,
|
||||
uploadOptions.HTTPHeaders = &blob.HTTPHeaders{
|
||||
BlobContentMD5: decodedMD5,
|
||||
}
|
||||
}
|
||||
|
||||
_, err := azblob.UploadStreamToBlockBlob(
|
||||
context.Background(),
|
||||
source,
|
||||
blob.ToBlockBlobURL(),
|
||||
uploadOptions,
|
||||
)
|
||||
var err error
|
||||
if file, ok := source.(*os.File); ok {
|
||||
_, err = az.client.UploadFile(context.TODO(), az.container, path, file, uploadOptions)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
+24
-27
@@ -5,7 +5,6 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/Azure/azure-storage-blob-go/azblob"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/pkg/errors"
|
||||
@@ -30,7 +29,7 @@ func NewPackagePool(accountName, accountKey, container, prefix, endpoint string)
|
||||
return &PackagePool{az: azctx}, nil
|
||||
}
|
||||
|
||||
// String
|
||||
// String returns the storage as string
|
||||
func (pool *PackagePool) String() string {
|
||||
return pool.az.String()
|
||||
}
|
||||
@@ -41,10 +40,7 @@ func (pool *PackagePool) buildPoolPath(filename string, checksums *utils.Checksu
|
||||
return filepath.Join(hash[0:2], hash[2:4], hash[4:32]+"_"+filename)
|
||||
}
|
||||
|
||||
func (pool *PackagePool) ensureChecksums(
|
||||
poolPath string,
|
||||
checksumStorage aptly.ChecksumStorage,
|
||||
) (*utils.ChecksumInfo, error) {
|
||||
func (pool *PackagePool) ensureChecksums(poolPath string, checksumStorage aptly.ChecksumStorage) (*utils.ChecksumInfo, error) {
|
||||
targetChecksums, err := checksumStorage.Get(poolPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -52,8 +48,7 @@ func (pool *PackagePool) ensureChecksums(
|
||||
|
||||
if targetChecksums == nil {
|
||||
// we don't have checksums stored yet for this file
|
||||
blob := pool.az.blobURL(poolPath)
|
||||
download, err := blob.Download(context.Background(), 0, 0, azblob.BlobAccessConditions{}, false, azblob.ClientProvidedKeyOptions{})
|
||||
download, err := pool.az.client.DownloadStream(context.Background(), pool.az.container, poolPath, nil)
|
||||
if err != nil {
|
||||
if isBlobNotFound(err) {
|
||||
return nil, nil
|
||||
@@ -63,7 +58,7 @@ func (pool *PackagePool) ensureChecksums(
|
||||
}
|
||||
|
||||
targetChecksums = &utils.ChecksumInfo{}
|
||||
*targetChecksums, err = utils.ChecksumsForReader(download.Body(azblob.RetryReaderOptions{}))
|
||||
*targetChecksums, err = utils.ChecksumsForReader(download.Body)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "error checksumming blob at %s", poolPath)
|
||||
}
|
||||
@@ -92,46 +87,49 @@ func (pool *PackagePool) LegacyPath(_ string, _ *utils.ChecksumInfo) (string, er
|
||||
}
|
||||
|
||||
func (pool *PackagePool) Size(path string) (int64, error) {
|
||||
blob := pool.az.blobURL(path)
|
||||
props, err := blob.GetProperties(context.Background(), azblob.BlobAccessConditions{}, azblob.ClientProvidedKeyOptions{})
|
||||
serviceClient := pool.az.client.ServiceClient()
|
||||
containerClient := serviceClient.NewContainerClient(pool.az.container)
|
||||
blobClient := containerClient.NewBlobClient(path)
|
||||
|
||||
props, err := blobClient.GetProperties(context.TODO(), nil)
|
||||
if err != nil {
|
||||
return 0, errors.Wrapf(err, "error examining %s from %s", path, pool)
|
||||
}
|
||||
|
||||
return props.ContentLength(), nil
|
||||
return *props.ContentLength, nil
|
||||
}
|
||||
|
||||
func (pool *PackagePool) Open(path string) (aptly.ReadSeekerCloser, error) {
|
||||
blob := pool.az.blobURL(path)
|
||||
|
||||
temp, err := os.CreateTemp("", "blob-download")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error creating temporary file for blob download")
|
||||
return nil, errors.Wrapf(err, "error creating tempfile for %s", path)
|
||||
}
|
||||
defer func() { _ = os.Remove(temp.Name()) }()
|
||||
|
||||
defer os.Remove(temp.Name())
|
||||
|
||||
err = azblob.DownloadBlobToFile(context.Background(), blob, 0, 0, temp, azblob.DownloadFromBlobOptions{})
|
||||
_, err = pool.az.client.DownloadFile(context.TODO(), pool.az.container, path, temp, nil)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "error downloading blob at %s", path)
|
||||
return nil, errors.Wrapf(err, "error downloading blob %s", path)
|
||||
}
|
||||
|
||||
return temp, nil
|
||||
}
|
||||
|
||||
func (pool *PackagePool) Remove(path string) (int64, error) {
|
||||
blob := pool.az.blobURL(path)
|
||||
props, err := blob.GetProperties(context.Background(), azblob.BlobAccessConditions{}, azblob.ClientProvidedKeyOptions{})
|
||||
serviceClient := pool.az.client.ServiceClient()
|
||||
containerClient := serviceClient.NewContainerClient(pool.az.container)
|
||||
blobClient := containerClient.NewBlobClient(path)
|
||||
|
||||
props, err := blobClient.GetProperties(context.TODO(), nil)
|
||||
if err != nil {
|
||||
return 0, errors.Wrapf(err, "error getting props of %s from %s", path, pool)
|
||||
return 0, errors.Wrapf(err, "error examining %s from %s", path, pool)
|
||||
}
|
||||
|
||||
_, err = blob.Delete(context.Background(), azblob.DeleteSnapshotsOptionNone, azblob.BlobAccessConditions{})
|
||||
_, err = pool.az.client.DeleteBlob(context.Background(), pool.az.container, path, nil)
|
||||
if err != nil {
|
||||
return 0, errors.Wrapf(err, "error deleting %s from %s", path, pool)
|
||||
}
|
||||
|
||||
return props.ContentLength(), nil
|
||||
return *props.ContentLength, nil
|
||||
}
|
||||
|
||||
func (pool *PackagePool) Import(srcPath, basename string, checksums *utils.ChecksumInfo, _ bool, checksumStorage aptly.ChecksumStorage) (string, error) {
|
||||
@@ -145,7 +143,6 @@ func (pool *PackagePool) Import(srcPath, basename string, checksums *utils.Check
|
||||
}
|
||||
|
||||
path := pool.buildPoolPath(basename, checksums)
|
||||
blob := pool.az.blobURL(path)
|
||||
targetChecksums, err := pool.ensureChecksums(path, checksumStorage)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -159,9 +156,9 @@ func (pool *PackagePool) Import(srcPath, basename string, checksums *utils.Check
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer source.Close()
|
||||
defer func() { _ = source.Close() }()
|
||||
|
||||
err = pool.az.putFile(blob, source, checksums.MD5)
|
||||
err = pool.az.putFile(path, source, checksums.MD5)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -2,12 +2,12 @@ package azure
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"github.com/Azure/azure-storage-blob-go/azblob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/files"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
@@ -50,8 +50,10 @@ func (s *PackagePoolSuite) SetUpTest(c *C) {
|
||||
|
||||
s.pool, err = NewPackagePool(s.accountName, s.accountKey, container, "", s.endpoint)
|
||||
c.Assert(err, IsNil)
|
||||
cnt := s.pool.az.container
|
||||
_, err = cnt.Create(context.Background(), azblob.Metadata{}, azblob.PublicAccessContainer)
|
||||
publicAccessType := azblob.PublicAccessTypeContainer
|
||||
_, err = s.pool.az.client.CreateContainer(context.TODO(), s.pool.az.container, &azblob.CreateContainerOptions{
|
||||
Access: &publicAccessType,
|
||||
})
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
s.prefixedPool, err = NewPackagePool(s.accountName, s.accountKey, container, prefix, s.endpoint)
|
||||
@@ -67,8 +69,8 @@ func (s *PackagePoolSuite) TestFilepathList(c *C) {
|
||||
c.Check(err, IsNil)
|
||||
c.Check(list, DeepEquals, []string{})
|
||||
|
||||
s.pool.Import(s.debFile, "a.deb", &utils.ChecksumInfo{}, false, s.cs)
|
||||
s.pool.Import(s.debFile, "b.deb", &utils.ChecksumInfo{}, false, s.cs)
|
||||
_, _ = s.pool.Import(s.debFile, "a.deb", &utils.ChecksumInfo{}, false, s.cs)
|
||||
_, _ = s.pool.Import(s.debFile, "b.deb", &utils.ChecksumInfo{}, false, s.cs)
|
||||
|
||||
list, err = s.pool.FilepathList(nil)
|
||||
c.Check(err, IsNil)
|
||||
@@ -79,8 +81,8 @@ func (s *PackagePoolSuite) TestFilepathList(c *C) {
|
||||
}
|
||||
|
||||
func (s *PackagePoolSuite) TestRemove(c *C) {
|
||||
s.pool.Import(s.debFile, "a.deb", &utils.ChecksumInfo{}, false, s.cs)
|
||||
s.pool.Import(s.debFile, "b.deb", &utils.ChecksumInfo{}, false, s.cs)
|
||||
_, _ = s.pool.Import(s.debFile, "a.deb", &utils.ChecksumInfo{}, false, s.cs)
|
||||
_, _ = s.pool.Import(s.debFile, "b.deb", &utils.ChecksumInfo{}, false, s.cs)
|
||||
|
||||
size, err := s.pool.Remove("c7/6b/4bd12fd92e4dfe1b55b18a67a669_a.deb")
|
||||
c.Check(err, IsNil)
|
||||
@@ -245,7 +247,7 @@ func (s *PackagePoolSuite) TestOpen(c *C) {
|
||||
|
||||
f, err := s.pool.Open(path)
|
||||
c.Assert(err, IsNil)
|
||||
contents, err := ioutil.ReadAll(f)
|
||||
contents, err := io.ReadAll(f)
|
||||
c.Assert(err, IsNil)
|
||||
c.Check(len(contents), Equals, 2738)
|
||||
c.Check(f.Close(), IsNil)
|
||||
|
||||
+73
-62
@@ -3,21 +3,22 @@ package azure
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"github.com/Azure/azure-storage-blob-go/azblob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/lease"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/google/uuid"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// PublishedStorage abstract file system with published files (actually hosted on Azure)
|
||||
type PublishedStorage struct {
|
||||
container azblob.ContainerURL
|
||||
prefix string
|
||||
// FIXME: unused ???? prefix string
|
||||
az *azContext
|
||||
pathCache map[string]map[string]string
|
||||
}
|
||||
@@ -37,7 +38,7 @@ func NewPublishedStorage(accountName, accountKey, container, prefix, endpoint st
|
||||
return &PublishedStorage{az: azctx}, nil
|
||||
}
|
||||
|
||||
// String
|
||||
// String returns the storage as string
|
||||
func (storage *PublishedStorage) String() string {
|
||||
return storage.az.String()
|
||||
}
|
||||
@@ -64,9 +65,9 @@ func (storage *PublishedStorage) PutFile(path string, sourceFilename string) err
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer source.Close()
|
||||
defer func() { _ = source.Close() }()
|
||||
|
||||
err = storage.az.putFile(storage.az.blobURL(path), source, sourceMD5)
|
||||
err = storage.az.putFile(path, source, sourceMD5)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, fmt.Sprintf("error uploading %s to %s", sourceFilename, storage))
|
||||
}
|
||||
@@ -76,14 +77,15 @@ func (storage *PublishedStorage) PutFile(path string, sourceFilename string) err
|
||||
|
||||
// RemoveDirs removes directory structure under public path
|
||||
func (storage *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error {
|
||||
path = storage.az.blobPath(path)
|
||||
filelist, err := storage.Filelist(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, filename := range filelist {
|
||||
blob := storage.az.blobURL(filepath.Join(path, filename))
|
||||
_, err := blob.Delete(context.Background(), azblob.DeleteSnapshotsOptionNone, azblob.BlobAccessConditions{})
|
||||
blob := filepath.Join(path, filename)
|
||||
_, err := storage.az.client.DeleteBlob(context.Background(), storage.az.container, blob, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error deleting path %s from %s: %s", filename, storage, err)
|
||||
}
|
||||
@@ -94,8 +96,8 @@ func (storage *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error
|
||||
|
||||
// Remove removes single file under public path
|
||||
func (storage *PublishedStorage) Remove(path string) error {
|
||||
blob := storage.az.blobURL(path)
|
||||
_, err := blob.Delete(context.Background(), azblob.DeleteSnapshotsOptionNone, azblob.BlobAccessConditions{})
|
||||
path = storage.az.blobPath(path)
|
||||
_, err := storage.az.client.DeleteBlob(context.Background(), storage.az.container, path, nil)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, fmt.Sprintf("error deleting %s from %s: %s", path, storage, err))
|
||||
}
|
||||
@@ -114,9 +116,8 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
|
||||
sourcePath string, sourceChecksums utils.ChecksumInfo, force bool) error {
|
||||
|
||||
relFilePath := filepath.Join(publishedRelPath, fileName)
|
||||
// prefixRelFilePath := filepath.Join(publishedPrefix, relFilePath)
|
||||
// FIXME: check how to integrate publishedPrefix:
|
||||
poolPath := storage.az.blobPath(fileName)
|
||||
prefixRelFilePath := filepath.Join(publishedPrefix, relFilePath)
|
||||
poolPath := storage.az.blobPath(prefixRelFilePath)
|
||||
|
||||
if storage.pathCache == nil {
|
||||
storage.pathCache = make(map[string]map[string]string)
|
||||
@@ -157,9 +158,9 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer source.Close()
|
||||
defer func() { _ = source.Close() }()
|
||||
|
||||
err = storage.az.putFile(storage.az.blobURL(relFilePath), source, sourceMD5)
|
||||
err = storage.az.putFile(relFilePath, source, sourceMD5)
|
||||
if err == nil {
|
||||
pathCache[relFilePath] = sourceMD5
|
||||
} else {
|
||||
@@ -176,57 +177,60 @@ func (storage *PublishedStorage) Filelist(prefix string) ([]string, error) {
|
||||
}
|
||||
|
||||
// Internal copy or move implementation
|
||||
func (storage *PublishedStorage) internalCopyOrMoveBlob(src, dst string, metadata azblob.Metadata, move bool) error {
|
||||
func (storage *PublishedStorage) internalCopyOrMoveBlob(src, dst string, metadata map[string]*string, move bool) error {
|
||||
const leaseDuration = 30
|
||||
leaseID := uuid.NewString()
|
||||
|
||||
dstBlobURL := storage.az.blobURL(dst)
|
||||
srcBlobURL := storage.az.blobURL(src)
|
||||
leaseResp, err := srcBlobURL.AcquireLease(context.Background(), "", leaseDuration, azblob.ModifiedAccessConditions{})
|
||||
if err != nil || leaseResp.StatusCode() != http.StatusCreated {
|
||||
return fmt.Errorf("error acquiring lease on source blob %s", srcBlobURL)
|
||||
serviceClient := storage.az.client.ServiceClient()
|
||||
containerClient := serviceClient.NewContainerClient(storage.az.container)
|
||||
srcBlobClient := containerClient.NewBlobClient(src)
|
||||
blobLeaseClient, err := lease.NewBlobClient(srcBlobClient, &lease.BlobClientOptions{LeaseID: to.Ptr(leaseID)})
|
||||
if err != nil {
|
||||
return fmt.Errorf("error acquiring lease on source blob %s", src)
|
||||
}
|
||||
defer srcBlobURL.BreakLease(context.Background(), azblob.LeaseBreakNaturally, azblob.ModifiedAccessConditions{})
|
||||
srcBlobLeaseID := leaseResp.LeaseID()
|
||||
|
||||
copyResp, err := dstBlobURL.StartCopyFromURL(
|
||||
context.Background(),
|
||||
srcBlobURL.URL(),
|
||||
metadata,
|
||||
azblob.ModifiedAccessConditions{},
|
||||
azblob.BlobAccessConditions{},
|
||||
azblob.DefaultAccessTier,
|
||||
nil)
|
||||
_, err = blobLeaseClient.AcquireLease(context.Background(), leaseDuration, nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error acquiring lease on source blob %s", src)
|
||||
}
|
||||
defer func() {
|
||||
_, _ = blobLeaseClient.BreakLease(context.Background(), &lease.BlobBreakOptions{BreakPeriod: to.Ptr(int32(60))})
|
||||
}()
|
||||
|
||||
dstBlobClient := containerClient.NewBlobClient(dst)
|
||||
copyResp, err := dstBlobClient.StartCopyFromURL(context.Background(), srcBlobClient.URL(), &blob.StartCopyFromURLOptions{
|
||||
Metadata: metadata,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return fmt.Errorf("error copying %s -> %s in %s: %s", src, dst, storage, err)
|
||||
}
|
||||
|
||||
copyStatus := copyResp.CopyStatus()
|
||||
copyStatus := *copyResp.CopyStatus
|
||||
for {
|
||||
if copyStatus == azblob.CopyStatusSuccess {
|
||||
if copyStatus == blob.CopyStatusTypeSuccess {
|
||||
if move {
|
||||
_, err = srcBlobURL.Delete(
|
||||
context.Background(),
|
||||
azblob.DeleteSnapshotsOptionNone,
|
||||
azblob.BlobAccessConditions{
|
||||
LeaseAccessConditions: azblob.LeaseAccessConditions{LeaseID: srcBlobLeaseID},
|
||||
})
|
||||
_, err := storage.az.client.DeleteBlob(context.Background(), storage.az.container, src, &blob.DeleteOptions{
|
||||
AccessConditions: &blob.AccessConditions{
|
||||
LeaseAccessConditions: &blob.LeaseAccessConditions{
|
||||
LeaseID: &leaseID,
|
||||
},
|
||||
},
|
||||
})
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
} else if copyStatus == azblob.CopyStatusPending {
|
||||
} else if copyStatus == blob.CopyStatusTypePending {
|
||||
time.Sleep(1 * time.Second)
|
||||
blobPropsResp, err := dstBlobURL.GetProperties(
|
||||
context.Background(),
|
||||
azblob.BlobAccessConditions{LeaseAccessConditions: azblob.LeaseAccessConditions{LeaseID: srcBlobLeaseID}},
|
||||
azblob.ClientProvidedKeyOptions{})
|
||||
getMetadata, err := dstBlobClient.GetProperties(context.TODO(), nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error getting destination blob properties %s", dstBlobURL)
|
||||
return fmt.Errorf("error getting copy progress %s", dst)
|
||||
}
|
||||
copyStatus = blobPropsResp.CopyStatus()
|
||||
copyStatus = *getMetadata.CopyStatus
|
||||
|
||||
_, err = srcBlobURL.RenewLease(context.Background(), srcBlobLeaseID, azblob.ModifiedAccessConditions{})
|
||||
_, err = blobLeaseClient.RenewLease(context.Background(), nil)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error renewing source blob lease %s", srcBlobURL)
|
||||
return fmt.Errorf("error renewing source blob lease %s", src)
|
||||
}
|
||||
} else {
|
||||
return fmt.Errorf("error copying %s -> %s in %s: %s", dst, src, storage, copyStatus)
|
||||
@@ -241,7 +245,9 @@ func (storage *PublishedStorage) RenameFile(oldName, newName string) error {
|
||||
|
||||
// SymLink creates a copy of src file and adds link information as meta data
|
||||
func (storage *PublishedStorage) SymLink(src string, dst string) error {
|
||||
return storage.internalCopyOrMoveBlob(src, dst, azblob.Metadata{"SymLink": src}, false /* move */)
|
||||
metadata := make(map[string]*string)
|
||||
metadata["SymLink"] = &src
|
||||
return storage.internalCopyOrMoveBlob(src, dst, metadata, false /* do not remove src */)
|
||||
}
|
||||
|
||||
// HardLink using symlink functionality as hard links do not exist
|
||||
@@ -251,28 +257,33 @@ func (storage *PublishedStorage) HardLink(src string, dst string) error {
|
||||
|
||||
// FileExists returns true if path exists
|
||||
func (storage *PublishedStorage) FileExists(path string) (bool, error) {
|
||||
blob := storage.az.blobURL(path)
|
||||
resp, err := blob.GetProperties(context.Background(), azblob.BlobAccessConditions{}, azblob.ClientProvidedKeyOptions{})
|
||||
serviceClient := storage.az.client.ServiceClient()
|
||||
containerClient := serviceClient.NewContainerClient(storage.az.container)
|
||||
blobClient := containerClient.NewBlobClient(path)
|
||||
_, err := blobClient.GetProperties(context.Background(), nil)
|
||||
if err != nil {
|
||||
if isBlobNotFound(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
} else if resp.StatusCode() == http.StatusOK {
|
||||
return true, nil
|
||||
return false, fmt.Errorf("error checking if blob %s exists: %v", path, err)
|
||||
}
|
||||
return false, fmt.Errorf("error checking if blob %s exists %d", blob, resp.StatusCode())
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// ReadLink returns the symbolic link pointed to by path.
|
||||
// This simply reads text file created with SymLink
|
||||
func (storage *PublishedStorage) ReadLink(path string) (string, error) {
|
||||
blob := storage.az.blobURL(path)
|
||||
resp, err := blob.GetProperties(context.Background(), azblob.BlobAccessConditions{}, azblob.ClientProvidedKeyOptions{})
|
||||
serviceClient := storage.az.client.ServiceClient()
|
||||
containerClient := serviceClient.NewContainerClient(storage.az.container)
|
||||
blobClient := containerClient.NewBlobClient(path)
|
||||
props, err := blobClient.GetProperties(context.Background(), nil)
|
||||
if err != nil {
|
||||
return "", err
|
||||
} else if resp.StatusCode() != http.StatusOK {
|
||||
return "", fmt.Errorf("error checking if blob %s exists %d", blob, resp.StatusCode())
|
||||
return "", fmt.Errorf("failed to get blob properties: %v", err)
|
||||
}
|
||||
return resp.NewMetadata()["SymLink"], nil
|
||||
|
||||
metadata := props.Metadata
|
||||
if originalBlob, exists := metadata["original_blob"]; exists {
|
||||
return *originalBlob, nil
|
||||
}
|
||||
return "", fmt.Errorf("error reading link %s: %v", path, err)
|
||||
}
|
||||
|
||||
+35
-32
@@ -1,14 +1,17 @@
|
||||
package azure
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/md5"
|
||||
"crypto/rand"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/Azure/azure-storage-blob-go/azblob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob"
|
||||
"github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/blob"
|
||||
"github.com/aptly-dev/aptly/files"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
. "gopkg.in/check.v1"
|
||||
@@ -33,7 +36,7 @@ func randString(n int) string {
|
||||
}
|
||||
const alphanum = "0123456789abcdefghijklmnopqrstuvwxyz"
|
||||
var bytes = make([]byte, n)
|
||||
rand.Read(bytes)
|
||||
_, _ = rand.Read(bytes)
|
||||
for i, b := range bytes {
|
||||
bytes[i] = alphanum[b%byte(len(alphanum))]
|
||||
}
|
||||
@@ -66,8 +69,10 @@ func (s *PublishedStorageSuite) SetUpTest(c *C) {
|
||||
|
||||
s.storage, err = NewPublishedStorage(s.accountName, s.accountKey, container, "", s.endpoint)
|
||||
c.Assert(err, IsNil)
|
||||
cnt := s.storage.az.container
|
||||
_, err = cnt.Create(context.Background(), azblob.Metadata{}, azblob.PublicAccessContainer)
|
||||
publicAccessType := azblob.PublicAccessTypeContainer
|
||||
_, err = s.storage.az.client.CreateContainer(context.Background(), s.storage.az.container, &azblob.CreateContainerOptions{
|
||||
Access: &publicAccessType,
|
||||
})
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
s.prefixedStorage, err = NewPublishedStorage(s.accountName, s.accountKey, container, prefix, s.endpoint)
|
||||
@@ -75,41 +80,39 @@ func (s *PublishedStorageSuite) SetUpTest(c *C) {
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TearDownTest(c *C) {
|
||||
cnt := s.storage.az.container
|
||||
_, err := cnt.Delete(context.Background(), azblob.ContainerAccessConditions{})
|
||||
_, err := s.storage.az.client.DeleteContainer(context.Background(), s.storage.az.container, nil)
|
||||
c.Assert(err, IsNil)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) GetFile(c *C, path string) []byte {
|
||||
blob := s.storage.az.container.NewBlobURL(path)
|
||||
resp, err := blob.Download(context.Background(), 0, azblob.CountToEnd, azblob.BlobAccessConditions{}, false, azblob.ClientProvidedKeyOptions{})
|
||||
resp, err := s.storage.az.client.DownloadStream(context.Background(), s.storage.az.container, path, nil)
|
||||
c.Assert(err, IsNil)
|
||||
body := resp.Body(azblob.RetryReaderOptions{MaxRetryRequests: 3})
|
||||
data, err := ioutil.ReadAll(body)
|
||||
data, err := io.ReadAll(resp.Body)
|
||||
c.Assert(err, IsNil)
|
||||
return data
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) AssertNoFile(c *C, path string) {
|
||||
_, err := s.storage.az.container.NewBlobURL(path).GetProperties(
|
||||
context.Background(), azblob.BlobAccessConditions{}, azblob.ClientProvidedKeyOptions{})
|
||||
serviceClient := s.storage.az.client.ServiceClient()
|
||||
containerClient := serviceClient.NewContainerClient(s.storage.az.container)
|
||||
blobClient := containerClient.NewBlobClient(path)
|
||||
_, err := blobClient.GetProperties(context.Background(), nil)
|
||||
c.Assert(err, NotNil)
|
||||
storageError, ok := err.(azblob.StorageError)
|
||||
|
||||
storageError, ok := err.(*azcore.ResponseError)
|
||||
c.Assert(ok, Equals, true)
|
||||
c.Assert(string(storageError.ServiceCode()), Equals, string(string(azblob.StorageErrorCodeBlobNotFound)))
|
||||
c.Assert(storageError.StatusCode, Equals, 404)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) PutFile(c *C, path string, data []byte) {
|
||||
hash := md5.Sum(data)
|
||||
_, err := azblob.UploadBufferToBlockBlob(
|
||||
context.Background(),
|
||||
data,
|
||||
s.storage.az.container.NewBlockBlobURL(path),
|
||||
azblob.UploadToBlockBlobOptions{
|
||||
BlobHTTPHeaders: azblob.BlobHTTPHeaders{
|
||||
ContentMD5: hash[:],
|
||||
},
|
||||
})
|
||||
uploadOptions := &azblob.UploadStreamOptions{
|
||||
HTTPHeaders: &blob.HTTPHeaders{
|
||||
BlobContentMD5: hash[:],
|
||||
},
|
||||
}
|
||||
reader := bytes.NewReader(data)
|
||||
_, err := s.storage.az.client.UploadStream(context.Background(), s.storage.az.container, path, reader, uploadOptions)
|
||||
c.Assert(err, IsNil)
|
||||
}
|
||||
|
||||
@@ -118,7 +121,7 @@ func (s *PublishedStorageSuite) TestPutFile(c *C) {
|
||||
filename := "a/b.txt"
|
||||
|
||||
dir := c.MkDir()
|
||||
err := ioutil.WriteFile(filepath.Join(dir, "a"), content, 0644)
|
||||
err := os.WriteFile(filepath.Join(dir, "a"), content, 0644)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
err = s.storage.PutFile(filename, filepath.Join(dir, "a"))
|
||||
@@ -137,7 +140,7 @@ func (s *PublishedStorageSuite) TestPutFilePlus(c *C) {
|
||||
filename := "a/b+c.txt"
|
||||
|
||||
dir := c.MkDir()
|
||||
err := ioutil.WriteFile(filepath.Join(dir, "a"), content, 0644)
|
||||
err := os.WriteFile(filepath.Join(dir, "a"), content, 0644)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
err = s.storage.PutFile(filename, filepath.Join(dir, "a"))
|
||||
@@ -255,7 +258,7 @@ func (s *PublishedStorageSuite) TestRemoveDirsPlus(c *C) {
|
||||
|
||||
func (s *PublishedStorageSuite) TestRenameFile(c *C) {
|
||||
dir := c.MkDir()
|
||||
err := ioutil.WriteFile(filepath.Join(dir, "a"), []byte("Welcome to Azure!"), 0644)
|
||||
err := os.WriteFile(filepath.Join(dir, "a"), []byte("Welcome to Azure!"), 0644)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
err = s.storage.PutFile("source.txt", filepath.Join(dir, "a"))
|
||||
@@ -277,18 +280,18 @@ func (s *PublishedStorageSuite) TestLinkFromPool(c *C) {
|
||||
cs := files.NewMockChecksumStorage()
|
||||
|
||||
tmpFile1 := filepath.Join(c.MkDir(), "mars-invaders_1.03.deb")
|
||||
err := ioutil.WriteFile(tmpFile1, []byte("Contents"), 0644)
|
||||
err := os.WriteFile(tmpFile1, []byte("Contents"), 0644)
|
||||
c.Assert(err, IsNil)
|
||||
cksum1 := utils.ChecksumInfo{MD5: "c1df1da7a1ce305a3b60af9d5733ac1d"}
|
||||
|
||||
tmpFile2 := filepath.Join(c.MkDir(), "mars-invaders_1.03.deb")
|
||||
err = ioutil.WriteFile(tmpFile2, []byte("Spam"), 0644)
|
||||
err = os.WriteFile(tmpFile2, []byte("Spam"), 0644)
|
||||
c.Assert(err, IsNil)
|
||||
cksum2 := utils.ChecksumInfo{MD5: "e9dfd31cc505d51fc26975250750deab"}
|
||||
|
||||
tmpFile3 := filepath.Join(c.MkDir(), "netboot/boot.img.gz")
|
||||
os.MkdirAll(filepath.Dir(tmpFile3), 0777)
|
||||
err = ioutil.WriteFile(tmpFile3, []byte("Contents"), 0644)
|
||||
_ = os.MkdirAll(filepath.Dir(tmpFile3), 0777)
|
||||
err = os.WriteFile(tmpFile3, []byte("Contents"), 0644)
|
||||
c.Assert(err, IsNil)
|
||||
cksum3 := utils.ChecksumInfo{MD5: "c1df1da7a1ce305a3b60af9d5733ac1d"}
|
||||
|
||||
@@ -330,7 +333,7 @@ func (s *PublishedStorageSuite) TestLinkFromPool(c *C) {
|
||||
|
||||
// 2nd link from pool, providing wrong path for source file
|
||||
//
|
||||
// this test should check that file already exists in S3 and skip upload (which would fail if not skipped)
|
||||
// this test should check that file already exists in Azure and skip upload (which would fail if not skipped)
|
||||
s.prefixedStorage.pathCache = nil
|
||||
err = s.prefixedStorage.LinkFromPool("", filepath.Join("pool", "main", "m/mars-invaders"), "mars-invaders_1.03.deb", pool, "wrong-looks-like-pathcache-doesnt-work", cksum1, false)
|
||||
c.Check(err, IsNil)
|
||||
|
||||
@@ -198,9 +198,11 @@ func aptlyPublishSnapshotOrRepo(cmd *commander.Command, args []string) error {
|
||||
|
||||
context.Progress().Printf("\n%s been successfully published.\n", message)
|
||||
|
||||
if localStorage, ok := context.GetPublishedStorage(storage).(aptly.FileSystemPublishedStorage); ok {
|
||||
context.Progress().Printf("Please setup your webserver to serve directory '%s' with autoindexing.\n",
|
||||
localStorage.PublicPath())
|
||||
if ps, err := context.GetPublishedStorage(storage); err == nil {
|
||||
if localStorage, ok := ps.(aptly.FileSystemPublishedStorage); ok {
|
||||
context.Progress().Printf("Please setup your webserver to serve directory '%s' with autoindexing.\n",
|
||||
localStorage.PublicPath())
|
||||
}
|
||||
}
|
||||
|
||||
context.Progress().Printf("Now you can add following line to apt sources:\n")
|
||||
|
||||
+5
-1
@@ -97,7 +97,11 @@ func aptlyServe(cmd *commander.Command, args []string) error {
|
||||
}
|
||||
}
|
||||
|
||||
publicPath := context.GetPublishedStorage("").(aptly.FileSystemPublishedStorage).PublicPath()
|
||||
ps, err := context.GetPublishedStorage("")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
publicPath := ps.(aptly.FileSystemPublishedStorage).PublicPath()
|
||||
ShutdownContext()
|
||||
|
||||
fmt.Printf("\nStarting web server at: %s (press Ctrl+C to quit)...\n", listen)
|
||||
|
||||
+45
-13
@@ -23,7 +23,9 @@ import (
|
||||
"github.com/aptly-dev/aptly/database/goleveldb"
|
||||
"github.com/aptly-dev/aptly/deb"
|
||||
"github.com/aptly-dev/aptly/files"
|
||||
"github.com/aptly-dev/aptly/gcs"
|
||||
"github.com/aptly-dev/aptly/http"
|
||||
"github.com/aptly-dev/aptly/jfrog"
|
||||
"github.com/aptly-dev/aptly/pgp"
|
||||
"github.com/aptly-dev/aptly/s3"
|
||||
"github.com/aptly-dev/aptly/swift"
|
||||
@@ -100,7 +102,6 @@ func (context *AptlyContext) config() *utils.ConfigStructure {
|
||||
configLocations := []string{homeLocation, "/usr/local/etc/aptly.conf", "/etc/aptly.conf"}
|
||||
|
||||
for _, configLocation := range configLocations {
|
||||
// FIXME: check if exists, check if readable
|
||||
err = utils.LoadConfig(configLocation, &utils.Config)
|
||||
if os.IsPermission(err) || os.IsNotExist(err) {
|
||||
continue
|
||||
@@ -116,7 +117,12 @@ func (context *AptlyContext) config() *utils.ConfigStructure {
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "Config file not found, creating default config at %s\n\n", homeLocation)
|
||||
|
||||
_ = utils.SaveConfigRaw(homeLocation, aptly.AptlyConf)
|
||||
defaultConfig := aptly.AptlyConf
|
||||
if len(defaultConfig) == 0 {
|
||||
defaultConfig = []byte("root_dir: \"\"")
|
||||
}
|
||||
|
||||
_ = utils.SaveConfigRaw(homeLocation, defaultConfig)
|
||||
err = utils.LoadConfig(homeLocation, &utils.Config)
|
||||
if err != nil {
|
||||
Fatal(fmt.Errorf("error loading config file %s: %s", homeLocation, err))
|
||||
@@ -407,8 +413,8 @@ func (context *AptlyContext) PackagePool() aptly.PackagePool {
|
||||
return context.packagePool
|
||||
}
|
||||
|
||||
// GetPublishedStorage returns instance of PublishedStorage
|
||||
func (context *AptlyContext) GetPublishedStorage(name string) aptly.PublishedStorage {
|
||||
// GetPublishedStorage returns instance of PublishedStorage, or an error if the storage is not configured
|
||||
func (context *AptlyContext) GetPublishedStorage(name string) (aptly.PublishedStorage, error) {
|
||||
context.Lock()
|
||||
defer context.Unlock()
|
||||
|
||||
@@ -419,14 +425,14 @@ func (context *AptlyContext) GetPublishedStorage(name string) aptly.PublishedSto
|
||||
} else if strings.HasPrefix(name, "filesystem:") {
|
||||
params, ok := context.config().FileSystemPublishRoots[name[11:]]
|
||||
if !ok {
|
||||
Fatal(fmt.Errorf("published local storage %v not configured", name[11:]))
|
||||
return nil, fmt.Errorf("published local storage %v not configured", name[11:])
|
||||
}
|
||||
|
||||
publishedStorage = files.NewPublishedStorage(params.RootDir, params.LinkMethod, params.VerifyMethod)
|
||||
} else if strings.HasPrefix(name, "s3:") {
|
||||
params, ok := context.config().S3PublishRoots[name[3:]]
|
||||
if !ok {
|
||||
Fatal(fmt.Errorf("published S3 storage %v not configured", name[3:]))
|
||||
return nil, fmt.Errorf("published S3 storage %v not configured", name[3:])
|
||||
}
|
||||
|
||||
var err error
|
||||
@@ -436,39 +442,65 @@ func (context *AptlyContext) GetPublishedStorage(name string) aptly.PublishedSto
|
||||
params.EncryptionMethod, params.PlusWorkaround, params.DisableMultiDel,
|
||||
params.ForceSigV2, params.ForceVirtualHostedStyle, params.Debug)
|
||||
if err != nil {
|
||||
Fatal(err)
|
||||
return nil, err
|
||||
}
|
||||
} else if strings.HasPrefix(name, "gcs:") {
|
||||
params, ok := context.config().GCSPublishRoots[name[4:]]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("published GCS storage %v not configured", name[4:])
|
||||
}
|
||||
|
||||
var err error
|
||||
publishedStorage, err = gcs.NewPublishedStorage(
|
||||
params.Bucket, params.Prefix, params.CredentialsFile, params.ServiceAccountJSON,
|
||||
params.Project, params.Endpoint, params.ACL, params.StorageClass, params.EncryptionKey,
|
||||
params.DisableMultiDel, params.Debug)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
} else if strings.HasPrefix(name, "swift:") {
|
||||
params, ok := context.config().SwiftPublishRoots[name[6:]]
|
||||
if !ok {
|
||||
Fatal(fmt.Errorf("published Swift storage %v not configured", name[6:]))
|
||||
return nil, fmt.Errorf("published Swift storage %v not configured", name[6:])
|
||||
}
|
||||
|
||||
var err error
|
||||
publishedStorage, err = swift.NewPublishedStorage(params.UserName, params.Password,
|
||||
params.AuthURL, params.Tenant, params.TenantID, params.Domain, params.DomainID, params.TenantDomain, params.TenantDomainID, params.Container, params.Prefix)
|
||||
if err != nil {
|
||||
Fatal(err)
|
||||
return nil, err
|
||||
}
|
||||
} else if strings.HasPrefix(name, "azure:") {
|
||||
params, ok := context.config().AzurePublishRoots[name[6:]]
|
||||
if !ok {
|
||||
Fatal(fmt.Errorf("published Azure storage %v not configured", name[6:]))
|
||||
return nil, fmt.Errorf("published Azure storage %v not configured", name[6:])
|
||||
}
|
||||
|
||||
var err error
|
||||
publishedStorage, err = azure.NewPublishedStorage(
|
||||
params.AccountName, params.AccountKey, params.Container, params.Prefix, params.Endpoint)
|
||||
if err != nil {
|
||||
Fatal(err)
|
||||
return nil, err
|
||||
}
|
||||
} else if strings.HasPrefix(name, "jfrog:") {
|
||||
params, ok := context.config().JFrogPublishRoots[name[6:]]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("published JFrog storage %v not configured", name[6:])
|
||||
}
|
||||
|
||||
var err error
|
||||
publishedStorage, err = jfrog.NewPublishedStorage(
|
||||
name[6:], params)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating jfrog manager: %w", err)
|
||||
}
|
||||
} else {
|
||||
Fatal(fmt.Errorf("unknown published storage format: %v", name))
|
||||
return nil, fmt.Errorf("unknown published storage format: %v", name)
|
||||
}
|
||||
context.publishedStorages[name] = publishedStorage
|
||||
}
|
||||
|
||||
return publishedStorage
|
||||
return publishedStorage, nil
|
||||
}
|
||||
|
||||
// UploadPath builds path to upload storage
|
||||
|
||||
+61
-7
@@ -2,10 +2,10 @@ package context
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/smira/flag"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
@@ -80,10 +80,64 @@ func (s *AptlyContextSuite) SetUpTest(c *C) {
|
||||
|
||||
func (s *AptlyContextSuite) TestGetPublishedStorageBadFS(c *C) {
|
||||
// https://github.com/aptly-dev/aptly/issues/711
|
||||
// This will fail on account of us not having a config, so the
|
||||
// storage never exists.
|
||||
c.Assert(func() { s.context.GetPublishedStorage("filesystem:fuji") },
|
||||
FatalErrorPanicMatches,
|
||||
&FatalError{ReturnCode: 1, Message: fmt.Sprintf("error loading config file %s/.aptly.conf: invalid yaml (EOF) or json (EOF)",
|
||||
os.Getenv("HOME"))})
|
||||
// https://github.com/aptly-dev/aptly/issues/1477
|
||||
// GetPublishedStorage must return an error (not panic) when the
|
||||
// requested storage is not configured.
|
||||
_, err := s.context.GetPublishedStorage("filesystem:fuji")
|
||||
c.Assert(err, NotNil)
|
||||
}
|
||||
|
||||
func (s *AptlyContextSuite) TestGetPublishedStorageJFrogConfigured(c *C) {
|
||||
prevConfig := utils.Config
|
||||
defer func() { utils.Config = prevConfig }()
|
||||
|
||||
s.context.configLoaded = true
|
||||
utils.Config.RootDir = c.MkDir()
|
||||
utils.Config.JFrogPublishRoots = map[string]utils.JFrogPublishRoot{
|
||||
"test": {
|
||||
Repository: "aptly-repo",
|
||||
URL: "https://example.jfrog.local/artifactory",
|
||||
AccessToken: "token",
|
||||
Prefix: "public",
|
||||
},
|
||||
}
|
||||
|
||||
storage, err := s.context.GetPublishedStorage("jfrog:test")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(storage, NotNil)
|
||||
c.Assert(fmt.Sprintf("%v", storage), Equals, "jfrog:aptly-repo:public")
|
||||
|
||||
// Ensure we get the cached object on repeated lookups.
|
||||
storageAgain, err := s.context.GetPublishedStorage("jfrog:test")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(storageAgain, Equals, storage)
|
||||
}
|
||||
|
||||
func (s *AptlyContextSuite) TestGetPublishedStorageJFrogMissing(c *C) {
|
||||
prevConfig := utils.Config
|
||||
defer func() { utils.Config = prevConfig }()
|
||||
|
||||
s.context.configLoaded = true
|
||||
utils.Config.JFrogPublishRoots = map[string]utils.JFrogPublishRoot{}
|
||||
|
||||
_, err := s.context.GetPublishedStorage("jfrog:missing")
|
||||
c.Assert(err, NotNil)
|
||||
c.Check(err.Error(), Equals, "published JFrog storage missing not configured")
|
||||
}
|
||||
|
||||
func (s *AptlyContextSuite) TestGetPublishedStorageJFrogInitError(c *C) {
|
||||
prevConfig := utils.Config
|
||||
defer func() { utils.Config = prevConfig }()
|
||||
|
||||
s.context.configLoaded = true
|
||||
utils.Config.JFrogPublishRoots = map[string]utils.JFrogPublishRoot{
|
||||
"broken": {
|
||||
Repository: "aptly-repo",
|
||||
URL: "ssh://example.local/artifactory",
|
||||
},
|
||||
}
|
||||
|
||||
_, err := s.context.GetPublishedStorage("jfrog:broken")
|
||||
c.Assert(err, NotNil)
|
||||
c.Check(err.Error(), Matches, `error creating jfrog manager: .*`)
|
||||
}
|
||||
|
||||
+5
-2
@@ -291,8 +291,11 @@ func (c *ControlFileReader) ReadStanza() (Stanza, error) {
|
||||
lastField = canonicalCase(parts[0])
|
||||
lastFieldMultiline = isMultilineField(lastField, c.isRelease)
|
||||
if lastFieldMultiline {
|
||||
stanza[lastField] = parts[1]
|
||||
if parts[1] != "" {
|
||||
// Trim trailing whitespace from the inline value so that
|
||||
// "Package-List: " does not add empty line
|
||||
inlineVal := strings.TrimRight(parts[1], " \t")
|
||||
stanza[lastField] = inlineVal
|
||||
if inlineVal != "" {
|
||||
stanza[lastField] += "\n"
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -128,6 +128,35 @@ func (s *ControlFileSuite) TestReadWriteStanza(c *C) {
|
||||
c.Assert(strings.HasPrefix(str, "Package: "), Equals, true)
|
||||
}
|
||||
|
||||
// Sources may contain "Package-List: " with a trailing space.
|
||||
// That trailing space must not be preserved and re-emitted
|
||||
// as a spurious blank continuation line when the stanza is written back out.
|
||||
func (s *ControlFileSuite) TestPackageListTrailingSpace(c *C) {
|
||||
input := "Package-List: \n" +
|
||||
" bash deb shells required arch=any\n" +
|
||||
" bash-doc deb doc optional arch=all\n"
|
||||
|
||||
r := NewControlFileReader(bytes.NewBufferString(input), false, false)
|
||||
stanza, err := r.ReadStanza()
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
c.Check(stanza["Package-List"], Equals,
|
||||
" bash deb shells required arch=any\n"+
|
||||
" bash-doc deb doc optional arch=all\n")
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
w := bufio.NewWriter(buf)
|
||||
err = stanza.Copy().WriteTo(w, true, false, false)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(w.Flush(), IsNil)
|
||||
|
||||
written := buf.String()
|
||||
c.Assert(strings.Contains(written, "Package-List:\n \n"), Equals, false,
|
||||
Commentf("spurious blank continuation line found in written output:\n%s", written))
|
||||
c.Assert(strings.Contains(written, "Package-List:\n bash"), Equals, true,
|
||||
Commentf("expected Package-List entries not found in written output:\n%s", written))
|
||||
}
|
||||
|
||||
func (s *ControlFileSuite) TestReadWriteInstallerStanza(c *C) {
|
||||
s.reader = bytes.NewBufferString(installerFile)
|
||||
r := NewControlFileReader(s.reader, false, true)
|
||||
|
||||
@@ -631,7 +631,6 @@ func (l *PackageList) Filter(options FilterOptions) (*PackageList, error) {
|
||||
//
|
||||
// when follow-all-variants is enabled, we need to try to expand anyway,
|
||||
// as even if dependency is satisfied now, there might be other ways to satisfy dependency
|
||||
// FIXME: do not search twice
|
||||
if result.Search(dep, false, true) != nil {
|
||||
if options.DependencyOptions&DepVerboseResolve == DepVerboseResolve && options.Progress != nil {
|
||||
options.Progress.ColoredPrintf("@{y}Already satisfied dependency@|: %s with %s", &dep, result.Search(dep, true, true))
|
||||
|
||||
+72
-5
@@ -612,6 +612,15 @@ func (p *PublishedRepo) Key() []byte {
|
||||
return []byte("U" + p.StoragePrefix() + ">>" + p.Distribution)
|
||||
}
|
||||
|
||||
// PrefixPoolLockKey returns the task-queue resource key that serialises all
|
||||
// publish operations sharing the same pool directory under storagePrefix.
|
||||
// It must be held whenever a non-MultiDist publish may read or clean the
|
||||
// shared pool, to prevent concurrent cleanup runs from deleting each other's
|
||||
// files. See docs/Resource-Locking.md for the full key-namespace table.
|
||||
func PrefixPoolLockKey(storagePrefix string) string {
|
||||
return "P" + storagePrefix
|
||||
}
|
||||
|
||||
// RefKey is a unique id for package reference list
|
||||
func (p *PublishedRepo) RefKey(component string) []byte {
|
||||
return []byte("E" + p.UUID + component)
|
||||
@@ -823,9 +832,12 @@ func (p *PublishedRepo) GetSkelFiles(skelDir string, component string) (map[stri
|
||||
// Publish publishes snapshot (repository) contents, links package files, generates Packages & Release files, signs them
|
||||
func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageProvider aptly.PublishedStorageProvider,
|
||||
collectionFactory *CollectionFactory, signer pgp.Signer, progress aptly.Progress, forceOverwrite bool, skelDir string) error {
|
||||
publishedStorage := publishedStorageProvider.GetPublishedStorage(p.Storage)
|
||||
publishedStorage, err := publishedStorageProvider.GetPublishedStorage(p.Storage)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err := publishedStorage.MkDir(filepath.Join(p.Prefix, "pool"))
|
||||
err = publishedStorage.MkDir(filepath.Join(p.Prefix, "pool"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1249,7 +1261,10 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP
|
||||
// It can remove prefix fully, and part of pool (for specific component)
|
||||
func (p *PublishedRepo) RemoveFiles(publishedStorageProvider aptly.PublishedStorageProvider, removePrefix bool,
|
||||
removePoolComponents []string, progress aptly.Progress) error {
|
||||
publishedStorage := publishedStorageProvider.GetPublishedStorage(p.Storage)
|
||||
publishedStorage, err := publishedStorageProvider.GetPublishedStorage(p.Storage)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// I. Easy: remove whole prefix (meta+packages)
|
||||
if removePrefix {
|
||||
@@ -1262,7 +1277,7 @@ func (p *PublishedRepo) RemoveFiles(publishedStorageProvider aptly.PublishedStor
|
||||
}
|
||||
|
||||
// II. Medium: remove metadata, it can't be shared as prefix/distribution as unique
|
||||
err := publishedStorage.RemoveDirs(filepath.Join(p.Prefix, "dists", p.Distribution), progress)
|
||||
err = publishedStorage.RemoveDirs(filepath.Join(p.Prefix, "dists", p.Distribution), progress)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1589,6 +1604,55 @@ func (collection *PublishedRepoCollection) listReferencedFilesByComponent(prefix
|
||||
return referencedFiles, nil
|
||||
}
|
||||
|
||||
// CleanupAfterMultiDistToggle cleans up stale pool files left behind when the
|
||||
// MultiDist flag is toggled on a published repository.
|
||||
//
|
||||
// - false→true: Publish() wrote packages into pool/<distribution>/<component>/
|
||||
// but the old flat pool/<component>/ files were not removed because
|
||||
// CleanupPrefixComponentFiles only scans the new MultiDist tree.
|
||||
// A second pass with MultiDist=false cleans the legacy flat layout by
|
||||
// reusing the existing orphan-detection logic (the repo is now MultiDist=true
|
||||
// so it is excluded from the referenced-files scan, making its old pool
|
||||
// entries appear orphaned).
|
||||
//
|
||||
// - true→false: Publish() wrote packages into pool/<component>/ but the old
|
||||
// per-distribution pool/<distribution>/<component>/ directories were not
|
||||
// removed. The orphan-detection approach cannot be used here because the
|
||||
// repo's RefList still contains all packages (they just moved locations).
|
||||
// Instead we directly remove each pool/<distribution>/<component>/ directory.
|
||||
// This is safe because per-distribution pool dirs are exclusive to a single
|
||||
// prefix+distribution combination — no other published repo can share them.
|
||||
func (collection *PublishedRepoCollection) CleanupAfterMultiDistToggle(publishedStorageProvider aptly.PublishedStorageProvider,
|
||||
published *PublishedRepo, prevMultiDist bool, cleanComponents []string, collectionFactory *CollectionFactory, progress aptly.Progress) error {
|
||||
if prevMultiDist == published.MultiDist {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !prevMultiDist && published.MultiDist {
|
||||
// false→true: use orphan-detection via the existing cleanup, but with
|
||||
// MultiDist temporarily set to false so it scans the flat pool layout.
|
||||
legacy := *published
|
||||
legacy.MultiDist = false
|
||||
return collection.CleanupPrefixComponentFiles(publishedStorageProvider, &legacy, cleanComponents, collectionFactory, progress)
|
||||
}
|
||||
|
||||
// true→false: directly remove the per-distribution pool directories.
|
||||
publishedStorage, err := publishedStorageProvider.GetPublishedStorage(published.Storage)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, component := range cleanComponents {
|
||||
poolDir := filepath.Join(published.Prefix, "pool", published.Distribution, component)
|
||||
if err := publishedStorage.RemoveDirs(poolDir, progress); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Remove the distribution-level pool dir if it is now empty.
|
||||
distPoolDir := filepath.Join(published.Prefix, "pool", published.Distribution)
|
||||
_ = publishedStorage.RemoveDirs(distPoolDir, progress)
|
||||
return nil
|
||||
}
|
||||
|
||||
// CleanupPrefixComponentFiles removes all unreferenced files in published storage under prefix/component pair
|
||||
func (collection *PublishedRepoCollection) CleanupPrefixComponentFiles(publishedStorageProvider aptly.PublishedStorageProvider,
|
||||
published *PublishedRepo, cleanComponents []string, collectionFactory *CollectionFactory, progress aptly.Progress) error {
|
||||
@@ -1602,7 +1666,10 @@ func (collection *PublishedRepoCollection) CleanupPrefixComponentFiles(published
|
||||
distribution := published.Distribution
|
||||
|
||||
rootPath := filepath.Join(prefix, "dists", distribution)
|
||||
publishedStorage := publishedStorageProvider.GetPublishedStorage(published.Storage)
|
||||
publishedStorage, err := publishedStorageProvider.GetPublishedStorage(published.Storage)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sort.Strings(cleanComponents)
|
||||
publishedComponents := published.Components()
|
||||
|
||||
+10
-5
@@ -62,12 +62,12 @@ type FakeStorageProvider struct {
|
||||
storages map[string]aptly.PublishedStorage
|
||||
}
|
||||
|
||||
func (p *FakeStorageProvider) GetPublishedStorage(name string) aptly.PublishedStorage {
|
||||
func (p *FakeStorageProvider) GetPublishedStorage(name string) (aptly.PublishedStorage, error) {
|
||||
storage, ok := p.storages[name]
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("unknown storage: %#v", name))
|
||||
return nil, fmt.Errorf("unknown storage: %#v", name)
|
||||
}
|
||||
return storage
|
||||
return storage, nil
|
||||
}
|
||||
|
||||
type PublishedRepoSuite struct {
|
||||
@@ -873,7 +873,10 @@ func (s *PublishedRepoCollectionSuite) TestListReferencedFiles(c *C) {
|
||||
snap3 := NewSnapshotFromRefList("snap3", []*Snapshot{}, s.snap2.RefList(), "desc3")
|
||||
_ = s.snapshotCollection.Add(snap3)
|
||||
|
||||
// Ensure that adding a second publish point with matching files doesn't give duplicate results.
|
||||
// When a second publish point references the same package (snap3 is a clone of snap2,
|
||||
// both containing p3/lonely-strangers), listReferencedFilesByComponent deduplicates by
|
||||
// package ref so the file appears only once. StrSlicesSubstract handles a single entry
|
||||
// correctly, so no duplicate is needed for cleanup safety.
|
||||
repo3, err := NewPublishedRepo("", "", "anaconda-2", []string{}, []string{"main"}, []interface{}{snap3}, s.factory, false)
|
||||
c.Check(err, IsNil)
|
||||
c.Check(s.collection.Add(repo3), IsNil)
|
||||
@@ -888,7 +891,9 @@ func (s *PublishedRepoCollectionSuite) TestListReferencedFiles(c *C) {
|
||||
"a/alien-arena/alien-arena-common_7.40-2_i386.deb",
|
||||
"a/alien-arena/mars-invaders_7.40-2_i386.deb",
|
||||
},
|
||||
"main": {"a/alien-arena/lonely-strangers_7.40-2_i386.deb"},
|
||||
"main": {
|
||||
"a/alien-arena/lonely-strangers_7.40-2_i386.deb",
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -143,12 +143,6 @@ func (s *Snapshot) Key() []byte {
|
||||
return []byte("S" + s.UUID)
|
||||
}
|
||||
|
||||
// ResourceKey is a unique identifier of the resource
|
||||
// this snapshot uses. Instead of uuid it uses name
|
||||
// which needs to be unique as well.
|
||||
func (s *Snapshot) ResourceKey() []byte {
|
||||
return []byte("S" + s.Name)
|
||||
}
|
||||
|
||||
// RefKey is a unique id for package reference list
|
||||
func (s *Snapshot) RefKey() []byte {
|
||||
|
||||
Vendored
+82
-2
@@ -83,9 +83,8 @@ serve_in_api_mode: false
|
||||
# Enable metrics for Prometheus client
|
||||
enable_metrics_endpoint: false
|
||||
|
||||
# Not implemented in this version.
|
||||
# Enable API documentation on /docs
|
||||
#enable_swagger_endpoint: false
|
||||
enable_swagger_endpoint: false
|
||||
|
||||
# OBSOLETE: use via url param ?_async=true
|
||||
async_api: false
|
||||
@@ -197,6 +196,35 @@ filesystem_publish_endpoints:
|
||||
#
|
||||
# `aptly publish snapshot wheezy-main s3:test:`
|
||||
#
|
||||
|
||||
# JFrog Artifactory Endpoint Support
|
||||
#
|
||||
# aptly can be configured to publish repositories directly to JFrog Artifactory. First,
|
||||
# publishing endpoints should be described in the aptly configuration file.
|
||||
#
|
||||
# The destination Artifactory repo should be of the "generic" type, not "debian".
|
||||
#
|
||||
# In order to publish to JFrog, specify endpoint as `jfrog:endpoint-name:` before
|
||||
# publishing prefix on the command line, e.g.:
|
||||
#
|
||||
# `aptly publish snapshot wheezy-main jfrog:test:`
|
||||
#
|
||||
jfrog_publish_endpoints:
|
||||
# # Endpoint Name
|
||||
# test:
|
||||
# # JFrog URL
|
||||
# url: "https://artifactory.example.com/artifactory/"
|
||||
# # Repository
|
||||
# repository: apt-local
|
||||
# # Jfrog credentials to authenticate to Artifactory. If not supplied, the
|
||||
# # environment variables `JFROG_USERNAME`, `JFROG_PASSWORD`, `JFROG_APIKEY`,
|
||||
# # and `JFROG_ACCESSTOKEN` can be used
|
||||
# # Authentication requires one of: user+pass, api key, or access token
|
||||
# username: admin
|
||||
# password: password
|
||||
# api_key: api_key
|
||||
# access_token: access_token
|
||||
|
||||
s3_publish_endpoints:
|
||||
# # Endpoint Name
|
||||
# test:
|
||||
@@ -257,6 +285,58 @@ s3_publish_endpoints:
|
||||
# # Enables detailed request/response dump for each S3 operation
|
||||
# debug: false
|
||||
|
||||
# GCS Endpoint Support
|
||||
#
|
||||
# aptly can be configured to publish repositories directly to Google Cloud
|
||||
# Storage. First, publishing endpoints should be described in the aptly
|
||||
# configuration file. Each endpoint has a name and associated settings.
|
||||
#
|
||||
# In order to publish to GCS, specify endpoint as `gcs:endpoint-name:` before
|
||||
# publishing prefix on the command line, e.g.:
|
||||
#
|
||||
# `aptly publish snapshot wheezy-main gcs:test:`
|
||||
#
|
||||
gcs_publish_endpoints:
|
||||
# # Endpoint Name
|
||||
# test:
|
||||
# # Bucket name
|
||||
# bucket: test-bucket
|
||||
# # Prefix (optional)
|
||||
# # publishing under specified prefix in the bucket, defaults to
|
||||
# # no prefix (bucket root)
|
||||
# prefix: ""
|
||||
# # Credentials File (optional)
|
||||
# # Path to a service account credentials JSON file
|
||||
# credentials_file: ""
|
||||
# # Service Account JSON (optional)
|
||||
# # Inline service account credentials JSON payload
|
||||
# service_account_json: ""
|
||||
# # Project (optional)
|
||||
# # Quota project used for GCS requests
|
||||
# project: ""
|
||||
# # Endpoint (optional)
|
||||
# # Override the GCS endpoint (e.g. for staging or a fake server);
|
||||
# # leave empty to use the default GCS endpoint
|
||||
# endpoint: ""
|
||||
# # Default ACLs (optional)
|
||||
# # assign ACL to published files:
|
||||
# # * private (default)
|
||||
# # * public-read (public repository)
|
||||
# # * none (don't set ACL)
|
||||
# acl: private
|
||||
# # Storage Class (optional)
|
||||
# # GCS storage class, e.g. `STANDARD`
|
||||
# storage_class: STANDARD
|
||||
# # Encryption Key (optional)
|
||||
# # Customer-supplied encryption key (32-byte AES-256 key)
|
||||
# encryption_key: ""
|
||||
# # Disable MultiDel (optional)
|
||||
# # Kept for parity with S3 settings; GCS deletes are one-by-one
|
||||
# disable_multidel: false
|
||||
# # Debug (optional)
|
||||
# # Enables detailed logs for each GCS operation
|
||||
# debug: false
|
||||
|
||||
# Swift Endpoint Support
|
||||
#
|
||||
# aptly can publish a repository directly to OpenStack Swift.
|
||||
|
||||
Vendored
+52
@@ -1,3 +1,55 @@
|
||||
aptly (1.6.3) stable; urgency=medium
|
||||
|
||||
* NEW FEATURES:
|
||||
* Google Cloud Storage (GCS) publish backend (https://github.com/aptly-dev/aptly/pull/1550)
|
||||
* dput-compatible file upload API (https://github.com/aptly-dev/aptly/pull/1436)
|
||||
* JFrog Artifactory publish backend (https://github.com/aptly-dev/aptly/pull/1553)
|
||||
* AppStream (DEP-11) mirror support (https://github.com/aptly-dev/aptly/pull/1543)
|
||||
* Multiple GPG keys support (https://github.com/aptly-dev/aptly/pull/1479)
|
||||
* GPG key list & delete API (https://github.com/aptly-dev/aptly/pull/1558)
|
||||
* Edit mirror API endpoint (https://github.com/aptly-dev/aptly/pull/1535)
|
||||
* NumPackages in list responses (https://github.com/aptly-dev/aptly/pull/1559)
|
||||
* Mirror latest packages (https://github.com/aptly-dev/aptly/pull/1513)
|
||||
* Reproducible builds / `SOURCE_DATE_EPOCH` support (https://github.com/aptly-dev/aptly/pull/1537), https://github.com/aptly-dev/aptly/pull/1542)
|
||||
* `Release` file `Version` field support (https://github.com/aptly-dev/aptly/pull/1533)
|
||||
* `InRelease` file `Signed-By` field support (https://github.com/aptly-dev/aptly/pull/1518), https://github.com/aptly-dev/aptly/pull/1519)
|
||||
* GCP / Google Artifact Registry authentication (https://github.com/aptly-dev/aptly/pull/1505)
|
||||
* Update publish label & origin (https://github.com/aptly-dev/aptly/pull/1484)
|
||||
* Ubuntu 26.04 / resolute builds (https://github.com/aptly-dev/aptly/pull/1571)
|
||||
* BUG FIXES:
|
||||
* Race condition & concurrency fixes for the REST API (https://github.com/aptly-dev/aptly/pull/1574)
|
||||
* Fix empty line in `Package-List` for source packages (https://github.com/aptly-dev/aptly/pull/1588)
|
||||
* Publish: check storage exists before publishing (https://github.com/aptly-dev/aptly/pull/1587)
|
||||
* S3 publish race condition (https://github.com/aptly-dev/aptly/pull/1594)
|
||||
* Repo edit name optionally (https://github.com/aptly-dev/aptly/pull/1593)
|
||||
* Fix crash in `aptly db recover` (https://github.com/aptly-dev/aptly/pull/1565)
|
||||
* Fix deadlocks in task list (https://github.com/aptly-dev/aptly/pull/1529)
|
||||
* Fix S3 re-upload issue (https://github.com/aptly-dev/aptly/pull/1480)
|
||||
* Fix `aptly repo edit` API (https://github.com/aptly-dev/aptly/pull/1493)
|
||||
* Fix out-of-disk-space error handling (https://github.com/aptly-dev/aptly/pull/1504)
|
||||
* Fix `aptly mirror update` removing unrelated params (https://github.com/aptly-dev/aptly/pull/1466)
|
||||
* Fix concurrent pool linking race condition (https://github.com/aptly-dev/aptly/pull/1481)
|
||||
* Fix `dpkg`-compliant version comparison (https://github.com/aptly-dev/aptly/pull/1509)
|
||||
* Fix Swagger property casing and spec errors (https://github.com/aptly-dev/aptly/pull/1510), https://github.com/aptly-dev/aptly/pull/1498)
|
||||
* Remove useless nil check (https://github.com/aptly-dev/aptly/pull/1482)
|
||||
* Format Go code with gofmt (https://github.com/aptly-dev/aptly/pull/1483)
|
||||
* DEPENDENCIES CHANGES:
|
||||
* Go toolchain → 1.25.0
|
||||
* `go.opentelemetry.io/otel` → v1.41.0 (https://github.com/aptly-dev/aptly/pull/1586)
|
||||
* `go.opentelemetry.io/otel/sdk` → v1.43.0 (https://github.com/aptly-dev/aptly/pull/1584)
|
||||
* `github.com/go-jose/go-jose/v4` → v4.1.4 (https://github.com/aptly-dev/aptly/pull/1585)
|
||||
* `github.com/go-git/go-git/v5` → v5.19.1 (https://github.com/aptly-dev/aptly/pull/1590)
|
||||
* `github.com/ulikunitz/xz` → v0.5.15 (fixes 32-bit build failures)
|
||||
* `golang.org/x/crypto` → v0.45.0 (https://github.com/aptly-dev/aptly/pull/1506)
|
||||
* `google.golang.org/grpc` → v1.79.3 (https://github.com/aptly-dev/aptly/pull/1546)
|
||||
* `github.com/aws/aws-sdk-go-v2/service/s3` → v1.97.3 (https://github.com/aptly-dev/aptly/pull/1554)
|
||||
* `github.com/cloudflare/circl` → v1.6.3 (https://github.com/aptly-dev/aptly/pull/1461), https://github.com/aptly-dev/aptly/pull/1541)
|
||||
* `requests` (Python, system tests) → 2.33.0 (https://github.com/aptly-dev/aptly/pull/1460), https://github.com/aptly-dev/aptly/pull/1547)
|
||||
* `github.com/ProtonMail/go-crypto` → v1.4.0
|
||||
* `golang.org/x/net` → v0.48.0
|
||||
|
||||
-- André Roth <neolynx@gmail.com> Wed, 24 Jun 2026 18:47:05 +0200
|
||||
|
||||
aptly (1.6.2) stable; urgency=medium
|
||||
|
||||
* doc: add swagger doc for /api/gpg/key (https://github.com/aptly-dev/aptly/pull/1456)
|
||||
|
||||
Vendored
+26
-6
@@ -2,12 +2,21 @@
|
||||
|
||||
include /usr/share/dpkg/pkg-info.mk
|
||||
|
||||
export GOPATH=$(shell pwd)/.go
|
||||
export DEB_BUILD_OPTIONS=crossbuildcanrunhostbinaries
|
||||
|
||||
export GOARCH := $(shell if [ $(DEB_TARGET_ARCH) = "i386" ]; then echo "386"; elif [ $(DEB_TARGET_ARCH) = "armhf" ]; then echo "arm"; else echo $(DEB_TARGET_ARCH); fi)
|
||||
export CGO_ENABLED=1
|
||||
|
||||
ifneq ($(DEB_HOST_GNU_TYPE), $(DEB_BUILD_GNU_TYPE))
|
||||
export CC=$(DEB_HOST_GNU_TYPE)-gcc
|
||||
endif
|
||||
|
||||
%:
|
||||
dh $@ --buildsystem=golang --with=golang,bash-completion
|
||||
|
||||
override_dh_auto_clean:
|
||||
rm -rf build/
|
||||
rm -f docs/docs.go
|
||||
rm -rf obj-$(DEB_TARGET_GNU_TYPE)/
|
||||
dh_auto_clean
|
||||
|
||||
@@ -15,14 +24,25 @@ override_dh_auto_test:
|
||||
# run during autopkgtests
|
||||
|
||||
override_dh_auto_install:
|
||||
rm -f obj-$(DEB_TARGET_GNU_TYPE)/bin/files # where does that file come from ?
|
||||
dh_auto_install -- --no-source
|
||||
|
||||
override_dh_strip:
|
||||
dh_strip --dbg-package=aptly-dbg
|
||||
|
||||
override_dh_golang: # fails on non native debian build
|
||||
|
||||
# override_dh_makeshlibs: # fails with cross compiling on non native debian build
|
||||
|
||||
override_dh_dwz: # somehow dwz works only with certain newer debhelper versions
|
||||
dhver=`dpkg-query -f '$${Version}' -W debhelper`; (dpkg --compare-versions "$$dhver" lt 13 || test "$$dhver" = "13.3.4" || test "$$dhver" = "13.6ubuntu1") || dh_dwz
|
||||
|
||||
override_dh_shlibdeps:
|
||||
ifneq ($(DEB_HOST_GNU_TYPE), $(DEB_BUILD_GNU_TYPE))
|
||||
LD_LIBRARY_PATH=/usr/$(DEB_HOST_GNU_TYPE)/lib:$$LD_LIBRARY_PATH dh_shlibdeps
|
||||
else
|
||||
dh_shlibdeps
|
||||
endif
|
||||
|
||||
override_dh_auto_build:
|
||||
echo $(DEB_VERSION) > obj-$(DEB_TARGET_GNU_TYPE)/src/github.com/aptly-dev/aptly/VERSION
|
||||
mkdir -p obj-$(DEB_TARGET_GNU_TYPE)/src/github.com/aptly-dev/aptly/debian
|
||||
cp debian/aptly.conf obj-$(DEB_TARGET_GNU_TYPE)/src/github.com/aptly-dev/aptly/debian/
|
||||
dh_auto_build
|
||||
echo $(DEB_VERSION) > VERSION
|
||||
go build -buildmode=pie -o usr/bin/aptly
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ Publish snapshot or local repo as Debian repository to be used as APT source on
|
||||
|
||||
The published repository is signed with the user's GnuPG key.
|
||||
|
||||
Repositories can be published to local directories, Amazon S3 buckets, Azure or Swift Storage.
|
||||
Repositories can be published to local directories, Amazon S3 buckets, Azure, Swift, or JFrog Artifactory Storage.
|
||||
|
||||
#### GPG Keys
|
||||
|
||||
|
||||
@@ -1,283 +0,0 @@
|
||||
package files
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
type LinkFromPoolConcurrencySuite struct {
|
||||
root string
|
||||
poolDir string
|
||||
storage *PublishedStorage
|
||||
pool *PackagePool
|
||||
cs aptly.ChecksumStorage
|
||||
testFile string
|
||||
testContent []byte
|
||||
testChecksums utils.ChecksumInfo
|
||||
srcPoolPath string
|
||||
}
|
||||
|
||||
var _ = Suite(&LinkFromPoolConcurrencySuite{})
|
||||
|
||||
func (s *LinkFromPoolConcurrencySuite) SetUpTest(c *C) {
|
||||
s.root = c.MkDir()
|
||||
s.poolDir = filepath.Join(s.root, "pool")
|
||||
publishDir := filepath.Join(s.root, "public")
|
||||
|
||||
// Create package pool and published storage
|
||||
s.pool = NewPackagePool(s.poolDir, true)
|
||||
s.storage = NewPublishedStorage(publishDir, "copy", "checksum")
|
||||
s.cs = NewMockChecksumStorage()
|
||||
|
||||
// Create test file content
|
||||
s.testContent = []byte("test package content for concurrency testing")
|
||||
s.testFile = filepath.Join(s.root, "test-package.deb")
|
||||
|
||||
err := os.WriteFile(s.testFile, s.testContent, 0644)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
// Calculate checksums
|
||||
md5sum, err := utils.MD5ChecksumForFile(s.testFile)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
s.testChecksums = utils.ChecksumInfo{
|
||||
Size: int64(len(s.testContent)),
|
||||
MD5: md5sum,
|
||||
}
|
||||
|
||||
// Import the test file into the pool
|
||||
s.srcPoolPath, err = s.pool.Import(s.testFile, "test-package.deb", &s.testChecksums, false, s.cs)
|
||||
c.Assert(err, IsNil)
|
||||
}
|
||||
|
||||
func (s *LinkFromPoolConcurrencySuite) TestLinkFromPoolConcurrency(c *C) {
|
||||
// Test concurrent LinkFromPool operations to ensure no race conditions
|
||||
concurrency := 5000
|
||||
iterations := 10
|
||||
|
||||
for iter := 0; iter < iterations; iter++ {
|
||||
c.Logf("Iteration %d: Testing concurrent LinkFromPool with %d goroutines", iter+1, concurrency)
|
||||
|
||||
destPath := fmt.Sprintf("main/t/test%d", iter)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
errors := make(chan error, concurrency)
|
||||
successes := make(chan struct{}, concurrency)
|
||||
|
||||
start := time.Now()
|
||||
|
||||
// Launch concurrent LinkFromPool operations
|
||||
for i := 0; i < concurrency; i++ {
|
||||
wg.Add(1)
|
||||
go func(id int) {
|
||||
defer wg.Done()
|
||||
|
||||
// Use force=true to test the most vulnerable code path (remove-then-create)
|
||||
err := s.storage.LinkFromPool(
|
||||
"", // publishedPrefix
|
||||
destPath, // publishedRelPath
|
||||
"test-package.deb", // fileName
|
||||
s.pool, // sourcePool
|
||||
s.srcPoolPath, // sourcePath
|
||||
s.testChecksums, // sourceChecksums
|
||||
true, // force - this triggers vulnerable remove-then-create pattern
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
errors <- fmt.Errorf("goroutine %d failed: %v", id, err)
|
||||
} else {
|
||||
successes <- struct{}{}
|
||||
}
|
||||
}(i)
|
||||
}
|
||||
|
||||
// Wait for completion
|
||||
wg.Wait()
|
||||
duration := time.Since(start)
|
||||
|
||||
close(errors)
|
||||
close(successes)
|
||||
|
||||
// Count results
|
||||
errorCount := 0
|
||||
successCount := 0
|
||||
var firstError error
|
||||
|
||||
for err := range errors {
|
||||
errorCount++
|
||||
if firstError == nil {
|
||||
firstError = err
|
||||
}
|
||||
c.Logf("Race condition error: %v", err)
|
||||
}
|
||||
|
||||
for range successes {
|
||||
successCount++
|
||||
}
|
||||
|
||||
c.Logf("Results: %d successes, %d errors, took %v", successCount, errorCount, duration)
|
||||
|
||||
// Assert no race conditions occurred
|
||||
if errorCount > 0 {
|
||||
c.Fatalf("Race condition detected in iteration %d! "+
|
||||
"Errors: %d out of %d operations (%.1f%% failure rate). "+
|
||||
"First error: %v. "+
|
||||
"This indicates the fix is not working properly.",
|
||||
iter+1, errorCount, concurrency,
|
||||
float64(errorCount)/float64(concurrency)*100, firstError)
|
||||
}
|
||||
|
||||
// Verify the final file exists and has correct content
|
||||
finalFile := filepath.Join(s.storage.rootPath, destPath, "test-package.deb")
|
||||
_, err := os.Stat(finalFile)
|
||||
c.Assert(err, IsNil, Commentf("Final file should exist after concurrent operations"))
|
||||
|
||||
content, err := os.ReadFile(finalFile)
|
||||
c.Assert(err, IsNil, Commentf("Should be able to read final file"))
|
||||
c.Assert(content, DeepEquals, s.testContent, Commentf("File content should be intact after concurrent operations"))
|
||||
|
||||
c.Logf("✓ Iteration %d: No race conditions detected", iter+1)
|
||||
}
|
||||
|
||||
c.Logf("SUCCESS: Handled %d total concurrent operations across %d iterations with no race conditions",
|
||||
concurrency*iterations, iterations)
|
||||
}
|
||||
|
||||
func (s *LinkFromPoolConcurrencySuite) TestLinkFromPoolConcurrencyDifferentFiles(c *C) {
|
||||
// Test concurrent operations on different files to ensure no blocking
|
||||
concurrency := 10
|
||||
|
||||
var wg sync.WaitGroup
|
||||
errors := make(chan error, concurrency)
|
||||
|
||||
start := time.Now()
|
||||
|
||||
// Launch concurrent operations on different destination files
|
||||
for i := 0; i < concurrency; i++ {
|
||||
wg.Add(1)
|
||||
go func(id int) {
|
||||
defer wg.Done()
|
||||
|
||||
destPath := fmt.Sprintf("main/t/test-file-%d", id)
|
||||
|
||||
err := s.storage.LinkFromPool(
|
||||
"", // publishedPrefix
|
||||
destPath, // publishedRelPath
|
||||
"test-package.deb", // fileName
|
||||
s.pool, // sourcePool
|
||||
s.srcPoolPath, // sourcePath
|
||||
s.testChecksums, // sourceChecksums
|
||||
false, // force
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
errors <- fmt.Errorf("goroutine %d failed: %v", id, err)
|
||||
}
|
||||
}(i)
|
||||
}
|
||||
|
||||
// Wait for completion
|
||||
wg.Wait()
|
||||
duration := time.Since(start)
|
||||
|
||||
close(errors)
|
||||
|
||||
// Count errors
|
||||
errorCount := 0
|
||||
for err := range errors {
|
||||
errorCount++
|
||||
c.Logf("Error: %v", err)
|
||||
}
|
||||
|
||||
c.Assert(errorCount, Equals, 0, Commentf("No errors should occur when linking to different files"))
|
||||
c.Logf("SUCCESS: %d concurrent operations on different files completed in %v", concurrency, duration)
|
||||
|
||||
// Verify all files were created correctly
|
||||
for i := 0; i < concurrency; i++ {
|
||||
finalFile := filepath.Join(s.storage.rootPath, fmt.Sprintf("main/t/test-file-%d", i), "test-package.deb")
|
||||
_, err := os.Stat(finalFile)
|
||||
c.Assert(err, IsNil, Commentf("File %d should exist", i))
|
||||
|
||||
content, err := os.ReadFile(finalFile)
|
||||
c.Assert(err, IsNil, Commentf("Should be able to read file %d", i))
|
||||
c.Assert(content, DeepEquals, s.testContent, Commentf("File %d content should be correct", i))
|
||||
}
|
||||
}
|
||||
|
||||
func (s *LinkFromPoolConcurrencySuite) TestLinkFromPoolWithoutForceNoConcurrencyIssues(c *C) {
|
||||
// Test that when force=false, concurrent operations fail gracefully without corruption
|
||||
concurrency := 20
|
||||
destPath := "main/t/single-dest"
|
||||
|
||||
var wg sync.WaitGroup
|
||||
errors := make(chan error, concurrency)
|
||||
successes := make(chan struct{}, concurrency)
|
||||
|
||||
// First, create the file so subsequent operations will conflict
|
||||
err := s.storage.LinkFromPool("", destPath, "test-package.deb", s.pool, s.srcPoolPath, s.testChecksums, false)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
start := time.Now()
|
||||
|
||||
// Launch concurrent operations that should mostly fail
|
||||
for i := 0; i < concurrency; i++ {
|
||||
wg.Add(1)
|
||||
go func(id int) {
|
||||
defer wg.Done()
|
||||
|
||||
err := s.storage.LinkFromPool(
|
||||
"", // publishedPrefix
|
||||
destPath, // publishedRelPath
|
||||
"test-package.deb", // fileName
|
||||
s.pool, // sourcePool
|
||||
s.srcPoolPath, // sourcePath
|
||||
s.testChecksums, // sourceChecksums
|
||||
false, // force=false - should fail if file exists and is same
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
errors <- err
|
||||
} else {
|
||||
successes <- struct{}{}
|
||||
}
|
||||
}(i)
|
||||
}
|
||||
|
||||
// Wait for completion
|
||||
wg.Wait()
|
||||
duration := time.Since(start)
|
||||
|
||||
close(errors)
|
||||
close(successes)
|
||||
|
||||
errorCount := 0
|
||||
successCount := 0
|
||||
|
||||
for range errors {
|
||||
errorCount++
|
||||
}
|
||||
|
||||
for range successes {
|
||||
successCount++
|
||||
}
|
||||
|
||||
c.Logf("Results with force=false: %d successes, %d errors, took %v", successCount, errorCount, duration)
|
||||
|
||||
// With force=false and identical files, operations should succeed (file already exists with same content)
|
||||
// No race conditions should cause crashes or corruption
|
||||
c.Assert(errorCount, Equals, 0, Commentf("With identical files and force=false, operations should succeed"))
|
||||
|
||||
// Verify the file still exists and has correct content
|
||||
finalFile := filepath.Join(s.storage.rootPath, destPath, "test-package.deb")
|
||||
content, err := os.ReadFile(finalFile)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(content, DeepEquals, s.testContent, Commentf("File should not be corrupted by concurrent access"))
|
||||
}
|
||||
@@ -26,26 +26,6 @@ type PublishedStorage struct {
|
||||
verifyMethod uint
|
||||
}
|
||||
|
||||
// Global mutex map to prevent concurrent access to the same destinationPath in LinkFromPool
|
||||
var (
|
||||
fileLockMutex sync.Mutex
|
||||
fileLocks = make(map[string]*sync.Mutex)
|
||||
)
|
||||
|
||||
// getFileLock returns a mutex for a specific file path to prevent concurrent modifications
|
||||
func getFileLock(filePath string) *sync.Mutex {
|
||||
fileLockMutex.Lock()
|
||||
defer fileLockMutex.Unlock()
|
||||
|
||||
if mutex, exists := fileLocks[filePath]; exists {
|
||||
return mutex
|
||||
}
|
||||
|
||||
mutex := &sync.Mutex{}
|
||||
fileLocks[filePath] = mutex
|
||||
return mutex
|
||||
}
|
||||
|
||||
// Check interfaces
|
||||
var (
|
||||
_ aptly.PublishedStorage = (*PublishedStorage)(nil)
|
||||
@@ -172,11 +152,6 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
|
||||
poolPath := filepath.Join(storage.rootPath, publishedPrefix, publishedRelPath, filepath.Dir(fileName))
|
||||
destinationPath := filepath.Join(poolPath, baseName)
|
||||
|
||||
// Acquire file-specific lock to prevent concurrent access to the same file
|
||||
fileLock := getFileLock(destinationPath)
|
||||
fileLock.Lock()
|
||||
defer fileLock.Unlock()
|
||||
|
||||
var localSourcePool aptly.LocalPackagePool
|
||||
if storage.linkMethod != LinkMethodCopy {
|
||||
pp, ok := sourcePool.(aptly.LocalPackagePool)
|
||||
|
||||
@@ -632,16 +632,6 @@ func (s *DiskFullNoRootSuite) TestLinkFromPoolCopySyncErrorIsReturned(c *C) {
|
||||
c.Check(strings.Contains(err.Error(), "error syncing file"), Equals, true)
|
||||
}
|
||||
|
||||
func (s *DiskFullNoRootSuite) TestGetFileLockReusesMutex(c *C) {
|
||||
a := getFileLock(filepath.Join(s.root, "a"))
|
||||
b := getFileLock(filepath.Join(s.root, "a"))
|
||||
c.Check(a == b, Equals, true)
|
||||
|
||||
c1 := getFileLock(filepath.Join(s.root, "c1"))
|
||||
c2 := getFileLock(filepath.Join(s.root, "c2"))
|
||||
c.Check(c1 == c2, Equals, false)
|
||||
}
|
||||
|
||||
func (s *DiskFullNoRootSuite) TestPutFileFailsIfDestinationDirMissing(c *C) {
|
||||
storage := NewPublishedStorage(s.root, "", "")
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
// Package gcs handles publishing to Google Cloud Storage.
|
||||
package gcs
|
||||
@@ -0,0 +1,12 @@
|
||||
package gcs
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
// Launch gocheck tests.
|
||||
func Test(t *testing.T) {
|
||||
TestingT(t)
|
||||
}
|
||||
+422
@@ -0,0 +1,422 @@
|
||||
package gcs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"cloud.google.com/go/storage"
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog/log"
|
||||
"google.golang.org/api/googleapi"
|
||||
"google.golang.org/api/iterator"
|
||||
"google.golang.org/api/option"
|
||||
)
|
||||
|
||||
// PublishedStorage abstracts published files hosted on GCS.
|
||||
type PublishedStorage struct {
|
||||
client *storage.Client
|
||||
bucket *storage.BucketHandle
|
||||
bucketName string
|
||||
prefix string
|
||||
acl string
|
||||
storageClass string
|
||||
encryptionKey string
|
||||
disableMultiDel bool
|
||||
debug bool
|
||||
pathCache map[string]string
|
||||
}
|
||||
|
||||
var (
|
||||
_ aptly.PublishedStorage = (*PublishedStorage)(nil)
|
||||
)
|
||||
|
||||
// NewPublishedStorage creates a GCS-backed published storage.
|
||||
func NewPublishedStorage(bucket, prefix, credentialsFile, serviceAccountJSON,
|
||||
project, endpoint, defaultACL, storageClass, encryptionKey string,
|
||||
disableMultiDel, debug bool) (*PublishedStorage, error) {
|
||||
|
||||
ctx := context.TODO()
|
||||
opts := make([]option.ClientOption, 0, 4)
|
||||
|
||||
if endpoint != "" {
|
||||
opts = append(opts, option.WithEndpoint(endpoint), option.WithoutAuthentication())
|
||||
} else if credentialsFile != "" {
|
||||
opts = append(opts, option.WithAuthCredentialsFile(option.ServiceAccount, credentialsFile))
|
||||
} else if serviceAccountJSON != "" {
|
||||
opts = append(opts, option.WithAuthCredentialsJSON(option.ServiceAccount, []byte(serviceAccountJSON)))
|
||||
}
|
||||
|
||||
if project != "" {
|
||||
opts = append(opts, option.WithQuotaProject(project))
|
||||
}
|
||||
|
||||
// When pointing at a non-production endpoint (an explicit override or the
|
||||
// STORAGE_EMULATOR_HOST hook the GCS Go client honours natively), force
|
||||
// JSON reads. The default XML download API uses virtual-host-style URLs
|
||||
// (https://<bucket>.storage.googleapis.com/...) that emulators and most
|
||||
// dev/staging endpoints can't serve under a single listener; the JSON API
|
||||
// uses path-based URLs that work the same against real GCS or an emulator.
|
||||
if endpoint != "" || os.Getenv("STORAGE_EMULATOR_HOST") != "" {
|
||||
opts = append(opts, storage.WithJSONReads())
|
||||
}
|
||||
|
||||
client, err := storage.NewClient(ctx, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
result := &PublishedStorage{
|
||||
client: client,
|
||||
bucket: client.Bucket(bucket),
|
||||
bucketName: bucket,
|
||||
prefix: prefix,
|
||||
acl: defaultACL,
|
||||
storageClass: storageClass,
|
||||
encryptionKey: encryptionKey,
|
||||
disableMultiDel: disableMultiDel,
|
||||
debug: debug,
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (g *PublishedStorage) String() string {
|
||||
return fmt.Sprintf("GCS: %s/%s", g.bucketName, g.prefix)
|
||||
}
|
||||
|
||||
// MkDir creates directory recursively under public path.
|
||||
func (g *PublishedStorage) MkDir(_ string) error {
|
||||
// no-op for GCS
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *PublishedStorage) objectPath(path string) string {
|
||||
return filepath.Join(g.prefix, path)
|
||||
}
|
||||
|
||||
func (g *PublishedStorage) objectHandle(path string) *storage.ObjectHandle {
|
||||
obj := g.bucket.Object(g.objectPath(path))
|
||||
if g.encryptionKey != "" {
|
||||
obj = obj.Key([]byte(g.encryptionKey))
|
||||
}
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
// PutFile puts file into published storage at specified path.
|
||||
func (g *PublishedStorage) PutFile(path string, sourceFilename string) error {
|
||||
source, err := os.Open(sourceFilename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() { _ = source.Close() }()
|
||||
|
||||
if g.debug {
|
||||
log.Debug().Msgf("GCS: PutFile '%s'", path)
|
||||
}
|
||||
|
||||
err = g.putFile(path, source, "")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, fmt.Sprintf("error uploading %s to %s", sourceFilename, g))
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *PublishedStorage) applyACL(obj *storage.ObjectHandle) error {
|
||||
switch g.acl {
|
||||
case "", "none", "private":
|
||||
return nil
|
||||
case "public-read":
|
||||
return obj.ACL().Set(context.TODO(), storage.AllUsers, storage.RoleReader)
|
||||
default:
|
||||
return fmt.Errorf("unsupported GCS ACL value: %s", g.acl)
|
||||
}
|
||||
}
|
||||
|
||||
func (g *PublishedStorage) putFile(path string, source io.Reader, sourceMD5 string) error {
|
||||
obj := g.objectHandle(path)
|
||||
writer := obj.NewWriter(context.TODO())
|
||||
|
||||
if g.storageClass != "" {
|
||||
writer.StorageClass = g.storageClass
|
||||
}
|
||||
if sourceMD5 != "" {
|
||||
writer.Metadata = map[string]string{"Md5": sourceMD5}
|
||||
}
|
||||
|
||||
if _, err := io.Copy(writer, source); err != nil {
|
||||
_ = writer.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
if err := writer.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return g.applyACL(obj)
|
||||
}
|
||||
|
||||
func (g *PublishedStorage) getMD5(path string) (string, error) {
|
||||
attrs, err := g.objectHandle(path).Attrs(context.TODO())
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if attrs.Metadata != nil {
|
||||
if md5, ok := attrs.Metadata["Md5"]; ok && md5 != "" {
|
||||
return strings.ToLower(md5), nil
|
||||
}
|
||||
}
|
||||
|
||||
return strings.ToLower(hex.EncodeToString(attrs.MD5)), nil
|
||||
}
|
||||
|
||||
// Remove removes single file under public path.
|
||||
func (g *PublishedStorage) Remove(path string) error {
|
||||
if g.debug {
|
||||
log.Debug().Msgf("GCS: Remove '%s'", path)
|
||||
}
|
||||
|
||||
err := g.objectHandle(path).Delete(context.TODO())
|
||||
if err != nil {
|
||||
if err == storage.ErrObjectNotExist {
|
||||
return nil
|
||||
}
|
||||
|
||||
var apiErr *googleapi.Error
|
||||
if errors.As(err, &apiErr) && apiErr.Code == 404 {
|
||||
return nil
|
||||
}
|
||||
|
||||
return errors.Wrap(err, fmt.Sprintf("error deleting %s from %s", path, g))
|
||||
}
|
||||
|
||||
delete(g.pathCache, path)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// RemoveDirs removes directory structure under public path.
|
||||
func (g *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error {
|
||||
filelist, _, err := g.internalFilelist(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if g.debug {
|
||||
log.Debug().Msgf("GCS: RemoveDirs '%s'", path)
|
||||
}
|
||||
|
||||
for _, file := range filelist {
|
||||
objPath := filepath.Join(path, file)
|
||||
if err := g.Remove(objPath); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
_ = g.disableMultiDel
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// LinkFromPool links package file from pool to dist's pool location.
|
||||
func (g *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath, fileName string, sourcePool aptly.PackagePool,
|
||||
sourcePath string, sourceChecksums utils.ChecksumInfo, force bool) error {
|
||||
|
||||
publishedDirectory := filepath.Join(publishedPrefix, publishedRelPath)
|
||||
relPath := filepath.Join(publishedDirectory, fileName)
|
||||
poolPath := filepath.Join(g.prefix, relPath)
|
||||
|
||||
if g.pathCache == nil {
|
||||
paths, md5s, err := g.internalFilelist(filepath.Join(publishedPrefix, "pool"))
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error caching paths under prefix")
|
||||
}
|
||||
|
||||
g.pathCache = make(map[string]string, len(paths))
|
||||
for i := range paths {
|
||||
g.pathCache[filepath.Join(publishedPrefix, "pool", paths[i])] = md5s[i]
|
||||
}
|
||||
}
|
||||
|
||||
destinationMD5, exists := g.pathCache[relPath]
|
||||
sourceMD5 := strings.ToLower(sourceChecksums.MD5)
|
||||
|
||||
if exists {
|
||||
if sourceMD5 == "" {
|
||||
return fmt.Errorf("unable to compare object, MD5 checksum missing")
|
||||
}
|
||||
|
||||
if len(destinationMD5) != 32 {
|
||||
var err error
|
||||
destinationMD5, err = g.getMD5(relPath)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, fmt.Sprintf("error verifying MD5 for %s: %s", g, poolPath))
|
||||
}
|
||||
g.pathCache[relPath] = destinationMD5
|
||||
}
|
||||
|
||||
if destinationMD5 == sourceMD5 {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !force {
|
||||
return fmt.Errorf("error putting file to %s: file already exists and is different: %s", poolPath, g)
|
||||
}
|
||||
}
|
||||
|
||||
source, err := sourcePool.Open(sourcePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() { _ = source.Close() }()
|
||||
|
||||
if g.debug {
|
||||
log.Debug().Msgf("GCS: LinkFromPool '%s'", relPath)
|
||||
}
|
||||
|
||||
err = g.putFile(relPath, source, sourceMD5)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, fmt.Sprintf("error uploading %s to %s: %s", sourcePath, g, poolPath))
|
||||
}
|
||||
|
||||
g.pathCache[relPath] = sourceMD5
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Filelist returns list of files under prefix.
|
||||
func (g *PublishedStorage) Filelist(prefix string) ([]string, error) {
|
||||
paths, _, err := g.internalFilelist(prefix)
|
||||
return paths, err
|
||||
}
|
||||
|
||||
func (g *PublishedStorage) internalFilelist(prefix string) ([]string, []string, error) {
|
||||
paths := make([]string, 0, 1024)
|
||||
md5s := make([]string, 0, 1024)
|
||||
|
||||
fullPrefix := filepath.Join(g.prefix, prefix)
|
||||
if fullPrefix != "" {
|
||||
fullPrefix += "/"
|
||||
}
|
||||
|
||||
it := g.bucket.Objects(context.TODO(), &storage.Query{Prefix: fullPrefix})
|
||||
for {
|
||||
attrs, err := it.Next()
|
||||
if err == iterator.Done {
|
||||
break
|
||||
}
|
||||
if err != nil {
|
||||
return nil, nil, errors.WithMessagef(err, "error listing under prefix %s in %s", fullPrefix, g)
|
||||
}
|
||||
|
||||
path := attrs.Name
|
||||
if fullPrefix != "" {
|
||||
path = strings.TrimPrefix(path, fullPrefix)
|
||||
}
|
||||
paths = append(paths, path)
|
||||
|
||||
if attrs.Metadata != nil {
|
||||
if md5, ok := attrs.Metadata["Md5"]; ok && md5 != "" {
|
||||
md5s = append(md5s, strings.ToLower(md5))
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
md5s = append(md5s, strings.ToLower(hex.EncodeToString(attrs.MD5)))
|
||||
}
|
||||
|
||||
return paths, md5s, nil
|
||||
}
|
||||
|
||||
// RenameFile renames (moves) file.
|
||||
func (g *PublishedStorage) RenameFile(oldName, newName string) error {
|
||||
src := g.objectHandle(oldName)
|
||||
dst := g.objectHandle(newName)
|
||||
|
||||
if g.debug {
|
||||
log.Debug().Msgf("GCS: RenameFile %s -> %s", oldName, newName)
|
||||
}
|
||||
|
||||
_, err := dst.CopierFrom(src).Run(context.TODO())
|
||||
if err != nil {
|
||||
return fmt.Errorf("error copying %s -> %s in %s: %s", oldName, newName, g, err)
|
||||
}
|
||||
|
||||
err = g.applyACL(dst)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return g.Remove(oldName)
|
||||
}
|
||||
|
||||
// SymLink creates a copy of src file and stores link information in metadata.
|
||||
func (g *PublishedStorage) SymLink(src string, dst string) error {
|
||||
source := g.objectHandle(src)
|
||||
dest := g.objectHandle(dst)
|
||||
|
||||
if g.debug {
|
||||
log.Debug().Msgf("GCS: SymLink %s -> %s", src, dst)
|
||||
}
|
||||
|
||||
_, err := dest.CopierFrom(source).Run(context.TODO())
|
||||
if err != nil {
|
||||
return fmt.Errorf("error symlinking %s -> %s in %s: %s", src, dst, g, err)
|
||||
}
|
||||
|
||||
_, err = dest.Update(context.TODO(), storage.ObjectAttrsToUpdate{
|
||||
Metadata: map[string]string{"SymLink": src},
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("error updating symlink metadata %s -> %s in %s: %s", src, dst, g, err)
|
||||
}
|
||||
|
||||
return g.applyACL(dest)
|
||||
}
|
||||
|
||||
// HardLink uses symlink functionality as hard links do not exist on object stores.
|
||||
func (g *PublishedStorage) HardLink(src string, dst string) error {
|
||||
if g.debug {
|
||||
log.Debug().Msgf("GCS: HardLink %s -> %s", src, dst)
|
||||
}
|
||||
|
||||
return g.SymLink(src, dst)
|
||||
}
|
||||
|
||||
// FileExists returns true if path exists.
|
||||
func (g *PublishedStorage) FileExists(path string) (bool, error) {
|
||||
_, err := g.objectHandle(path).Attrs(context.TODO())
|
||||
if err != nil {
|
||||
if err == storage.ErrObjectNotExist {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
var apiErr *googleapi.Error
|
||||
if errors.As(err, &apiErr) && apiErr.Code == 404 {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// ReadLink returns symbolic link target from metadata.
|
||||
func (g *PublishedStorage) ReadLink(path string) (string, error) {
|
||||
attrs, err := g.objectHandle(path).Attrs(context.TODO())
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return attrs.Metadata["SymLink"], nil
|
||||
}
|
||||
@@ -0,0 +1,530 @@
|
||||
package gcs
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
"cloud.google.com/go/storage"
|
||||
"github.com/fsouza/fake-gcs-server/fakestorage"
|
||||
. "gopkg.in/check.v1"
|
||||
|
||||
"github.com/aptly-dev/aptly/files"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
)
|
||||
|
||||
type PublishedStorageSuite struct {
|
||||
srv *fakestorage.Server
|
||||
prevEmulatorHost string
|
||||
prevEmulatorHostSet bool
|
||||
storage, prefixedStorage *PublishedStorage
|
||||
noSuchBucketStorage *PublishedStorage
|
||||
}
|
||||
|
||||
var _ = Suite(&PublishedStorageSuite{})
|
||||
|
||||
func (s *PublishedStorageSuite) SetUpTest(c *C) {
|
||||
var err error
|
||||
s.srv, err = fakestorage.NewServerWithOptions(fakestorage.Options{
|
||||
Scheme: "http",
|
||||
Host: "127.0.0.1",
|
||||
})
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(s.srv, NotNil)
|
||||
|
||||
s.srv.CreateBucketWithOpts(fakestorage.CreateBucketOpts{Name: "test"})
|
||||
|
||||
// The cloud.google.com/go/storage client honors STORAGE_EMULATOR_HOST and
|
||||
// will route all requests (including media uploads) to the fake server.
|
||||
s.prevEmulatorHost, s.prevEmulatorHostSet = os.LookupEnv("STORAGE_EMULATOR_HOST")
|
||||
c.Assert(os.Setenv("STORAGE_EMULATOR_HOST", s.srv.URL()), IsNil)
|
||||
|
||||
s.storage, err = NewPublishedStorage("test", "", "", "", "", "", "", "", "", false, false)
|
||||
c.Assert(err, IsNil)
|
||||
s.prefixedStorage, err = NewPublishedStorage("test", "lala", "", "", "", "", "", "", "", false, false)
|
||||
c.Assert(err, IsNil)
|
||||
s.noSuchBucketStorage, err = NewPublishedStorage("no-bucket", "", "", "", "", "", "", "", "", false, false)
|
||||
c.Assert(err, IsNil)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TearDownTest(c *C) {
|
||||
if s.prevEmulatorHostSet {
|
||||
_ = os.Setenv("STORAGE_EMULATOR_HOST", s.prevEmulatorHost)
|
||||
} else {
|
||||
_ = os.Unsetenv("STORAGE_EMULATOR_HOST")
|
||||
}
|
||||
s.srv.Stop()
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) GetFile(c *C, path string) []byte {
|
||||
r, err := s.storage.bucket.Object(path).NewReader(context.TODO())
|
||||
c.Assert(err, IsNil)
|
||||
defer func() { _ = r.Close() }()
|
||||
|
||||
body, err := io.ReadAll(r)
|
||||
c.Assert(err, IsNil)
|
||||
return body
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) AssertNoFile(c *C, path string) {
|
||||
_, err := s.storage.bucket.Object(path).Attrs(context.TODO())
|
||||
c.Assert(errors.Is(err, storage.ErrObjectNotExist), Equals, true)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) PutFile(c *C, path string, data []byte) {
|
||||
w := s.storage.bucket.Object(path).NewWriter(context.TODO())
|
||||
_, err := w.Write(data)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(w.Close(), IsNil)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestString(c *C) {
|
||||
c.Check(s.storage.String(), Equals, "GCS: test/")
|
||||
c.Check(s.prefixedStorage.String(), Equals, "GCS: test/lala")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestMkDir(c *C) {
|
||||
c.Check(s.storage.MkDir("anything"), IsNil)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestApplyACLNoOpModes(c *C) {
|
||||
for _, acl := range []string{"", "none", "private"} {
|
||||
st := &PublishedStorage{acl: acl}
|
||||
c.Check(st.applyACL(nil), IsNil)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestApplyACLUnsupported(c *C) {
|
||||
st := &PublishedStorage{acl: "bucket-owner-full-control"}
|
||||
err := st.applyACL(nil)
|
||||
c.Assert(err, NotNil)
|
||||
c.Check(err, ErrorMatches, "unsupported GCS ACL value: bucket-owner-full-control")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestPutFile(c *C) {
|
||||
dir := c.MkDir()
|
||||
err := os.WriteFile(filepath.Join(dir, "a"), []byte("welcome to gcs!"), 0644)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
err = s.storage.PutFile("a/b.txt", filepath.Join(dir, "a"))
|
||||
c.Check(err, IsNil)
|
||||
c.Check(s.GetFile(c, "a/b.txt"), DeepEquals, []byte("welcome to gcs!"))
|
||||
|
||||
err = s.prefixedStorage.PutFile("a/b.txt", filepath.Join(dir, "a"))
|
||||
c.Check(err, IsNil)
|
||||
c.Check(s.GetFile(c, "lala/a/b.txt"), DeepEquals, []byte("welcome to gcs!"))
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestPutFileMissingSource(c *C) {
|
||||
err := s.storage.PutFile("a/b.txt", filepath.Join(c.MkDir(), "does-not-exist"))
|
||||
c.Check(err, ErrorMatches, ".*no such file or directory.*")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestFilelist(c *C) {
|
||||
paths := []string{"a", "b", "c", "testa", "test/a", "test/b", "lala/a", "lala/b", "lala/c"}
|
||||
for _, path := range paths {
|
||||
s.PutFile(c, path, []byte("test"))
|
||||
}
|
||||
|
||||
list, err := s.storage.Filelist("")
|
||||
c.Check(err, IsNil)
|
||||
sort.Strings(list)
|
||||
c.Check(list, DeepEquals, []string{"a", "b", "c", "lala/a", "lala/b", "lala/c", "test/a", "test/b", "testa"})
|
||||
|
||||
list, err = s.storage.Filelist("test")
|
||||
c.Check(err, IsNil)
|
||||
sort.Strings(list)
|
||||
c.Check(list, DeepEquals, []string{"a", "b"})
|
||||
|
||||
list, err = s.storage.Filelist("test2")
|
||||
c.Check(err, IsNil)
|
||||
c.Check(list, DeepEquals, []string{})
|
||||
|
||||
list, err = s.prefixedStorage.Filelist("")
|
||||
c.Check(err, IsNil)
|
||||
sort.Strings(list)
|
||||
c.Check(list, DeepEquals, []string{"a", "b", "c"})
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestRemove(c *C) {
|
||||
s.PutFile(c, "a/b", []byte("test"))
|
||||
|
||||
err := s.storage.Remove("a/b")
|
||||
c.Check(err, IsNil)
|
||||
|
||||
s.AssertNoFile(c, "a/b")
|
||||
|
||||
s.PutFile(c, "lala/xyz", []byte("test"))
|
||||
|
||||
err = s.prefixedStorage.Remove("xyz")
|
||||
c.Check(err, IsNil)
|
||||
|
||||
s.AssertNoFile(c, "lala/xyz")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestRemoveMissing(c *C) {
|
||||
c.Check(s.storage.Remove("does/not/exist"), IsNil)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestRemoveDirs(c *C) {
|
||||
paths := []string{"a", "b", "c", "testa", "test/a", "test/b", "lala/a", "lala/b", "lala/c"}
|
||||
for _, path := range paths {
|
||||
s.PutFile(c, path, []byte("test"))
|
||||
}
|
||||
|
||||
err := s.storage.RemoveDirs("test", nil)
|
||||
c.Check(err, IsNil)
|
||||
|
||||
list, err := s.storage.Filelist("")
|
||||
c.Check(err, IsNil)
|
||||
sort.Strings(list)
|
||||
c.Check(list, DeepEquals, []string{"a", "b", "c", "lala/a", "lala/b", "lala/c", "testa"})
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestRenameFile(c *C) {
|
||||
s.PutFile(c, "src", []byte("payload"))
|
||||
|
||||
err := s.storage.RenameFile("src", "dst")
|
||||
c.Check(err, IsNil)
|
||||
|
||||
c.Check(s.GetFile(c, "dst"), DeepEquals, []byte("payload"))
|
||||
s.AssertNoFile(c, "src")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestSymLink(c *C) {
|
||||
s.PutFile(c, "a/b", []byte("test"))
|
||||
|
||||
err := s.storage.SymLink("a/b", "a/b.link")
|
||||
c.Check(err, IsNil)
|
||||
|
||||
link, err := s.storage.ReadLink("a/b.link")
|
||||
c.Check(err, IsNil)
|
||||
c.Check(link, Equals, "a/b")
|
||||
|
||||
c.Check(s.GetFile(c, "a/b.link"), DeepEquals, []byte("test"))
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestHardLink(c *C) {
|
||||
s.PutFile(c, "a/b", []byte("test"))
|
||||
|
||||
err := s.storage.HardLink("a/b", "a/b.hard")
|
||||
c.Check(err, IsNil)
|
||||
|
||||
link, err := s.storage.ReadLink("a/b.hard")
|
||||
c.Check(err, IsNil)
|
||||
c.Check(link, Equals, "a/b")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestFileExists(c *C) {
|
||||
s.PutFile(c, "a/b", []byte("test"))
|
||||
|
||||
exists, err := s.storage.FileExists("a/b")
|
||||
c.Check(err, IsNil)
|
||||
c.Check(exists, Equals, true)
|
||||
|
||||
exists, err = s.storage.FileExists("a/b.invalid")
|
||||
c.Check(err, IsNil)
|
||||
c.Check(exists, Equals, false)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestObjectPath(c *C) {
|
||||
st := &PublishedStorage{prefix: "root"}
|
||||
c.Check(st.objectPath("dists/stable/Release"), Equals, filepath.Join("root", "dists/stable/Release"))
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestLinkFromPool(c *C) {
|
||||
root := c.MkDir()
|
||||
pool := files.NewPackagePool(root, false)
|
||||
cs := files.NewMockChecksumStorage()
|
||||
|
||||
tmpFile1 := filepath.Join(c.MkDir(), "mars-invaders_1.03.deb")
|
||||
c.Assert(os.WriteFile(tmpFile1, []byte("Contents"), 0644), IsNil)
|
||||
cksum1 := utils.ChecksumInfo{MD5: "c1df1da7a1ce305a3b60af9d5733ac1d"}
|
||||
|
||||
tmpFile2 := filepath.Join(c.MkDir(), "mars-invaders_1.03.deb")
|
||||
c.Assert(os.WriteFile(tmpFile2, []byte("Spam"), 0644), IsNil)
|
||||
cksum2 := utils.ChecksumInfo{MD5: "e9dfd31cc505d51fc26975250750deab"}
|
||||
|
||||
tmpFile3 := filepath.Join(c.MkDir(), "netboot/boot.img.gz")
|
||||
_ = os.MkdirAll(filepath.Dir(tmpFile3), 0777)
|
||||
c.Assert(os.WriteFile(tmpFile3, []byte("Contents"), 0644), IsNil)
|
||||
cksum3 := utils.ChecksumInfo{MD5: "c1df1da7a1ce305a3b60af9d5733ac1d"}
|
||||
|
||||
src1, err := pool.Import(tmpFile1, "mars-invaders_1.03.deb", &cksum1, true, cs)
|
||||
c.Assert(err, IsNil)
|
||||
src2, err := pool.Import(tmpFile2, "mars-invaders_1.03.deb", &cksum2, true, cs)
|
||||
c.Assert(err, IsNil)
|
||||
src3, err := pool.Import(tmpFile3, "netboot/boot.img.gz", &cksum3, true, cs)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
// first link from pool
|
||||
err = s.storage.LinkFromPool("", filepath.Join("pool", "main", "m/mars-invaders"), "mars-invaders_1.03.deb", pool, src1, cksum1, false)
|
||||
c.Check(err, IsNil)
|
||||
c.Check(s.GetFile(c, "pool/main/m/mars-invaders/mars-invaders_1.03.deb"), DeepEquals, []byte("Contents"))
|
||||
|
||||
// duplicate link from pool (same MD5 → no-op)
|
||||
err = s.storage.LinkFromPool("", filepath.Join("pool", "main", "m/mars-invaders"), "mars-invaders_1.03.deb", pool, src1, cksum1, false)
|
||||
c.Check(err, IsNil)
|
||||
c.Check(s.GetFile(c, "pool/main/m/mars-invaders/mars-invaders_1.03.deb"), DeepEquals, []byte("Contents"))
|
||||
|
||||
// link from pool with conflict, no force
|
||||
err = s.storage.LinkFromPool("", filepath.Join("pool", "main", "m/mars-invaders"), "mars-invaders_1.03.deb", pool, src2, cksum2, false)
|
||||
c.Check(err, ErrorMatches, ".*file already exists and is different.*")
|
||||
c.Check(s.GetFile(c, "pool/main/m/mars-invaders/mars-invaders_1.03.deb"), DeepEquals, []byte("Contents"))
|
||||
|
||||
// link from pool with conflict and force
|
||||
err = s.storage.LinkFromPool("", filepath.Join("pool", "main", "m/mars-invaders"), "mars-invaders_1.03.deb", pool, src2, cksum2, true)
|
||||
c.Check(err, IsNil)
|
||||
c.Check(s.GetFile(c, "pool/main/m/mars-invaders/mars-invaders_1.03.deb"), DeepEquals, []byte("Spam"))
|
||||
|
||||
// for prefixed storage:
|
||||
err = s.prefixedStorage.LinkFromPool("", filepath.Join("pool", "main", "m/mars-invaders"), "mars-invaders_1.03.deb", pool, src1, cksum1, false)
|
||||
c.Check(err, IsNil)
|
||||
|
||||
// 2nd link from pool, providing wrong path for source file:
|
||||
// should hit the path cache and skip upload (which would otherwise fail).
|
||||
err = s.prefixedStorage.LinkFromPool("", filepath.Join("pool", "main", "m/mars-invaders"), "mars-invaders_1.03.deb", pool, "wrong-looks-like-pathcache-doesnt-work", cksum1, false)
|
||||
c.Check(err, IsNil)
|
||||
c.Check(s.GetFile(c, "lala/pool/main/m/mars-invaders/mars-invaders_1.03.deb"), DeepEquals, []byte("Contents"))
|
||||
|
||||
// link from pool with nested file name
|
||||
err = s.storage.LinkFromPool("", "dists/jessie/non-free/installer-i386/current/images", "netboot/boot.img.gz", pool, src3, cksum3, false)
|
||||
c.Check(err, IsNil)
|
||||
c.Check(s.GetFile(c, "dists/jessie/non-free/installer-i386/current/images/netboot/boot.img.gz"), DeepEquals, []byte("Contents"))
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestLinkFromPoolMissingMD5(c *C) {
|
||||
publishedPrefix := "repo"
|
||||
publishedRelPath := "pool/main/a/aptly"
|
||||
fileName := "pkg.deb"
|
||||
relPath := filepath.Join(filepath.Join(publishedPrefix, publishedRelPath), fileName)
|
||||
|
||||
st := &PublishedStorage{pathCache: map[string]string{relPath: "0123456789abcdef0123456789abcdef"}}
|
||||
|
||||
err := st.LinkFromPool(publishedPrefix, publishedRelPath, fileName, nil, "", utils.ChecksumInfo{}, false)
|
||||
c.Assert(err, NotNil)
|
||||
c.Check(err, ErrorMatches, "unable to compare object, MD5 checksum missing")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestLinkFromPoolDifferentMD5NoForce(c *C) {
|
||||
publishedPrefix := "repo"
|
||||
publishedRelPath := "pool/main/a/aptly"
|
||||
fileName := "pkg.deb"
|
||||
relPath := filepath.Join(filepath.Join(publishedPrefix, publishedRelPath), fileName)
|
||||
|
||||
st := &PublishedStorage{pathCache: map[string]string{relPath: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}}
|
||||
|
||||
err := st.LinkFromPool(publishedPrefix, publishedRelPath, fileName, nil, "", utils.ChecksumInfo{MD5: "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"}, false)
|
||||
c.Assert(err, NotNil)
|
||||
c.Check(err, ErrorMatches, ".*file already exists and is different.*")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestLinkFromPoolSameMD5NoUpload(c *C) {
|
||||
publishedPrefix := "repo"
|
||||
publishedRelPath := "pool/main/a/aptly"
|
||||
fileName := "pkg.deb"
|
||||
relPath := filepath.Join(filepath.Join(publishedPrefix, publishedRelPath), fileName)
|
||||
|
||||
st := &PublishedStorage{pathCache: map[string]string{relPath: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}}
|
||||
|
||||
err := st.LinkFromPool(publishedPrefix, publishedRelPath, fileName, nil, "", utils.ChecksumInfo{MD5: "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}, false)
|
||||
c.Check(err, IsNil)
|
||||
}
|
||||
|
||||
// putWithMetadata uploads an object with arbitrary metadata directly via the
|
||||
// storage client, bypassing the production putFile path. Used to seed objects
|
||||
// that exercise getMD5 / metadata-handling branches.
|
||||
func (s *PublishedStorageSuite) putWithMetadata(c *C, path string, data []byte, metadata map[string]string) {
|
||||
w := s.storage.bucket.Object(path).NewWriter(context.TODO())
|
||||
w.Metadata = metadata
|
||||
_, err := w.Write(data)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(w.Close(), IsNil)
|
||||
}
|
||||
|
||||
// TestLinkFromPoolShortCachedMD5 exercises the LinkFromPool branch where the
|
||||
// path cache holds a non-32-char checksum (so getMD5 must be called to fetch
|
||||
// the real MD5 from object attrs), and along the way covers getMD5 plus the
|
||||
// Md5-metadata branch in internalFilelist.
|
||||
func (s *PublishedStorageSuite) TestLinkFromPoolShortCachedMD5(c *C) {
|
||||
root := c.MkDir()
|
||||
pool := files.NewPackagePool(root, false)
|
||||
cs := files.NewMockChecksumStorage()
|
||||
|
||||
tmpFile := filepath.Join(c.MkDir(), "mars-invaders_1.03.deb")
|
||||
c.Assert(os.WriteFile(tmpFile, []byte("Contents"), 0644), IsNil)
|
||||
cksum := utils.ChecksumInfo{MD5: "c1df1da7a1ce305a3b60af9d5733ac1d"}
|
||||
|
||||
src, err := pool.Import(tmpFile, "mars-invaders_1.03.deb", &cksum, true, cs)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
// Seed the bucket with a short Md5 metadata value so internalFilelist
|
||||
// returns it (covering the metadata branch) and LinkFromPool then has to
|
||||
// re-fetch via getMD5 because len != 32.
|
||||
relPath := filepath.Join("pool/main/m/mars-invaders", "mars-invaders_1.03.deb")
|
||||
s.putWithMetadata(c, relPath, []byte("Contents"), map[string]string{"Md5": "short"})
|
||||
|
||||
// force=true so the conflict (the seeded "short" md5 will never match
|
||||
// sourceMD5 once getMD5 normalises) resolves into a fresh upload rather
|
||||
// than an error — what matters here is that we traverse the getMD5 +
|
||||
// short-cache + internalFilelist md5-metadata branches.
|
||||
err = s.storage.LinkFromPool("", "pool/main/m/mars-invaders", "mars-invaders_1.03.deb", pool, src, cksum, true)
|
||||
c.Check(err, IsNil)
|
||||
}
|
||||
|
||||
// TestLinkFromPoolMissingSource covers the source-pool open error path.
|
||||
func (s *PublishedStorageSuite) TestLinkFromPoolMissingSource(c *C) {
|
||||
pool := files.NewPackagePool(c.MkDir(), false)
|
||||
|
||||
err := s.storage.LinkFromPool("", "pool/x", "y.deb", pool, "non-existent-pool-key", utils.ChecksumInfo{MD5: "33333333333333333333333333333333"}, false)
|
||||
c.Check(err, ErrorMatches, ".*no such file or directory.*")
|
||||
}
|
||||
|
||||
// TestPutFilePublicReadACL covers the applyACL public-read branch and the
|
||||
// ACL().Set call against the fake server.
|
||||
func (s *PublishedStorageSuite) TestPutFilePublicReadACL(c *C) {
|
||||
st, err := NewPublishedStorage("test", "", "", "", "", "", "public-read", "", "", false, false)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
dir := c.MkDir()
|
||||
src := filepath.Join(dir, "f")
|
||||
c.Assert(os.WriteFile(src, []byte("hello"), 0644), IsNil)
|
||||
|
||||
c.Check(st.PutFile("a/b.txt", src), IsNil)
|
||||
c.Check(s.GetFile(c, "a/b.txt"), DeepEquals, []byte("hello"))
|
||||
}
|
||||
|
||||
// TestPutFileUnsupportedACL covers the default (error) branch of applyACL
|
||||
// when invoked from the production putFile flow.
|
||||
func (s *PublishedStorageSuite) TestPutFileUnsupportedACL(c *C) {
|
||||
st, err := NewPublishedStorage("test", "", "", "", "", "", "bucket-owner-full-control", "", "", false, false)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
dir := c.MkDir()
|
||||
src := filepath.Join(dir, "f")
|
||||
c.Assert(os.WriteFile(src, []byte("hello"), 0644), IsNil)
|
||||
|
||||
err = st.PutFile("a/b.txt", src)
|
||||
c.Assert(err, NotNil)
|
||||
c.Check(err, ErrorMatches, ".*unsupported GCS ACL value.*")
|
||||
}
|
||||
|
||||
// TestPutFileWithStorageClass covers the storageClass branch in putFile.
|
||||
func (s *PublishedStorageSuite) TestPutFileWithStorageClass(c *C) {
|
||||
st, err := NewPublishedStorage("test", "", "", "", "", "", "", "NEARLINE", "", false, false)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
dir := c.MkDir()
|
||||
src := filepath.Join(dir, "f")
|
||||
c.Assert(os.WriteFile(src, []byte("hi"), 0644), IsNil)
|
||||
|
||||
c.Check(st.PutFile("a/b.txt", src), IsNil)
|
||||
|
||||
attrs, err := s.storage.bucket.Object("a/b.txt").Attrs(context.TODO())
|
||||
c.Assert(err, IsNil)
|
||||
c.Check(attrs.StorageClass, Equals, "NEARLINE")
|
||||
}
|
||||
|
||||
// TestRemoveDirsNoSuchBucket covers the internalFilelist error path inside
|
||||
// RemoveDirs (and the iterator error branch in internalFilelist itself).
|
||||
func (s *PublishedStorageSuite) TestRemoveDirsNoSuchBucket(c *C) {
|
||||
err := s.noSuchBucketStorage.RemoveDirs("a/b", nil)
|
||||
c.Check(err, ErrorMatches, ".*error listing under prefix.*")
|
||||
}
|
||||
|
||||
// TestFilelistNoSuchBucket also covers the iterator error path.
|
||||
func (s *PublishedStorageSuite) TestFilelistNoSuchBucket(c *C) {
|
||||
_, err := s.noSuchBucketStorage.Filelist("")
|
||||
c.Check(err, ErrorMatches, ".*error listing under prefix.*")
|
||||
}
|
||||
|
||||
// TestRemoveCacheEviction verifies that a successful Remove evicts the entry
|
||||
// from pathCache (covers the delete(g.pathCache, ...) line).
|
||||
func (s *PublishedStorageSuite) TestRemoveCacheEviction(c *C) {
|
||||
s.PutFile(c, "a/b", []byte("test"))
|
||||
|
||||
s.storage.pathCache = map[string]string{"a/b": "deadbeefdeadbeefdeadbeefdeadbeef"}
|
||||
c.Check(s.storage.Remove("a/b"), IsNil)
|
||||
_, present := s.storage.pathCache["a/b"]
|
||||
c.Check(present, Equals, false)
|
||||
}
|
||||
|
||||
// TestDebugMode exercises the if-debug log branches across the main verbs.
|
||||
func (s *PublishedStorageSuite) TestDebugMode(c *C) {
|
||||
st, err := NewPublishedStorage("test", "", "", "", "", "", "", "", "", false, true)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
dir := c.MkDir()
|
||||
src := filepath.Join(dir, "f")
|
||||
c.Assert(os.WriteFile(src, []byte("dbg"), 0644), IsNil)
|
||||
|
||||
c.Check(st.PutFile("d/a", src), IsNil)
|
||||
c.Check(st.RenameFile("d/a", "d/b"), IsNil)
|
||||
c.Check(st.SymLink("d/b", "d/b.link"), IsNil)
|
||||
c.Check(st.HardLink("d/b", "d/b.hard"), IsNil)
|
||||
c.Check(st.Remove("d/b"), IsNil)
|
||||
c.Check(st.RemoveDirs("d", nil), IsNil)
|
||||
|
||||
pool := files.NewPackagePool(c.MkDir(), false)
|
||||
cs := files.NewMockChecksumStorage()
|
||||
tmp := filepath.Join(c.MkDir(), "x.deb")
|
||||
c.Assert(os.WriteFile(tmp, []byte("Contents"), 0644), IsNil)
|
||||
cksum := utils.ChecksumInfo{MD5: "c1df1da7a1ce305a3b60af9d5733ac1d"}
|
||||
srcKey, err := pool.Import(tmp, "x.deb", &cksum, true, cs)
|
||||
c.Assert(err, IsNil)
|
||||
c.Check(st.LinkFromPool("", "pool/x", "x.deb", pool, srcKey, cksum, false), IsNil)
|
||||
}
|
||||
|
||||
// TestObjectHandleWithEncryptionKey covers the encryptionKey branch in
|
||||
// objectHandle. fsouza doesn't enforce CSEK headers but we just need to walk
|
||||
// the code path.
|
||||
func (s *PublishedStorageSuite) TestObjectHandleWithEncryptionKey(c *C) {
|
||||
st := &PublishedStorage{
|
||||
bucket: s.storage.bucket,
|
||||
bucketName: "test",
|
||||
encryptionKey: "0123456789abcdef0123456789abcdef",
|
||||
}
|
||||
c.Check(st.objectHandle("a/b"), NotNil)
|
||||
}
|
||||
|
||||
// TestReadLinkMissing covers the Attrs-error return in ReadLink.
|
||||
func (s *PublishedStorageSuite) TestReadLinkMissing(c *C) {
|
||||
_, err := s.storage.ReadLink("does/not/exist")
|
||||
c.Check(err, ErrorMatches, ".*object doesn't exist.*")
|
||||
}
|
||||
|
||||
// TestFileExistsNoSuchBucket exercises FileExists' wrapped-googleapi-404 path.
|
||||
func (s *PublishedStorageSuite) TestFileExistsNoSuchBucket(c *C) {
|
||||
exists, err := s.noSuchBucketStorage.FileExists("a/b")
|
||||
c.Check(err, IsNil)
|
||||
c.Check(exists, Equals, false)
|
||||
}
|
||||
|
||||
// TestNewPublishedStorageWithEndpoint exercises the endpoint-injection branch
|
||||
// in NewPublishedStorage (the production knob, separate from the env-var path).
|
||||
func (s *PublishedStorageSuite) TestNewPublishedStorageWithEndpoint(c *C) {
|
||||
saved := os.Getenv("STORAGE_EMULATOR_HOST")
|
||||
c.Assert(os.Unsetenv("STORAGE_EMULATOR_HOST"), IsNil)
|
||||
defer func() { _ = os.Setenv("STORAGE_EMULATOR_HOST", saved) }()
|
||||
|
||||
st, err := NewPublishedStorage("test", "", "", "", "", s.srv.URL()+"/storage/v1/", "", "", "", false, false)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
_, err = st.Filelist("")
|
||||
c.Check(err, IsNil)
|
||||
}
|
||||
|
||||
// TestNewPublishedStorageWithProject covers the project!="" → WithQuotaProject
|
||||
// branch. WithQuotaProject is incompatible with WithEndpoint, so this test
|
||||
// relies on the STORAGE_EMULATOR_HOST env var (still set from SetUpTest) for
|
||||
// fake-server routing.
|
||||
func (s *PublishedStorageSuite) TestNewPublishedStorageWithProject(c *C) {
|
||||
st, err := NewPublishedStorage("test", "", "", "", "fake-project", "", "", "", "", false, false)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
_, err = st.Filelist("")
|
||||
c.Check(err, IsNil)
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
module github.com/aptly-dev/aptly
|
||||
|
||||
go 1.24.0
|
||||
go 1.25.0
|
||||
|
||||
require (
|
||||
github.com/AlekSi/pointer v1.1.0
|
||||
@@ -13,8 +13,8 @@ require (
|
||||
github.com/h2non/filetype v1.1.3
|
||||
github.com/jlaffaye/ftp v0.2.0 // indirect
|
||||
github.com/kjk/lzma v0.0.0-20120628231508-2a7c55cad4a2
|
||||
github.com/klauspost/compress v1.17.9
|
||||
github.com/klauspost/pgzip v1.2.5
|
||||
github.com/klauspost/compress v1.18.2
|
||||
github.com/klauspost/pgzip v1.2.6
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.15 // indirect
|
||||
github.com/mattn/go-shellwords v1.0.12
|
||||
@@ -32,17 +32,34 @@ require (
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d
|
||||
github.com/ugorji/go/codec v1.2.11
|
||||
github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0
|
||||
golang.org/x/crypto v0.46.0 // indirect
|
||||
golang.org/x/sys v0.39.0
|
||||
golang.org/x/term v0.38.0
|
||||
golang.org/x/time v0.5.0
|
||||
google.golang.org/protobuf v1.36.10 // indirect
|
||||
golang.org/x/crypto v0.50.0 // indirect
|
||||
golang.org/x/sys v0.43.0
|
||||
golang.org/x/term v0.42.0
|
||||
golang.org/x/time v0.14.0
|
||||
google.golang.org/protobuf v1.36.11 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
|
||||
)
|
||||
|
||||
require (
|
||||
cel.dev/expr v0.25.1 // indirect
|
||||
cloud.google.com/go v0.123.0 // indirect
|
||||
cloud.google.com/go/auth v0.18.1 // indirect
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.9.0 // indirect
|
||||
github.com/Azure/azure-pipeline-go v0.2.3 // indirect
|
||||
cloud.google.com/go/iam v1.5.3 // indirect
|
||||
cloud.google.com/go/monitoring v1.24.3 // indirect
|
||||
cloud.google.com/go/pubsub/v2 v2.4.0 // indirect
|
||||
dario.cat/mergo v1.0.1 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
|
||||
github.com/CycloneDX/cyclonedx-go v0.9.2 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.55.0 // indirect
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.55.0 // indirect
|
||||
github.com/KyleBanks/depth v1.2.1 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.2 // indirect
|
||||
github.com/PuerkitoBio/purell v1.1.1 // indirect
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
|
||||
github.com/andybalholm/brotli v1.1.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.8 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.20 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.21 // indirect
|
||||
@@ -61,60 +78,129 @@ require (
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
|
||||
github.com/cloudflare/circl v1.6.3 // indirect
|
||||
github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 // indirect
|
||||
github.com/coreos/go-semver v0.3.0 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.6.1 // indirect
|
||||
github.com/dsnet/compress v0.0.1 // indirect
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.36.0 // indirect
|
||||
github.com/envoyproxy/protoc-gen-validate v1.3.0 // indirect
|
||||
github.com/fatih/color v1.17.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/forPelevin/gomoji v1.3.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.9.0 // indirect
|
||||
github.com/go-git/go-git/v5 v5.19.1 // indirect
|
||||
github.com/go-jose/go-jose/v4 v4.1.4 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||
github.com/go-openapi/jsonreference v0.19.6 // indirect
|
||||
github.com/go-openapi/spec v0.20.4 // indirect
|
||||
github.com/go-openapi/swag v0.19.15 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/google/renameio/v2 v2.0.0 // indirect
|
||||
github.com/google/s2a-go v0.1.9 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.11 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.17.0 // indirect
|
||||
github.com/gookit/color v1.5.4 // indirect
|
||||
github.com/gorilla/handlers v1.5.2 // indirect
|
||||
github.com/gorilla/mux v1.8.1 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/jfrog/archiver/v3 v3.6.1 // indirect
|
||||
github.com/jfrog/build-info-go v1.11.0 // indirect
|
||||
github.com/jfrog/gofrog v1.7.6 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/leodido/go-urn v1.2.4 // indirect
|
||||
github.com/mattn/go-ieproxy v0.0.1 // indirect
|
||||
github.com/mailru/easyjson v0.7.6 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/minio/sha256-simd v1.0.1 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/nwaples/rardecode v1.1.3 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/pierrec/lz4/v4 v4.1.22 // indirect
|
||||
github.com/pjbgf/sha1cd v0.6.0 // indirect
|
||||
github.com/pkg/xattr v0.4.12 // indirect
|
||||
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.59.1 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.14.1 // indirect
|
||||
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
|
||||
github.com/skeema/knownhosts v1.3.1 // indirect
|
||||
github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ulikunitz/xz v0.5.15 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
|
||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.15 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.15 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
|
||||
go.opentelemetry.io/contrib/detectors/gcp v1.39.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
|
||||
go.opentelemetry.io/otel v1.43.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.43.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.43.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk/metric v1.43.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.43.0 // indirect
|
||||
go.uber.org/multierr v1.10.0 // indirect
|
||||
go.uber.org/zap v1.26.0 // indirect
|
||||
golang.org/x/arch v0.3.0 // indirect
|
||||
golang.org/x/net v0.48.0 // indirect
|
||||
golang.org/x/sync v0.19.0 // indirect
|
||||
golang.org/x/text v0.32.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 // indirect
|
||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f // indirect
|
||||
golang.org/x/net v0.53.0 // indirect
|
||||
golang.org/x/sync v0.20.0 // indirect
|
||||
golang.org/x/text v0.36.0 // indirect
|
||||
golang.org/x/tools v0.44.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20260128011058-8636f8732409 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260203192932-546029d2fa20 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260203192932-546029d2fa20 // indirect
|
||||
google.golang.org/grpc v1.79.3 // indirect
|
||||
gopkg.in/cheggaaa/pb.v1 v1.0.28 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/Azure/azure-storage-blob-go v0.15.0
|
||||
cloud.google.com/go/storage v1.60.0
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.4.1
|
||||
github.com/ProtonMail/go-crypto v1.4.0
|
||||
github.com/aws/aws-sdk-go-v2 v1.41.5
|
||||
github.com/aws/aws-sdk-go-v2/config v1.28.5
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.17.46
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.97.3
|
||||
github.com/aws/smithy-go v1.24.2
|
||||
github.com/fsouza/fake-gcs-server v1.53.1
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/jfrog/jfrog-client-go v1.55.0
|
||||
github.com/swaggo/files v1.0.1
|
||||
github.com/swaggo/gin-swagger v1.6.0
|
||||
github.com/swaggo/swag v1.16.3
|
||||
go.etcd.io/etcd/client/v3 v3.5.15
|
||||
golang.org/x/oauth2 v0.34.0
|
||||
golang.org/x/oauth2 v0.35.0
|
||||
google.golang.org/api v0.266.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
|
||||
@@ -1,26 +1,74 @@
|
||||
cel.dev/expr v0.25.1 h1:1KrZg61W6TWSxuNZ37Xy49ps13NUovb66QLprthtwi4=
|
||||
cel.dev/expr v0.25.1/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.123.0 h1:2NAUJwPR47q+E35uaJeYoNhuNEM9kM8SjgRgdeOJUSE=
|
||||
cloud.google.com/go v0.123.0/go.mod h1:xBoMV08QcqUGuPW65Qfm1o9Y4zKZBpGS+7bImXLTAZU=
|
||||
cloud.google.com/go/auth v0.18.1 h1:IwTEx92GFUo2pJ6Qea0EU3zYvKnTAeRCODxfA/G5UWs=
|
||||
cloud.google.com/go/auth v0.18.1/go.mod h1:GfTYoS9G3CWpRA3Va9doKN9mjPGRS+v41jmZAhBzbrA=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc=
|
||||
cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c=
|
||||
cloud.google.com/go/compute/metadata v0.9.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs=
|
||||
cloud.google.com/go/compute/metadata v0.9.0/go.mod h1:E0bWwX5wTnLPedCKqk3pJmVgCBSM6qQI1yTBdEb3C10=
|
||||
cloud.google.com/go/iam v1.5.3 h1:+vMINPiDF2ognBJ97ABAYYwRgsaqxPbQDlMnbHMjolc=
|
||||
cloud.google.com/go/iam v1.5.3/go.mod h1:MR3v9oLkZCTlaqljW6Eb2d3HGDGK5/bDv93jhfISFvU=
|
||||
cloud.google.com/go/logging v1.13.1 h1:O7LvmO0kGLaHY/gq8cV7T0dyp6zJhYAOtZPX4TF3QtY=
|
||||
cloud.google.com/go/logging v1.13.1/go.mod h1:XAQkfkMBxQRjQek96WLPNze7vsOmay9H5PqfsNYDqvw=
|
||||
cloud.google.com/go/longrunning v0.8.0 h1:LiKK77J3bx5gDLi4SMViHixjD2ohlkwBi+mKA7EhfW8=
|
||||
cloud.google.com/go/longrunning v0.8.0/go.mod h1:UmErU2Onzi+fKDg2gR7dusz11Pe26aknR4kHmJJqIfk=
|
||||
cloud.google.com/go/monitoring v1.24.3 h1:dde+gMNc0UhPZD1Azu6at2e79bfdztVDS5lvhOdsgaE=
|
||||
cloud.google.com/go/monitoring v1.24.3/go.mod h1:nYP6W0tm3N9H/bOw8am7t62YTzZY+zUeQ+Bi6+2eonI=
|
||||
cloud.google.com/go/pubsub/v2 v2.4.0 h1:oMKNiBQpXImRWnHYla9uSU66ZzByZwBSCJOEs/pTKVg=
|
||||
cloud.google.com/go/pubsub/v2 v2.4.0/go.mod h1:2lS/XQKq5qtOMs6kHBK+WX1ytUC36kLl2ig3zqsGUx8=
|
||||
cloud.google.com/go/storage v1.60.0 h1:oBfZrSOCimggVNz9Y/bXY35uUcts7OViubeddTTVzQ8=
|
||||
cloud.google.com/go/storage v1.60.0/go.mod h1:q+5196hXfejkctrnx+VYU8RKQr/L3c0cBIlrjmiAKE0=
|
||||
cloud.google.com/go/trace v1.11.7 h1:kDNDX8JkaAG3R2nq1lIdkb7FCSi1rCmsEtKVsty7p+U=
|
||||
cloud.google.com/go/trace v1.11.7/go.mod h1:TNn9d5V3fQVf6s4SCveVMIBS2LJUqo73GACmq/Tky0s=
|
||||
dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s=
|
||||
dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
|
||||
github.com/AlekSi/pointer v1.1.0 h1:SSDMPcXD9jSl8FPy9cRzoRaMJtm9g9ggGTxecRUbQoI=
|
||||
github.com/AlekSi/pointer v1.1.0/go.mod h1:y7BvfRI3wXPWKXEBhU71nbnIEEZX0QTSB2Bj48UJIZE=
|
||||
github.com/Azure/azure-pipeline-go v0.2.3 h1:7U9HBg1JFK3jHl5qmo4CTZKFTVgMwdFHMVtCdfBE21U=
|
||||
github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k=
|
||||
github.com/Azure/azure-storage-blob-go v0.15.0 h1:rXtgp8tN1p29GvpGgfJetavIG0V7OgcSXPpwp3tx6qk=
|
||||
github.com/Azure/azure-storage-blob-go v0.15.0/go.mod h1:vbjsVbX0dlxnRc4FFMPsS9BsJWPcne7GB7onqlPvz58=
|
||||
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
|
||||
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
|
||||
github.com/Azure/go-autorest/autorest/adal v0.9.13 h1:Mp5hbtOePIzM8pJVRa3YLrWWmZtoxRXqUEzCfJt3+/Q=
|
||||
github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M=
|
||||
github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw=
|
||||
github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=
|
||||
github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
|
||||
github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg=
|
||||
github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
|
||||
github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo=
|
||||
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0 h1:nyQWyZvwGTvunIMxi1Y9uXkcyr+I7TeNrr/foo4Kpk8=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.14.0/go.mod h1:l38EPgmsp71HHLq9j7De57JcKOWPyhrsW1Awm1JS6K0=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 h1:tfLQ34V6F7tVSwoTf/4lH5sE0o6eCJuNDTmH09nDpbc=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0/go.mod h1:9kIvujWAA58nmPmWB1m23fyWic1kYZMxD9CxaWn4Qpg=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.6.0 h1:PiSrjRPpkQNjrM8H0WwKMnZUdu1RGMtd/LdGKUrOo+c=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage v1.6.0/go.mod h1:oDrbWx4ewMylP7xHivfgixbfGBT6APAwsSoHRKotnIc=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.4.1 h1:cf+OIKbkmMHBaC3u78AXomweqM0oxQSgBXRZf3WH4yM=
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.4.1/go.mod h1:ap1dmS6vQKJxSMNiGJcq4QuUQkOynyD93gLw6MDF7ek=
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU=
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/CycloneDX/cyclonedx-go v0.9.2 h1:688QHn2X/5nRezKe2ueIVCt+NRqf7fl3AVQk+vaFcIo=
|
||||
github.com/CycloneDX/cyclonedx-go v0.9.2/go.mod h1:vcK6pKgO1WanCdd61qx4bFnSsDJQ6SbM2ZuMIgq86Jg=
|
||||
github.com/DisposaBoy/JsonConfigReader v0.0.0-20171218180944-5ea4d0ddac55 h1:jbGlDKdzAZ92NzK65hUP98ri0/r50vVVvmZsFP/nIqo=
|
||||
github.com/DisposaBoy/JsonConfigReader v0.0.0-20171218180944-5ea4d0ddac55/go.mod h1:GCzqZQHydohgVLSIqRKZeTt8IGb1Y4NaFfim3H40uUI=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0 h1:sBEjpZlNHzK1voKq9695PJSX2o5NEXl7/OL3coiIY0c=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0/go.mod h1:P4WPRUkOhJC13W//jWpyfJNDAIpvRbAUIYLX/4jtlE0=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.55.0 h1:UnDZ/zFfG1JhH/DqxIZYU/1CUAlTUScoXD/LcM2Ykk8=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.55.0/go.mod h1:IA1C1U7jO/ENqm/vhi7V9YYpBsp+IMyqNrEN94N7tVc=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.55.0 h1:7t/qx5Ost0s0wbA/VDrByOooURhp+ikYwv20i9Y07TQ=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/cloudmock v0.55.0/go.mod h1:vB2GH9GAYYJTO3mEn8oYwzEdhlayZIdQz6zdzgUIRvA=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.55.0 h1:0s6TxfCu2KHkkZPnBfsQ2y5qia0jl3MMrmBhu3nCOYk=
|
||||
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.55.0/go.mod h1:Mf6O40IAyB9zR/1J8nGDDPirZQQPbYJni8Yisy7NTMc=
|
||||
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
|
||||
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
|
||||
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
|
||||
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
|
||||
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
|
||||
github.com/ProtonMail/go-crypto v1.4.0 h1:Zq/pbM3F5DFgJiMouxEdSVY44MVoQNEKp5d5QxIQceQ=
|
||||
github.com/ProtonMail/go-crypto v1.4.0/go.mod h1:e1OaTyu5SYVrO9gKOEhTc+5UcXtTUa+P3uLudwcgPqo=
|
||||
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
|
||||
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
|
||||
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||
github.com/awalterschulze/gographviz v2.0.1+incompatible h1:XIECBRq9VPEQqkQL5pw2OtjCAdrtIgFKoJU8eT98AS8=
|
||||
github.com/awalterschulze/gographviz v2.0.1+incompatible/go.mod h1:GEV5wmg4YquNw7v1kkyoX9etIk8yVmXj+AkDHuuETHs=
|
||||
github.com/aws/aws-sdk-go-v2 v1.41.5 h1:dj5kopbwUsVUVFgO4Fi5BIT3t4WyqIDjGKCangnV/yY=
|
||||
@@ -61,11 +109,14 @@ github.com/aws/smithy-go v1.24.2 h1:FzA3bu/nt/vDvmnkg+R8Xl46gmzEDam6mZ1hzmwXFng=
|
||||
github.com/aws/smithy-go v1.24.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bradleyjkemp/cupaloy/v2 v2.8.0 h1:any4BmKE+jGIaMpnU8YgH/I2LPiLBufr6oMMlVBbn9M=
|
||||
github.com/bradleyjkemp/cupaloy/v2 v2.8.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0=
|
||||
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
|
||||
github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s=
|
||||
github.com/bytedance/sonic v1.9.1/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U=
|
||||
github.com/cavaliergopher/grab/v3 v3.0.1 h1:4z7TkBfmPjmLAAmkkAZNX/6QJ1nNFdv3SdIHXju0Fr4=
|
||||
github.com/cavaliergopher/grab/v3 v3.0.1/go.mod h1:1U/KNnD+Ft6JJiYoYBAimKH2XrYptb8Kl3DFGmsjpq4=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cheggaaa/pb v1.0.25 h1:tFpebHTkI7QZx1q1rWGOKhbunhZ3fMaxTvHDWn1bH/4=
|
||||
@@ -76,34 +127,93 @@ github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311/go.mod h1:b583j
|
||||
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
|
||||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
|
||||
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg8=
|
||||
github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 h1:6xNmx7iTtyBRev0+D/Tv1FZd4SCg8axKApyNyRsAt/w=
|
||||
github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5/go.mod h1:KdCmV+x/BuvyMxRnYBlmVaq4OLiKW6iRQfvC62cvdkI=
|
||||
github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
|
||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/cyphar/filepath-securejoin v0.6.1 h1:5CeZ1jPXEiYt3+Z6zqprSAgSWiggmpVyciv8syjIpVE=
|
||||
github.com/cyphar/filepath-securejoin v0.6.1/go.mod h1:A8hd4EnAeyujCJRrICiOWqjS1AX0a9kM5XL+NwKoYSc=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q=
|
||||
github.com/dsnet/compress v0.0.1/go.mod h1:Aw8dCMJ7RioblQeTqt88akK31OvO8Dhf5JflhBbQEHo=
|
||||
github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY=
|
||||
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
|
||||
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
|
||||
github.com/elazarl/goproxy v1.7.2 h1:Y2o6urb7Eule09PjlhQRGNsqRfPmYI3KKQLFpCAV3+o=
|
||||
github.com/elazarl/goproxy v1.7.2/go.mod h1:82vkLNir0ALaW14Rc399OTTjyNREgmdL2cVoIbS6XaE=
|
||||
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
|
||||
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/go-control-plane v0.14.0 h1:hbG2kr4RuFj222B6+7T83thSPqLjwBIfQawTkC++2HA=
|
||||
github.com/envoyproxy/go-control-plane v0.14.0/go.mod h1:NcS5X47pLl/hfqxU70yPwL9ZMkUlwlKxtAohpi2wBEU=
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.36.0 h1:yg/JjO5E7ubRyKX3m07GF3reDNEnfOboJ0QySbH736g=
|
||||
github.com/envoyproxy/go-control-plane/envoy v1.36.0/go.mod h1:ty89S1YCCVruQAm9OtKeEkQLTb+Lkz0k8v9W0Oxsv98=
|
||||
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0 h1:/G9QYbddjL25KvtKTv3an9lx6VBE2cnb8wp1vEGNYGI=
|
||||
github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJPzVVHnPgRKdUdwW/KdbRt94AzgRee4=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/envoyproxy/protoc-gen-validate v1.3.0 h1:TvGH1wof4H33rezVKWSpqKz5NXWg5VPuZ0uONDT6eb4=
|
||||
github.com/envoyproxy/protoc-gen-validate v1.3.0/go.mod h1:HvYl7zwPa5mffgyeTUHA9zHIH36nmrm7oCbo4YKoSWA=
|
||||
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
|
||||
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
|
||||
github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk=
|
||||
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
|
||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
|
||||
github.com/forPelevin/gomoji v1.3.0 h1:WPIOLWB1bvRYlKZnSSEevLt3IfKlLs+tK+YA9fFYlkE=
|
||||
github.com/forPelevin/gomoji v1.3.0/go.mod h1:mM6GtmCgpoQP2usDArc6GjbXrti5+FffolyQfGgPboQ=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI=
|
||||
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU=
|
||||
github.com/fsouza/fake-gcs-server v1.53.1 h1:/gjEYut23/MMhe4daYJ5yIBGPUmLAYupgITuoWG3+jI=
|
||||
github.com/fsouza/fake-gcs-server v1.53.1/go.mod h1:kF+DadfinC7mlc1/2d/ZDHS9VyUk1hTcXJ6VwLSlzfM=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU=
|
||||
github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA=
|
||||
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
|
||||
github.com/gin-contrib/gzip v0.0.6/go.mod h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
|
||||
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
|
||||
github.com/gliderlabs/ssh v0.3.8 h1:a4YXD1V7xMF9g5nTkdfnja3Sxy1PVDCj1Zg4Wb8vY6c=
|
||||
github.com/gliderlabs/ssh v0.3.8/go.mod h1:xYoytBv1sV0aL3CavoDuJIQNURXkkfPA/wxQ1pL1fAU=
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic=
|
||||
github.com/go-git/go-billy/v5 v5.9.0 h1:jItGXszUDRtR/AlferWPTMN4j38BQ88XnXKbilmmBPA=
|
||||
github.com/go-git/go-billy/v5 v5.9.0/go.mod h1:jCnQMLj9eUgGU7+ludSTYoZL/GGmii14RxKFj7ROgHw=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
|
||||
github.com/go-git/go-git/v5 v5.19.1 h1:nX27AnaU43/K5bKktKwgBmR9lawoYVe1Ckg0rgzzN00=
|
||||
github.com/go-git/go-git/v5 v5.19.1/go.mod h1:Pb1v0c7/g8aGQJwx9Us09W85yGoyvSwuhEGMH7zjDKQ=
|
||||
github.com/go-ini/ini v1.67.0 h1:z6ZrTEZqSWOTyH2FlglNbNgARyHG8oLW9gMELqKr06A=
|
||||
github.com/go-ini/ini v1.67.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
|
||||
github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA=
|
||||
github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
|
||||
github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
|
||||
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||
github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs=
|
||||
github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns=
|
||||
github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M=
|
||||
github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I=
|
||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||
github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
|
||||
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
@@ -118,30 +228,61 @@ github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MG
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI=
|
||||
github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
||||
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ=
|
||||
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc=
|
||||
github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0=
|
||||
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE=
|
||||
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/renameio/v2 v2.0.0 h1:UifI23ZTGY8Tt29JbYFiuyIU3eX+RNFtUwefq9qAhxg=
|
||||
github.com/google/renameio/v2 v2.0.0/go.mod h1:BtmJXm5YlszgC+TD4HOEEUFgkJP3nLxehU6hfe7jRt4=
|
||||
github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0=
|
||||
github.com/google/s2a-go v0.1.9/go.mod h1:YA0Ei2ZQL3acow2O62kdp9UlnvMmU7kA6Eutn0dXayM=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.11 h1:vAe81Msw+8tKUxi2Dqh/NZMz7475yUvmRIkXr4oN2ao=
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.11/go.mod h1:RFV7MUdlb7AgEq2v7FmMCfeSMCllAzWxFgRdusoGks8=
|
||||
github.com/googleapis/gax-go/v2 v2.17.0 h1:RksgfBpxqff0EZkDWYuz9q/uWsTVz+kf43LsZ1J6SMc=
|
||||
github.com/googleapis/gax-go/v2 v2.17.0/go.mod h1:mzaqghpQp4JDh3HvADwrat+6M3MOIDp5YKHhb9PAgDY=
|
||||
github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
|
||||
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
|
||||
github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE=
|
||||
github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w=
|
||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||
github.com/h2non/filetype v1.1.3 h1:FKkx9QbD7HR/zjK1Ia5XiBsq9zdLi5Kf3zGyFTAFkGg=
|
||||
github.com/h2non/filetype v1.1.3/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
@@ -151,21 +292,40 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l
|
||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
||||
github.com/jfrog/archiver/v3 v3.6.1 h1:LOxnkw9pOn45DzCbZNFV6K0+6dCsQ0L8mR3ZcujO5eI=
|
||||
github.com/jfrog/archiver/v3 v3.6.1/go.mod h1:VgR+3WZS4N+i9FaDwLZbq+jeU4B4zctXL+gL4EMzfLw=
|
||||
github.com/jfrog/build-info-go v1.11.0 h1:qEONCgaHKlW3e2y0zIwTZVbgS/ERZrPlBWEbOYJbaSU=
|
||||
github.com/jfrog/build-info-go v1.11.0/go.mod h1:szdz9+WzB7+7PGnILLUgyY+OF5qD5geBT7UGNIxibyw=
|
||||
github.com/jfrog/gofrog v1.7.6 h1:QmfAiRzVyaI7JYGsB7cxfAJePAZTzFz0gRWZSE27c6s=
|
||||
github.com/jfrog/gofrog v1.7.6/go.mod h1:ntr1txqNOZtHplmaNd7rS4f8jpA5Apx8em70oYEe7+4=
|
||||
github.com/jfrog/jfrog-client-go v1.55.0 h1:dZq7sLjUJMps8X1I5coVUChprtR7xklp7oSfmZnI48w=
|
||||
github.com/jfrog/jfrog-client-go v1.55.0/go.mod h1:/e2kaF1oZTmSRgMIk7wYna5xMtNY7Xk8ahpSNZQ2d3s=
|
||||
github.com/jlaffaye/ftp v0.2.0 h1:lXNvW7cBu7R/68bknOX3MrRIIqZ61zELs1P2RAiA3lg=
|
||||
github.com/jlaffaye/ftp v0.2.0/go.mod h1:is2Ds5qkhceAPy2xD6RLI6hmp/qysSoymZ+Z2uTnspI=
|
||||
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
|
||||
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4=
|
||||
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
|
||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
||||
github.com/kjk/lzma v0.0.0-20120628231508-2a7c55cad4a2 h1:TVZQgMi+I83S3rCuE65HnmDO6+wFPRi3n2LOzr+tr68=
|
||||
github.com/kjk/lzma v0.0.0-20120628231508-2a7c55cad4a2/go.mod h1:phT/jsRPBAEqjAibu1BurrabCBNTYiVI+zbmyCZJY6Q=
|
||||
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
|
||||
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
|
||||
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
|
||||
github.com/klauspost/compress v1.18.2 h1:iiPHWW0YrcFgpBYhsA6D1+fqHssJscY/Tm/y2Uqnapk=
|
||||
github.com/klauspost/compress v1.18.2/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
|
||||
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk=
|
||||
github.com/klauspost/cpuid/v2 v2.2.4/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
|
||||
github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=
|
||||
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
|
||||
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/klauspost/crc32 v1.3.0 h1:sSmTt3gUt81RP655XGZPElI0PelVTZ6YwCRnPSupoFM=
|
||||
github.com/klauspost/crc32 v1.3.0/go.mod h1:D7kQaZhnkX/Y0tstFGf8VUzv2UofNGqCjnC3zdHB0Hw=
|
||||
github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU=
|
||||
github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
@@ -177,11 +337,13 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
|
||||
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
|
||||
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
|
||||
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
|
||||
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||
github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
|
||||
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-ieproxy v0.0.1 h1:qiyop7gCflfhwCzGyeT0gro3sF9AIg9HU98JORTkqfI=
|
||||
github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
@@ -190,6 +352,14 @@ github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZ
|
||||
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-shellwords v1.0.12 h1:M2zGm7EW6UQJvDeQxo4T51eKPurbeFbe8WtebGE2xrk=
|
||||
github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y=
|
||||
github.com/minio/crc64nvme v1.1.1 h1:8dwx/Pz49suywbO+auHCBpCtlW1OfpcLN7wYgVR6wAI=
|
||||
github.com/minio/crc64nvme v1.1.1/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg=
|
||||
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
|
||||
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
|
||||
github.com/minio/minio-go/v7 v7.0.98 h1:MeAVKjLVz+XJ28zFcuYyImNSAh8Mq725uNW4beRisi0=
|
||||
github.com/minio/minio-go/v7 v7.0.98/go.mod h1:cY0Y+W7yozf0mdIclrttzo1Iiu7mEf9y7nk2uXqMOvM=
|
||||
github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM=
|
||||
github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8=
|
||||
github.com/mkrautz/goar v0.0.0-20150919110319-282caa8bd9da h1:Iu5QFXIMK/YrHJ0NgUnK0rqYTTyb0ldt/rqNenAj39U=
|
||||
github.com/mkrautz/goar v0.0.0-20150919110319-282caa8bd9da/go.mod h1:NfnmoBY0gGkr3/NmI+DP/UXbZvOCurCUYAzOdYJjlOc=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
@@ -203,6 +373,9 @@ github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J
|
||||
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
|
||||
github.com/ncw/swift v1.0.53 h1:luHjjTNtekIEvHg5KdAFIBaH7bWfNkefwFnpDffSIks=
|
||||
github.com/ncw/swift v1.0.53/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/nwaples/rardecode v1.1.3 h1:cWCaZwfM5H7nAD6PyEdcVnczzV8i/JtotnyW/dD9lEc=
|
||||
github.com/nwaples/rardecode v1.1.3/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0=
|
||||
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
|
||||
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
||||
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
||||
@@ -215,19 +388,34 @@ github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3
|
||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
|
||||
github.com/onsi/gomega v1.19.0 h1:4ieX6qQjPP/BfC3mpsAtIGGlxTWPeA3Inl/7DtXw1tw=
|
||||
github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
|
||||
github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k=
|
||||
github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY=
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
|
||||
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
|
||||
github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM=
|
||||
github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
|
||||
github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU=
|
||||
github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
|
||||
github.com/pjbgf/sha1cd v0.6.0 h1:3WJ8Wz8gvDz29quX1OcEmkAlUg9diU4GxJHqs0/XiwU=
|
||||
github.com/pjbgf/sha1cd v0.6.0/go.mod h1:lhpGlyHLpQZoxMv8HcgXvZEhcGs0PG/vsZnEJ7H0iCM=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
|
||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
|
||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pkg/xattr v0.4.12 h1:rRTkSyFNTRElv6pkA3zpjHpQ90p/OdHQC1GmGh1aTjM=
|
||||
github.com/pkg/xattr v0.4.12/go.mod h1:di8WF84zAKk8jzR1UBTEWh9AUlIZZ7M/JNt8e9B6ktU=
|
||||
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo=
|
||||
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_golang v1.20.0 h1:jBzTZ7B099Rg24tny+qngoynol8LtVYlA2bqx3vEloI=
|
||||
github.com/prometheus/client_golang v1.20.0/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
|
||||
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
|
||||
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk=
|
||||
github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE=
|
||||
github.com/prometheus/common v0.59.1 h1:LXb1quJHWm1P6wq/U824uxYi4Sg0oGvNeUm1z5dJoX0=
|
||||
github.com/prometheus/common v0.59.1/go.mod h1:GpWM7dewqmVYcd7SmRaiWVe9SSqjf0UrwnYnpEZNuT0=
|
||||
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
|
||||
@@ -236,13 +424,20 @@ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
|
||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
|
||||
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
|
||||
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
|
||||
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
|
||||
github.com/rs/xid v1.4.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
|
||||
github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU=
|
||||
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
|
||||
github.com/rs/zerolog v1.29.1 h1:cO+d60CHkknCbvzEWxP0S9K6KqyTjrCNUy1LdQLCGPc=
|
||||
github.com/rs/zerolog v1.29.1/go.mod h1:Le6ESbR7hc+DP6Lt1THiV8CQSdkkNrd3R0XbEgp3ZBU=
|
||||
github.com/saracen/walker v0.1.2 h1:/o1TxP82n8thLvmL4GpJXduYaRmJ7qXp8u9dSlV0zmo=
|
||||
github.com/saracen/walker v0.1.2/go.mod h1:0oKYMsKVhSJ+ful4p/XbjvXbMgLEkLITZaxozsl4CGE=
|
||||
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8=
|
||||
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8=
|
||||
github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY=
|
||||
github.com/smira/commander v0.0.0-20140515201010-f408b00e68d5 h1:jLFwP6SDEUHmb6QSu5n2FHseWzMio1ou1FV9p7W6p7I=
|
||||
github.com/smira/commander v0.0.0-20140515201010-f408b00e68d5/go.mod h1:XTQy55hw5s3pxmC42m7X0/b+9naXQ1rGN9Of6BGIZmU=
|
||||
github.com/smira/flag v0.0.0-20170926215700-695ea5e84e76 h1:OM075OkN4x9IB1mbzkzaKaJjFxx8Mfss8Z3E1LHwawQ=
|
||||
@@ -251,11 +446,16 @@ github.com/smira/go-ftp-protocol v0.0.0-20140829150050-066b75c2b70d h1:rvtR4+9N2
|
||||
github.com/smira/go-ftp-protocol v0.0.0-20140829150050-066b75c2b70d/go.mod h1:Jm7yHrROA5tC42gyJ5EwiR8EWp0PUy0qOc4sE7Y8Uzo=
|
||||
github.com/smira/go-xz v0.1.0 h1:1zVLT1sITUKcWNysfHMLZWJ2Yh7yJfhREsgmUdK4zb0=
|
||||
github.com/smira/go-xz v0.1.0/go.mod h1:OmdEWnIIkuLzRLHGF4YtjDzF9VFUevEcP6YxDPRqVrs=
|
||||
github.com/spiffe/go-spiffe/v2 v2.6.0 h1:l+DolpxNWYgruGQVV0xsfeya3CsC7m8iBzDnMpsbLuo=
|
||||
github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
|
||||
@@ -263,118 +463,194 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
|
||||
github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
|
||||
github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M=
|
||||
github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo=
|
||||
github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg=
|
||||
github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs=
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48=
|
||||
github.com/terminalstatic/go-xsd-validate v0.1.6 h1:TenYeQ3eY631qNi1/cTmLH/s2slHPRKTTHT+XSHkepo=
|
||||
github.com/terminalstatic/go-xsd-validate v0.1.6/go.mod h1:18lsvYFofBflqCrvo1umpABZ99+GneNTw2kEEc8UPJw=
|
||||
github.com/tinylib/msgp v1.6.1 h1:ESRv8eL3u+DNHUoSAAQRE50Hm162zqAnBoGv9PzScPY=
|
||||
github.com/tinylib/msgp v1.6.1/go.mod h1:RSp0LW9oSxFut3KzESt5Voq4GVWyS+PSulT77roAqEA=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
|
||||
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
|
||||
github.com/ulikunitz/xz v0.5.15 h1:9DNdB5s+SgV3bQ2ApL10xRc35ck0DuIX/isZvIk+ubY=
|
||||
github.com/ulikunitz/xz v0.5.15/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||
github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0 h1:3UeQBvD0TFrlVjOeLOBz+CPAI8dnbqNSVwUwRrkp7vQ=
|
||||
github.com/wsxiaoys/terminal v0.0.0-20160513160801-0940f3fc43a0/go.mod h1:IXCdmsXIht47RaVFLEdVnh1t+pgYtTAhQGj73kz+2DM=
|
||||
github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM=
|
||||
github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
|
||||
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
|
||||
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo=
|
||||
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
|
||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
|
||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
|
||||
github.com/xyproto/randomstring v1.0.5 h1:YtlWPoRdgMu3NZtP45drfy1GKoojuR7hmRcnhZqKjWU=
|
||||
github.com/xyproto/randomstring v1.0.5/go.mod h1:rgmS5DeNXLivK7YprL0pY+lTuhNQW3iGxZ18UQApw/E=
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.einride.tech/aip v0.79.0 h1:19zdPlZzlUvxOA8syAFw4LkdJdXepzyTl6gt9XEeqdU=
|
||||
go.einride.tech/aip v0.79.0/go.mod h1:E8+wdTApA70odnpFzJgsGogHozC2JCIhFJBKPr8bVig=
|
||||
go.etcd.io/etcd/api/v3 v3.5.15 h1:3KpLJir1ZEBrYuV2v+Twaa/e2MdDCEZ/70H+lzEiwsk=
|
||||
go.etcd.io/etcd/api/v3 v3.5.15/go.mod h1:N9EhGzXq58WuMllgH9ZvnEr7SI9pS0k0+DHZezGp7jM=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.15 h1:fo0HpWz/KlHGMCC+YejpiCmyWDEuIpnTDzpJLB5fWlA=
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.15/go.mod h1:mXDI4NAOwEiszrHCb0aqfAYNCrZP4e9hRca3d1YK8EU=
|
||||
go.etcd.io/etcd/client/v3 v3.5.15 h1:23M0eY4Fd/inNv1ZfU3AxrbbOdW79r9V9Rl62Nm6ip4=
|
||||
go.etcd.io/etcd/client/v3 v3.5.15/go.mod h1:CLSJxrYjvLtHsrPKsy7LmZEE+DK2ktfd2bN4RhBMwlU=
|
||||
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
|
||||
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
|
||||
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
|
||||
go.opentelemetry.io/otel v1.39.0 h1:8yPrr/S0ND9QEfTfdP9V+SiwT4E0G7Y5MO7p85nis48=
|
||||
go.opentelemetry.io/otel v1.39.0/go.mod h1:kLlFTywNWrFyEdH0oj2xK0bFYZtHRYUdv1NklR/tgc8=
|
||||
go.opentelemetry.io/otel/metric v1.39.0 h1:d1UzonvEZriVfpNKEVmHXbdf909uGTOQjA0HF0Ls5Q0=
|
||||
go.opentelemetry.io/otel/metric v1.39.0/go.mod h1:jrZSWL33sD7bBxg1xjrqyDjnuzTUB0x1nBERXd7Ftcs=
|
||||
go.opentelemetry.io/otel/sdk v1.39.0 h1:nMLYcjVsvdui1B/4FRkwjzoRVsMK8uL/cj0OyhKzt18=
|
||||
go.opentelemetry.io/otel/sdk v1.39.0/go.mod h1:vDojkC4/jsTJsE+kh+LXYQlbL8CgrEcwmt1ENZszdJE=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.39.0 h1:cXMVVFVgsIf2YL6QkRF4Urbr/aMInf+2WKg+sEJTtB8=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.39.0/go.mod h1:xq9HEVH7qeX69/JnwEfp6fVq5wosJsY1mt4lLfYdVew=
|
||||
go.opentelemetry.io/otel/trace v1.39.0 h1:2d2vfpEDmCJ5zVYz7ijaJdOF59xLomrvj7bjt6/qCJI=
|
||||
go.opentelemetry.io/otel/trace v1.39.0/go.mod h1:88w4/PnZSazkGzz/w84VHpQafiU4EtqqlVdxWy+rNOA=
|
||||
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
|
||||
go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
|
||||
go.opentelemetry.io/contrib/detectors/gcp v1.39.0 h1:kWRNZMsfBHZ+uHjiH4y7Etn2FK26LAGkNFw7RHv1DhE=
|
||||
go.opentelemetry.io/contrib/detectors/gcp v1.39.0/go.mod h1:t/OGqzHBa5v6RHZwrDBJ2OirWc+4q/w2fTbLZwAKjTk=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 h1:YH4g8lQroajqUwWbq/tr2QX1JFmEXaDLgG+ew9bLMWo=
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0/go.mod h1:fvPi2qXDqFs8M4B4fmJhE92TyQs9Ydjlg3RvfUp+NbQ=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6hwnZ41NSFTO5q4LYDtJRXBf2PD0rNBkeB/lus=
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q=
|
||||
go.opentelemetry.io/otel v1.43.0 h1:mYIM03dnh5zfN7HautFE4ieIig9amkNANT+xcVxAj9I=
|
||||
go.opentelemetry.io/otel v1.43.0/go.mod h1:JuG+u74mvjvcm8vj8pI5XiHy1zDeoCS2LB1spIq7Ay0=
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.39.0 h1:5gn2urDL/FBnK8OkCfD1j3/ER79rUuTYmCvlXBKeYL8=
|
||||
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.39.0/go.mod h1:0fBG6ZJxhqByfFZDwSwpZGzJU671HkwpWaNe2t4VUPI=
|
||||
go.opentelemetry.io/otel/metric v1.43.0 h1:d7638QeInOnuwOONPp4JAOGfbCEpYb+K6DVWvdxGzgM=
|
||||
go.opentelemetry.io/otel/metric v1.43.0/go.mod h1:RDnPtIxvqlgO8GRW18W6Z/4P462ldprJtfxHxyKd2PY=
|
||||
go.opentelemetry.io/otel/sdk v1.43.0 h1:pi5mE86i5rTeLXqoF/hhiBtUNcrAGHLKQdhg4h4V9Dg=
|
||||
go.opentelemetry.io/otel/sdk v1.43.0/go.mod h1:P+IkVU3iWukmiit/Yf9AWvpyRDlUeBaRg6Y+C58QHzg=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.43.0 h1:S88dyqXjJkuBNLeMcVPRFXpRw2fuwdvfCGLEo89fDkw=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.43.0/go.mod h1:C/RJtwSEJ5hzTiUz5pXF1kILHStzb9zFlIEe85bhj6A=
|
||||
go.opentelemetry.io/otel/trace v1.43.0 h1:BkNrHpup+4k4w+ZZ86CZoHHEkohws8AY+WTX09nk+3A=
|
||||
go.opentelemetry.io/otel/trace v1.43.0/go.mod h1:/QJhyVBUUswCphDVxq+8mld+AvhXZLhe+8WVFxiFff0=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
|
||||
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
|
||||
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
|
||||
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
|
||||
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k=
|
||||
golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU=
|
||||
golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI=
|
||||
golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f h1:W3F4c+6OLc6H2lb//N1q4WpJkhzJCK5J6kUi1NTVXfM=
|
||||
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f/go.mod h1:J1xhfL/vlindoeF/aINzNzt2Bket5bjo9sdOYzOsU80=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM=
|
||||
golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
|
||||
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
|
||||
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU=
|
||||
golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY=
|
||||
golang.org/x/oauth2 v0.34.0 h1:hqK/t4AKgbqWkdkcAeI8XLmbK+4m4G5YeQRrmiotGlw=
|
||||
golang.org/x/oauth2 v0.34.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA=
|
||||
golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.35.0 h1:Mv2mzuHuZuY2+bkyWXIHMfhNdJAdwW3FuWeCPYN5GVQ=
|
||||
golang.org/x/oauth2 v0.35.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
|
||||
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
||||
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191112214154-59a1497f0cea/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
|
||||
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
|
||||
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q=
|
||||
golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY=
|
||||
golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
|
||||
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
|
||||
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
||||
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
|
||||
golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
|
||||
golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
|
||||
golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=
|
||||
golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
@@ -382,10 +658,24 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T
|
||||
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
|
||||
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
||||
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217 h1:fCvbg86sFXwdrl5LgVcTEvNC+2txB5mgROGmRL5mrls=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:+rXWjjaukWZun3mLfjmVnQi18E1AsFbDN9QdJ5YXLto=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217 h1:gRkg/vSppuSQoDjxyiGfN4Upv/h/DQmIR10ZU8dh4Ww=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:7i2o+ce6H/6BluujYR+kqX3GKH+dChPTQU19wjRPiGk=
|
||||
google.golang.org/api v0.266.0 h1:hco+oNCf9y7DmLeAtHJi/uBAY7n/7XC9mZPxu1ROiyk=
|
||||
google.golang.org/api v0.266.0/go.mod h1:Jzc0+ZfLnyvXma3UtaTl023TdhZu6OMBP9tJ+0EmFD0=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/genproto v0.0.0-20260128011058-8636f8732409 h1:VQZ/yAbAtjkHgH80teYd2em3xtIkkHd7ZhqfH2N9CsM=
|
||||
google.golang.org/genproto v0.0.0-20260128011058-8636f8732409/go.mod h1:rxKD3IEILWEu3P44seeNOAwZN4SaoKaQ/2eTg4mM6EM=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260203192932-546029d2fa20 h1:7ei4lp52gK1uSejlA8AZl5AJjeLUOHBQscRQZUgAcu0=
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20260203192932-546029d2fa20/go.mod h1:ZdbssH/1SOVnjnDlXzxDHK2MCidiqXtbYccJNzNYPEE=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260203192932-546029d2fa20 h1:Jr5R2J6F6qWyzINc+4AM8t5pfUz6beZpHp678GNrMbE=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20260203192932-546029d2fa20/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
|
||||
google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE=
|
||||
google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
@@ -393,12 +683,18 @@ google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
|
||||
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
||||
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/cheggaaa/pb.v1 v1.0.28 h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk=
|
||||
@@ -406,12 +702,17 @@ gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS
|
||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
// Package jfrog handles publishing to JFrog Artifactory
|
||||
package jfrog
|
||||
+292
@@ -0,0 +1,292 @@
|
||||
package jfrog
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
aptly_utils "github.com/aptly-dev/aptly/utils"
|
||||
"github.com/jfrog/jfrog-client-go/artifactory"
|
||||
"github.com/jfrog/jfrog-client-go/artifactory/auth"
|
||||
"github.com/jfrog/jfrog-client-go/artifactory/services"
|
||||
"github.com/jfrog/jfrog-client-go/artifactory/services/utils"
|
||||
"github.com/jfrog/jfrog-client-go/config"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// PublishedStorage represents published repository on JFrog Artifactory
|
||||
type PublishedStorage struct {
|
||||
manager artifactory.ArtifactoryServicesManager
|
||||
repository string
|
||||
prefix string
|
||||
plusWorkaround bool
|
||||
}
|
||||
|
||||
// Check interface
|
||||
var (
|
||||
_ aptly.PublishedStorage = (*PublishedStorage)(nil)
|
||||
)
|
||||
|
||||
func createPublishedStorageConfig(url, user, password, apiKey, accessToken string) (config.Config, error) {
|
||||
artDetails := auth.NewArtifactoryDetails()
|
||||
artDetails.SetUrl(url)
|
||||
|
||||
if user == "" {
|
||||
user = os.Getenv("JFROG_USERNAME");
|
||||
}
|
||||
if password == "" {
|
||||
password = os.Getenv("JFROG_PASSWORD");
|
||||
}
|
||||
if apiKey == "" {
|
||||
apiKey = os.Getenv("JFROG_APIKEY");
|
||||
}
|
||||
if accessToken == "" {
|
||||
accessToken = os.Getenv("JFROG_ACCESSTOKEN");
|
||||
}
|
||||
|
||||
if user != "" && password != "" {
|
||||
artDetails.SetUser(user)
|
||||
artDetails.SetPassword(password)
|
||||
} else if apiKey != "" {
|
||||
artDetails.SetApiKey(apiKey)
|
||||
} else if accessToken != "" {
|
||||
artDetails.SetAccessToken(accessToken)
|
||||
}
|
||||
|
||||
return config.NewConfigBuilder().
|
||||
SetServiceDetails(artDetails).
|
||||
SetDryRun(false).
|
||||
Build()
|
||||
}
|
||||
|
||||
// NewPublishedStorageRaw creates jfrog PublishedStorage from raw connection specs
|
||||
func NewPublishedStorageRaw(
|
||||
repository, url, user, password, apiKey, accessToken, prefix string,
|
||||
plusWorkaround, debug bool,
|
||||
) (*PublishedStorage, error) {
|
||||
|
||||
serviceConfig, err := createPublishedStorageConfig(url, user, password, apiKey, accessToken)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error building jfrog client config")
|
||||
}
|
||||
|
||||
manager, err := artifactory.New(serviceConfig)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "error creating jfrog manager")
|
||||
}
|
||||
|
||||
return &PublishedStorage{
|
||||
manager: manager,
|
||||
repository: repository,
|
||||
prefix: prefix,
|
||||
plusWorkaround: plusWorkaround,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// NewPublishedStorage creates published storage from aptly configuration struct
|
||||
func NewPublishedStorage(
|
||||
account string, root aptly_utils.JFrogPublishRoot,
|
||||
) (*PublishedStorage, error) {
|
||||
return NewPublishedStorageRaw(
|
||||
root.Repository, root.URL, root.User, root.Password, root.APIKey, root.AccessToken,
|
||||
root.Prefix, root.PlusWorkaround, root.Debug)
|
||||
}
|
||||
|
||||
func (storage *PublishedStorage) String() string {
|
||||
return fmt.Sprintf("jfrog:%s:%s", storage.repository, storage.prefix)
|
||||
}
|
||||
|
||||
func (storage *PublishedStorage) MkDir(path string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (storage *PublishedStorage) PutFile(path string, sourceFilename string) error {
|
||||
targetPath := filepath.Join(storage.repository, storage.prefix, path)
|
||||
if storage.plusWorkaround {
|
||||
targetPath = strings.Replace(targetPath, "+", "%2B", -1)
|
||||
}
|
||||
|
||||
params := services.NewUploadParams()
|
||||
params.Pattern = sourceFilename
|
||||
params.Target = targetPath
|
||||
params.Flat = true
|
||||
|
||||
_, _, err := storage.manager.UploadFiles(artifactory.UploadServiceOptions{}, params)
|
||||
return err
|
||||
}
|
||||
|
||||
func (storage *PublishedStorage) Remove(path string) error {
|
||||
targetPath := filepath.Join(storage.repository, storage.prefix, path)
|
||||
if storage.plusWorkaround {
|
||||
targetPath = strings.Replace(targetPath, "+", "%2B", -1)
|
||||
}
|
||||
|
||||
deleteParams := services.NewDeleteParams()
|
||||
deleteParams.SetPattern(targetPath)
|
||||
|
||||
res, err := storage.manager.GetPathsToDelete(deleteParams)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() { _ = res.Close() }()
|
||||
_, err = storage.manager.DeleteFiles(res)
|
||||
return err
|
||||
}
|
||||
|
||||
func (storage *PublishedStorage) RemoveDirs(path string, progress aptly.Progress) error {
|
||||
return storage.Remove(path)
|
||||
}
|
||||
|
||||
func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath, fileName string, sourcePool aptly.PackagePool, sourcePath string, sourceMD5 aptly_utils.ChecksumInfo, force bool) error {
|
||||
sourceFilename := sourcePath
|
||||
cleanup := func() {}
|
||||
|
||||
if sourcePool != nil {
|
||||
if localPool, ok := sourcePool.(aptly.LocalPackagePool); ok {
|
||||
sourceFilename = localPool.FullPath(sourcePath)
|
||||
} else {
|
||||
src, err := sourcePool.Open(sourcePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer func() { _ = src.Close() }()
|
||||
|
||||
tmpFile, err := os.CreateTemp("", "aptly-jfrog-pool-*")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := io.Copy(tmpFile, src); err != nil {
|
||||
_ = tmpFile.Close()
|
||||
_ = os.Remove(tmpFile.Name())
|
||||
return err
|
||||
}
|
||||
|
||||
if err := tmpFile.Close(); err != nil {
|
||||
_ = os.Remove(tmpFile.Name())
|
||||
return err
|
||||
}
|
||||
|
||||
sourceFilename = tmpFile.Name()
|
||||
cleanup = func() {
|
||||
_ = os.Remove(sourceFilename)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defer cleanup()
|
||||
|
||||
return storage.PutFile(filepath.Join(publishedPrefix, publishedRelPath, fileName), sourceFilename)
|
||||
}
|
||||
|
||||
func (storage *PublishedStorage) Filelist(prefix string) ([]string, error) {
|
||||
searchPattern := filepath.Join(storage.repository, storage.prefix, prefix, "*")
|
||||
params := services.NewSearchParams()
|
||||
params.Pattern = searchPattern
|
||||
|
||||
reader, err := storage.manager.SearchFiles(params)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer func() { _ = reader.Close() }()
|
||||
|
||||
var paths []string
|
||||
|
||||
for element := new(utils.ResultItem); reader.NextRecord(element) == nil; element = new(utils.ResultItem) {
|
||||
path := element.Path + "/" + element.Name
|
||||
relPath := strings.TrimPrefix(path, storage.repository+"/"+storage.prefix+"/")
|
||||
if storage.plusWorkaround {
|
||||
relPath = strings.Replace(relPath, "%2B", "+", -1)
|
||||
}
|
||||
paths = append(paths, relPath)
|
||||
}
|
||||
|
||||
return paths, nil
|
||||
}
|
||||
|
||||
func (storage *PublishedStorage) RenameFile(oldName, newName string) error {
|
||||
oldTarget := filepath.Join(storage.repository, storage.prefix, oldName)
|
||||
newTarget := filepath.Join(storage.repository, storage.prefix, newName)
|
||||
|
||||
if storage.plusWorkaround {
|
||||
oldTarget = strings.Replace(oldTarget, "+", "%2B", -1)
|
||||
newTarget = strings.Replace(newTarget, "+", "%2B", -1)
|
||||
}
|
||||
|
||||
params := services.NewMoveCopyParams()
|
||||
params.Pattern = oldTarget
|
||||
params.Target = newTarget
|
||||
params.Flat = true
|
||||
|
||||
_, _, err := storage.manager.Move(params)
|
||||
return err
|
||||
}
|
||||
|
||||
func (storage *PublishedStorage) SymLink(src string, dst string) error {
|
||||
oldTarget := filepath.Join(storage.repository, storage.prefix, src)
|
||||
newTarget := filepath.Join(storage.repository, storage.prefix, dst)
|
||||
|
||||
if storage.plusWorkaround {
|
||||
oldTarget = strings.Replace(oldTarget, "+", "%2B", -1)
|
||||
newTarget = strings.Replace(newTarget, "+", "%2B", -1)
|
||||
}
|
||||
|
||||
params := services.NewMoveCopyParams()
|
||||
params.Pattern = oldTarget
|
||||
params.Target = newTarget
|
||||
params.Flat = true
|
||||
|
||||
props := utils.NewProperties()
|
||||
props.AddProperty("SymLink", src)
|
||||
params.SetTargetProps(props)
|
||||
|
||||
_, _, err := storage.manager.Copy(params)
|
||||
return err
|
||||
}
|
||||
|
||||
func (storage *PublishedStorage) HardLink(src string, dst string) error {
|
||||
return storage.SymLink(src, dst)
|
||||
}
|
||||
|
||||
func (storage *PublishedStorage) FileExists(path string) (bool, error) {
|
||||
targetPath := filepath.Join(storage.repository, storage.prefix, path)
|
||||
if storage.plusWorkaround {
|
||||
targetPath = strings.Replace(targetPath, "+", "%2B", -1)
|
||||
}
|
||||
|
||||
params := services.NewSearchParams()
|
||||
params.Pattern = targetPath
|
||||
|
||||
reader, err := storage.manager.SearchFiles(params)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
defer func() { _ = reader.Close() }()
|
||||
|
||||
length, err := reader.Length()
|
||||
isEmpty := length == 0
|
||||
return !isEmpty, err
|
||||
}
|
||||
|
||||
func (storage *PublishedStorage) ReadLink(path string) (string, error) {
|
||||
targetPath := filepath.Join(storage.repository, storage.prefix, path)
|
||||
if storage.plusWorkaround {
|
||||
targetPath = strings.Replace(targetPath, "+", "%2B", -1)
|
||||
}
|
||||
|
||||
props, err := storage.manager.GetItemProps(targetPath)
|
||||
if err != nil {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
for k, v := range props.Properties {
|
||||
if k == "SymLink" && len(v) > 0 {
|
||||
return v[0], nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", nil
|
||||
}
|
||||
@@ -0,0 +1,511 @@
|
||||
package jfrog
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
aptly_utils "github.com/aptly-dev/aptly/utils"
|
||||
"github.com/jfrog/jfrog-client-go/artifactory"
|
||||
"github.com/jfrog/jfrog-client-go/artifactory/services"
|
||||
jfrogutils "github.com/jfrog/jfrog-client-go/artifactory/services/utils"
|
||||
"github.com/jfrog/jfrog-client-go/utils/io/content"
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
|
||||
func Test(t *testing.T) {
|
||||
t.Setenv("JFROG_USERNAME", "userfromenv")
|
||||
TestingT(t)
|
||||
}
|
||||
|
||||
type fakeJFrogManager struct {
|
||||
artifactory.EmptyArtifactoryServicesManager
|
||||
|
||||
uploadParams []services.UploadParams
|
||||
uploadErr error
|
||||
|
||||
deleteParams []services.DeleteParams
|
||||
getPathsToDelete *content.ContentReader
|
||||
getPathsDeleteErr error
|
||||
deleteErr error
|
||||
deleteCalled bool
|
||||
|
||||
searchParams []services.SearchParams
|
||||
searchReader *content.ContentReader
|
||||
searchErr error
|
||||
|
||||
moveParams []services.MoveCopyParams
|
||||
moveErr error
|
||||
|
||||
copyParams []services.MoveCopyParams
|
||||
copyErr error
|
||||
|
||||
itemProps *jfrogutils.ItemProperties
|
||||
itemPropsErr error
|
||||
}
|
||||
|
||||
func (m *fakeJFrogManager) UploadFiles(_ artifactory.UploadServiceOptions, params ...services.UploadParams) (int, int, error) {
|
||||
m.uploadParams = append(m.uploadParams, params...)
|
||||
return len(params), 0, m.uploadErr
|
||||
}
|
||||
|
||||
func (m *fakeJFrogManager) GetPathsToDelete(params services.DeleteParams) (*content.ContentReader, error) {
|
||||
m.deleteParams = append(m.deleteParams, params)
|
||||
if m.getPathsDeleteErr != nil {
|
||||
return nil, m.getPathsDeleteErr
|
||||
}
|
||||
if m.getPathsToDelete != nil {
|
||||
return m.getPathsToDelete, nil
|
||||
}
|
||||
return content.NewEmptyContentReader("results"), nil
|
||||
}
|
||||
|
||||
func (m *fakeJFrogManager) DeleteFiles(_ *content.ContentReader) (int, error) {
|
||||
m.deleteCalled = true
|
||||
return 1, m.deleteErr
|
||||
}
|
||||
|
||||
func (m *fakeJFrogManager) SearchFiles(params services.SearchParams) (*content.ContentReader, error) {
|
||||
m.searchParams = append(m.searchParams, params)
|
||||
if m.searchErr != nil {
|
||||
return nil, m.searchErr
|
||||
}
|
||||
if m.searchReader != nil {
|
||||
return m.searchReader, nil
|
||||
}
|
||||
return content.NewEmptyContentReader("results"), nil
|
||||
}
|
||||
|
||||
func (m *fakeJFrogManager) Move(params ...services.MoveCopyParams) (int, int, error) {
|
||||
m.moveParams = append(m.moveParams, params...)
|
||||
return len(params), 0, m.moveErr
|
||||
}
|
||||
|
||||
func (m *fakeJFrogManager) Copy(params ...services.MoveCopyParams) (int, int, error) {
|
||||
m.copyParams = append(m.copyParams, params...)
|
||||
return len(params), 0, m.copyErr
|
||||
}
|
||||
|
||||
func (m *fakeJFrogManager) GetItemProps(_ string) (*jfrogutils.ItemProperties, error) {
|
||||
if m.itemPropsErr != nil {
|
||||
return nil, m.itemPropsErr
|
||||
}
|
||||
if m.itemProps != nil {
|
||||
return m.itemProps, nil
|
||||
}
|
||||
return &jfrogutils.ItemProperties{}, nil
|
||||
}
|
||||
|
||||
type resultFixture struct {
|
||||
Results []jfrogutils.ResultItem `json:"results"`
|
||||
}
|
||||
|
||||
type fakeLocalPool struct{}
|
||||
|
||||
func (p *fakeLocalPool) Verify(string, string, *aptly_utils.ChecksumInfo, aptly.ChecksumStorage) (string, bool, error) {
|
||||
return "", false, nil
|
||||
}
|
||||
|
||||
func (p *fakeLocalPool) Import(string, string, *aptly_utils.ChecksumInfo, bool, aptly.ChecksumStorage) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (p *fakeLocalPool) LegacyPath(string, *aptly_utils.ChecksumInfo) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (p *fakeLocalPool) Size(string) (int64, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (p *fakeLocalPool) Open(string) (aptly.ReadSeekerCloser, error) {
|
||||
return nil, errors.New("not implemented")
|
||||
}
|
||||
|
||||
func (p *fakeLocalPool) FilepathList(aptly.Progress) ([]string, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (p *fakeLocalPool) Remove(string) (int64, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (p *fakeLocalPool) Stat(string) (os.FileInfo, error) {
|
||||
return nil, errors.New("not implemented")
|
||||
}
|
||||
|
||||
func (p *fakeLocalPool) GenerateTempPath(string) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (p *fakeLocalPool) Link(string, string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *fakeLocalPool) Symlink(string, string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *fakeLocalPool) FullPath(path string) string {
|
||||
return filepath.Join("/var/lib/aptly/pool", path)
|
||||
}
|
||||
|
||||
type fakeRemotePool struct {
|
||||
openPath string
|
||||
openErr error
|
||||
}
|
||||
|
||||
func (p *fakeRemotePool) Verify(string, string, *aptly_utils.ChecksumInfo, aptly.ChecksumStorage) (string, bool, error) {
|
||||
return "", false, nil
|
||||
}
|
||||
|
||||
func (p *fakeRemotePool) Import(string, string, *aptly_utils.ChecksumInfo, bool, aptly.ChecksumStorage) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (p *fakeRemotePool) LegacyPath(string, *aptly_utils.ChecksumInfo) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (p *fakeRemotePool) Size(string) (int64, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (p *fakeRemotePool) Open(string) (aptly.ReadSeekerCloser, error) {
|
||||
if p.openErr != nil {
|
||||
return nil, p.openErr
|
||||
}
|
||||
return os.Open(p.openPath)
|
||||
}
|
||||
|
||||
func (p *fakeRemotePool) FilepathList(aptly.Progress) ([]string, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (p *fakeRemotePool) Remove(string) (int64, error) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func createReader(c *C, results []jfrogutils.ResultItem) *content.ContentReader {
|
||||
filePath := filepath.Join(c.MkDir(), "results.json")
|
||||
data, err := json.Marshal(resultFixture{Results: results})
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(os.WriteFile(filePath, data, 0o644), IsNil)
|
||||
return content.NewContentReader(filePath, "results")
|
||||
}
|
||||
|
||||
type PublishedStorageSuite struct {
|
||||
manager *fakeJFrogManager
|
||||
storage *PublishedStorage
|
||||
}
|
||||
|
||||
var _ = Suite(&PublishedStorageSuite{})
|
||||
|
||||
func (s *PublishedStorageSuite) SetUpTest(c *C) {
|
||||
s.manager = &fakeJFrogManager{}
|
||||
s.storage = &PublishedStorage{
|
||||
manager: s.manager,
|
||||
repository: "repo",
|
||||
prefix: "prefix",
|
||||
}
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestStringAndMkDir(c *C) {
|
||||
c.Assert(s.storage.String(), Equals, "jfrog:repo:prefix")
|
||||
c.Assert(s.storage.MkDir("anything"), IsNil)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestPutFile(c *C) {
|
||||
err := s.storage.PutFile("pool/main/a+b.deb", "/tmp/source.deb")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(len(s.manager.uploadParams), Equals, 1)
|
||||
c.Assert(s.manager.uploadParams[0].Pattern, Equals, "/tmp/source.deb")
|
||||
c.Assert(s.manager.uploadParams[0].Target, Equals, filepath.Join("repo", "prefix", "pool/main/a+b.deb"))
|
||||
c.Assert(s.manager.uploadParams[0].Flat, Equals, true)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestPutFilePlusWorkaroundAndError(c *C) {
|
||||
s.storage.plusWorkaround = true
|
||||
s.manager.uploadErr = errors.New("upload failed")
|
||||
|
||||
err := s.storage.PutFile("pool/main/a+b.deb", "/tmp/source.deb")
|
||||
c.Assert(err, ErrorMatches, "upload failed")
|
||||
c.Assert(s.manager.uploadParams[0].Target, Equals, filepath.Join("repo", "prefix", "pool/main/a%2Bb.deb"))
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestRemove(c *C) {
|
||||
s.manager.getPathsToDelete = createReader(c, []jfrogutils.ResultItem{})
|
||||
|
||||
err := s.storage.Remove("dists/stable+main")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(len(s.manager.deleteParams), Equals, 1)
|
||||
c.Assert(s.manager.deleteParams[0].Pattern, Equals, filepath.Join("repo", "prefix", "dists/stable+main"))
|
||||
c.Assert(s.manager.deleteCalled, Equals, true)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestRemovePlusWorkaround(c *C) {
|
||||
s.storage.plusWorkaround = true
|
||||
s.manager.getPathsToDelete = createReader(c, []jfrogutils.ResultItem{})
|
||||
|
||||
err := s.storage.Remove("pool/a+b.deb")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(s.manager.deleteParams[0].Pattern, Equals, filepath.Join("repo", "prefix", "pool/a%2Bb.deb"))
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestRemoveErrors(c *C) {
|
||||
s.manager.getPathsDeleteErr = errors.New("search delete failed")
|
||||
err := s.storage.Remove("x")
|
||||
c.Assert(err, ErrorMatches, "search delete failed")
|
||||
|
||||
s.manager.getPathsDeleteErr = nil
|
||||
s.manager.getPathsToDelete = createReader(c, []jfrogutils.ResultItem{})
|
||||
s.manager.deleteErr = errors.New("delete failed")
|
||||
err = s.storage.Remove("x")
|
||||
c.Assert(err, ErrorMatches, "delete failed")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestRemoveDirsDelegatesToRemove(c *C) {
|
||||
s.manager.getPathsToDelete = createReader(c, []jfrogutils.ResultItem{})
|
||||
c.Assert(s.storage.RemoveDirs("x", nil), IsNil)
|
||||
c.Assert(len(s.manager.deleteParams), Equals, 1)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestLinkFromPoolDelegatesToPutFile(c *C) {
|
||||
err := s.storage.LinkFromPool("", "pool/main/p", "pkg.deb", nil, "/tmp/source.deb", aptly_utils.ChecksumInfo{}, false)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(s.manager.uploadParams[0].Target, Equals, filepath.Join("repo", "prefix", "pool/main/p", "pkg.deb"))
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestLinkFromPoolUsesLocalPoolFullPath(c *C) {
|
||||
pool := &fakeLocalPool{}
|
||||
poolPath := "e3/48/84d71bb98002bf0c775479aa31ee_accountsservice_0.6.55-0ubuntu11_amd64.deb"
|
||||
|
||||
err := s.storage.LinkFromPool("", "pool/main/p", "pkg.deb", pool, poolPath, aptly_utils.ChecksumInfo{}, false)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(s.manager.uploadParams[0].Pattern, Equals, filepath.Join("/var/lib/aptly/pool", poolPath))
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestLinkFromPoolCopiesFromRemotePool(c *C) {
|
||||
tmpFile := filepath.Join(c.MkDir(), "source.deb")
|
||||
c.Assert(os.WriteFile(tmpFile, []byte("package-bytes"), 0o644), IsNil)
|
||||
|
||||
pool := &fakeRemotePool{openPath: tmpFile}
|
||||
err := s.storage.LinkFromPool("", "pool/main/p", "pkg.deb", pool, "hash/path/pkg.deb", aptly_utils.ChecksumInfo{}, false)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
uploadPath := s.manager.uploadParams[0].Pattern
|
||||
c.Assert(uploadPath, Not(Equals), "hash/path/pkg.deb")
|
||||
_, statErr := os.Stat(uploadPath)
|
||||
c.Assert(os.IsNotExist(statErr), Equals, true)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestFilelist(c *C) {
|
||||
s.manager.searchReader = createReader(c, []jfrogutils.ResultItem{
|
||||
{Path: "repo/prefix/pool/main/a", Name: "a.deb", Actual_Md5: "m1"},
|
||||
{Path: "repo/prefix/pool/main/b", Name: "b.deb", Actual_Md5: "m2"},
|
||||
})
|
||||
|
||||
list, err := s.storage.Filelist("pool/main")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(list, DeepEquals, []string{"pool/main/a/a.deb", "pool/main/b/b.deb"})
|
||||
c.Assert(s.manager.searchParams[0].Pattern, Equals, filepath.Join("repo", "prefix", "pool/main", "*"))
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestFilelistPlusWorkaroundAndSearchError(c *C) {
|
||||
s.storage.plusWorkaround = true
|
||||
s.manager.searchReader = createReader(c, []jfrogutils.ResultItem{
|
||||
{Path: "repo/prefix/pool/main", Name: "a%2Bb.deb", Actual_Md5: "m1"},
|
||||
})
|
||||
|
||||
list, err := s.storage.Filelist("pool/main")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(list, DeepEquals, []string{"pool/main/a+b.deb"})
|
||||
|
||||
s.manager.searchErr = errors.New("search failed")
|
||||
_, err = s.storage.Filelist("pool/main")
|
||||
c.Assert(err, ErrorMatches, "search failed")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestRenameFile(c *C) {
|
||||
err := s.storage.RenameFile("old+name", "new+name")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(len(s.manager.moveParams), Equals, 1)
|
||||
c.Assert(s.manager.moveParams[0].Pattern, Equals, filepath.Join("repo", "prefix", "old+name"))
|
||||
c.Assert(s.manager.moveParams[0].Target, Equals, filepath.Join("repo", "prefix", "new+name"))
|
||||
c.Assert(s.manager.moveParams[0].Flat, Equals, true)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestRenameFilePlusWorkaroundAndError(c *C) {
|
||||
s.storage.plusWorkaround = true
|
||||
s.manager.moveErr = errors.New("move failed")
|
||||
err := s.storage.RenameFile("old+name", "new+name")
|
||||
c.Assert(err, ErrorMatches, "move failed")
|
||||
c.Assert(s.manager.moveParams[0].Pattern, Equals, filepath.Join("repo", "prefix", "old%2Bname"))
|
||||
c.Assert(s.manager.moveParams[0].Target, Equals, filepath.Join("repo", "prefix", "new%2Bname"))
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestSymLinkAndHardLink(c *C) {
|
||||
err := s.storage.SymLink("src+name", "dst+name")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(len(s.manager.copyParams), Equals, 1)
|
||||
c.Assert(s.manager.copyParams[0].Pattern, Equals, filepath.Join("repo", "prefix", "src+name"))
|
||||
c.Assert(s.manager.copyParams[0].Target, Equals, filepath.Join("repo", "prefix", "dst+name"))
|
||||
c.Assert(s.manager.copyParams[0].Flat, Equals, true)
|
||||
targetProps := s.manager.copyParams[0].TargetProps.ToMap()
|
||||
c.Assert(targetProps["SymLink"], DeepEquals, []string{"src+name"})
|
||||
|
||||
err = s.storage.HardLink("a", "b")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(len(s.manager.copyParams), Equals, 2)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestSymLinkPlusWorkaroundAndError(c *C) {
|
||||
s.storage.plusWorkaround = true
|
||||
s.manager.copyErr = errors.New("copy failed")
|
||||
|
||||
err := s.storage.SymLink("src+name", "dst+name")
|
||||
c.Assert(err, ErrorMatches, "copy failed")
|
||||
c.Assert(s.manager.copyParams[0].Pattern, Equals, filepath.Join("repo", "prefix", "src%2Bname"))
|
||||
c.Assert(s.manager.copyParams[0].Target, Equals, filepath.Join("repo", "prefix", "dst%2Bname"))
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestFileExists(c *C) {
|
||||
s.manager.searchReader = createReader(c, []jfrogutils.ResultItem{{Path: "repo/prefix/pool", Name: "x"}})
|
||||
ok, err := s.storage.FileExists("pool/x")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(ok, Equals, true)
|
||||
c.Assert(s.manager.searchParams[0].Pattern, Equals, filepath.Join("repo", "prefix", "pool/x"))
|
||||
|
||||
s.manager.searchReader = content.NewEmptyContentReader("results")
|
||||
ok, err = s.storage.FileExists("pool/y")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(ok, Equals, false)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestFileExistsSearchErrorAndPlusWorkaround(c *C) {
|
||||
s.storage.plusWorkaround = true
|
||||
s.manager.searchErr = errors.New("search failed")
|
||||
ok, err := s.storage.FileExists("pool/a+b")
|
||||
c.Assert(ok, Equals, false)
|
||||
c.Assert(err, ErrorMatches, "search failed")
|
||||
c.Assert(s.manager.searchParams[0].Pattern, Equals, filepath.Join("repo", "prefix", "pool/a%2Bb"))
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestReadLink(c *C) {
|
||||
s.manager.itemProps = &jfrogutils.ItemProperties{
|
||||
Properties: map[string][]string{
|
||||
"SymLink": {"src/file"},
|
||||
},
|
||||
}
|
||||
|
||||
link, err := s.storage.ReadLink("path/to/link")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(link, Equals, "src/file")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestReadLinkNoPropertyAndErrors(c *C) {
|
||||
s.manager.itemProps = &jfrogutils.ItemProperties{Properties: map[string][]string{"Other": {"value"}}}
|
||||
link, err := s.storage.ReadLink("path/to/link")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(link, Equals, "")
|
||||
|
||||
s.manager.itemPropsErr = errors.New("props failed")
|
||||
link, err = s.storage.ReadLink("path/to/link")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(link, Equals, "")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestReadLinkPlusWorkaround(c *C) {
|
||||
s.storage.plusWorkaround = true
|
||||
s.manager.itemProps = &jfrogutils.ItemProperties{}
|
||||
_, _ = s.storage.ReadLink("a+b")
|
||||
// Ensure the method runs with plusWorkaround path conversion.
|
||||
c.Assert(s.manager.itemPropsErr, IsNil)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestCreatePublishedStorageConfig(c *C) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
withUserPassword, err := createPublishedStorageConfig(server.URL, "user", "password", "", "")
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
withUserPasswordDetails := withUserPassword.GetServiceDetails()
|
||||
c.Assert(withUserPasswordDetails, NotNil)
|
||||
c.Assert(withUserPasswordDetails.GetUser(), Equals, "user")
|
||||
|
||||
withAPIKey, err := createPublishedStorageConfig(server.URL, "", "", "api-123", "")
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
withAPIKeyDetails := withAPIKey.GetServiceDetails()
|
||||
c.Assert(withAPIKeyDetails, NotNil)
|
||||
c.Assert(withAPIKeyDetails.GetApiKey(), Equals, "api-123")
|
||||
|
||||
withAccessToken, err := createPublishedStorageConfig(server.URL, "", "", "", "token")
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
withAccessTokenDetails := withAccessToken.GetServiceDetails()
|
||||
c.Assert(withAccessTokenDetails, NotNil)
|
||||
c.Assert(withAccessTokenDetails.GetAccessToken(), Equals, "token")
|
||||
|
||||
withUserPasswordFromEnv, err := createPublishedStorageConfig(server.URL, "", "password", "", "")
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
withUserPasswordFromEnvDetails := withUserPasswordFromEnv.GetServiceDetails()
|
||||
c.Assert(withUserPasswordFromEnvDetails, NotNil)
|
||||
c.Assert(withUserPasswordFromEnvDetails.GetUser(), Equals, "userfromenv")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestNewPublishedStorageRaw(c *C) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
withUserPassword, err := NewPublishedStorageRaw("repo", server.URL, "user", "password", "", "", "prefix", true, false)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(withUserPassword, NotNil)
|
||||
c.Assert(withUserPassword.String(), Equals, "jfrog:repo:prefix")
|
||||
|
||||
withAPIKey, err := NewPublishedStorageRaw("repo", server.URL, "", "", "api-key", "", "prefix", false, false)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(withAPIKey, NotNil)
|
||||
|
||||
withToken, err := NewPublishedStorageRaw("repo", server.URL, "", "", "", "token", "prefix", false, false)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(withToken, NotNil)
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestNewPublishedStorageRawManagerError(c *C) {
|
||||
// An SSH URL causes artifactory.New() to fail (no SSH key configured),
|
||||
// exercising the error return on lines 59-61.
|
||||
_, err := NewPublishedStorageRaw("repo", "ssh://example.local/artifactory", "", "", "", "", "", false, false)
|
||||
c.Assert(err, ErrorMatches, "error creating jfrog manager: .*")
|
||||
}
|
||||
|
||||
func (s *PublishedStorageSuite) TestNewPublishedStorage(c *C) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
storage, err := NewPublishedStorage("test", aptly_utils.JFrogPublishRoot{
|
||||
Repository: "repo",
|
||||
URL: server.URL,
|
||||
AccessToken: "token",
|
||||
Prefix: "pref",
|
||||
PlusWorkaround: true,
|
||||
})
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(storage, NotNil)
|
||||
c.Assert(storage.String(), Equals, "jfrog:repo:pref")
|
||||
}
|
||||
|
||||
var _ aptly.PublishedStorage = (*PublishedStorage)(nil)
|
||||
+61
-2
@@ -111,9 +111,8 @@ The legacy json configuration is still supported (and also supports comments):
|
||||
// Enable metrics for Prometheus client
|
||||
"enableMetricsEndpoint": false,
|
||||
|
||||
// Not implemented in this version\.
|
||||
// Enable API documentation on /docs
|
||||
//"enableSwaggerEndpoint": false,
|
||||
"enableSwaggerEndpoint": false,
|
||||
|
||||
// OBSOLETE: use via url param ?_async=true
|
||||
"AsyncAPI": false,
|
||||
@@ -308,6 +307,66 @@ The legacy json configuration is still supported (and also supports comments):
|
||||
// }
|
||||
},
|
||||
|
||||
// GCS Endpoint Support
|
||||
//
|
||||
// aptly can be configured to publish repositories directly to Google Cloud
|
||||
// Storage\. First, publishing endpoints should be described in the aptly
|
||||
// configuration file\. Each endpoint has a name and associated settings\.
|
||||
//
|
||||
// In order to publish to GCS, specify endpoint as `gcs:endpoint\-name:` before
|
||||
// publishing prefix on the command line, e\.g\.:
|
||||
//
|
||||
// `aptly publish snapshot wheezy\-main gcs:test:`
|
||||
//
|
||||
"GcsPublishEndpoints": {
|
||||
// // Endpoint Name
|
||||
// "test": {
|
||||
|
||||
// // Bucket name
|
||||
// "bucket": "test\-bucket",
|
||||
|
||||
// // Prefix (optional)
|
||||
// // publishing under specified prefix in the bucket, defaults to
|
||||
// // no prefix (bucket root)
|
||||
// "prefix": "",
|
||||
|
||||
// // Credentials file (optional)
|
||||
// // Path to a service account credentials JSON file\. If omitted,
|
||||
// // Application Default Credentials are used\.
|
||||
// "credentialsFile": "",
|
||||
|
||||
// // Service Account JSON (optional)
|
||||
// // Inline service account credentials JSON content\.
|
||||
// "serviceAccountJSON": "",
|
||||
|
||||
// // Project (optional)
|
||||
// // Quota project to bill requests to\.
|
||||
// "project": "",
|
||||
|
||||
// // Default ACLs (optional)
|
||||
// // assign ACL to published files\. Useful values: `private` (default),
|
||||
// // `public\-read` (public repository), or `none` (don't set ACL)\.
|
||||
// "acl": "private",
|
||||
|
||||
// // Storage Class (optional)
|
||||
// // GCS storage class, e\.g\. `STANDARD`\.
|
||||
// "storageClass": "STANDARD",
|
||||
|
||||
// // Encryption Key (optional)
|
||||
// // Customer-supplied encryption key (32-byte AES-256 key) for object operations\.
|
||||
// "encryptionKey": "",
|
||||
|
||||
// // Disable MultiDel (optional)
|
||||
// // Kept for parity with S3 settings\.
|
||||
// // GCS deletes are currently performed one object at a time\.
|
||||
// "disableMultiDel": false,
|
||||
|
||||
// // Debug (optional)
|
||||
// // Enables detailed GCS operation logs
|
||||
// "debug": false
|
||||
// }
|
||||
},
|
||||
|
||||
// Swift Endpoint Support
|
||||
//
|
||||
// aptly could be configured to publish repository directly to OpenStack Swift\. First,
|
||||
|
||||
+84
-2
@@ -100,9 +100,8 @@ The legacy json configuration is still supported (and also supports comments):
|
||||
// Enable metrics for Prometheus client
|
||||
"enableMetricsEndpoint": false,
|
||||
|
||||
// Not implemented in this version.
|
||||
// Enable API documentation on /docs
|
||||
//"enableSwaggerEndpoint": false,
|
||||
"enableSwaggerEndpoint": false,
|
||||
|
||||
// OBSOLETE: use via url param ?_async=true
|
||||
"AsyncAPI": false,
|
||||
@@ -297,6 +296,89 @@ The legacy json configuration is still supported (and also supports comments):
|
||||
// }
|
||||
},
|
||||
|
||||
// GCS Endpoint Support
|
||||
//
|
||||
// aptly can be configured to publish repositories directly to Google Cloud
|
||||
// Storage. First, publishing endpoints should be described in the aptly
|
||||
// configuration file. Each endpoint has a name and associated settings.
|
||||
//
|
||||
// In order to publish to GCS, specify endpoint as `gcs:endpoint-name:` before
|
||||
// publishing prefix on the command line, e.g.:
|
||||
//
|
||||
// `aptly publish snapshot wheezy-main gcs:test:`
|
||||
//
|
||||
"GcsPublishEndpoints": {
|
||||
// // Endpoint Name
|
||||
// "test": {
|
||||
|
||||
// // Bucket name
|
||||
// "bucket": "test-bucket",
|
||||
|
||||
// // Prefix (optional)
|
||||
// // publishing under specified prefix in the bucket, defaults to
|
||||
// // no prefix (bucket root)
|
||||
// "prefix": "",
|
||||
|
||||
// // Credentials file (optional)
|
||||
// // Path to a service account credentials JSON file. If omitted,
|
||||
// // Application Default Credentials are used.
|
||||
// "credentialsFile": "",
|
||||
|
||||
// // Service Account JSON (optional)
|
||||
// // Inline service account credentials JSON content.
|
||||
// "serviceAccountJSON": "",
|
||||
|
||||
// // Project (optional)
|
||||
// // Quota project to bill requests to.
|
||||
// "project": "",
|
||||
|
||||
// // Default ACLs (optional)
|
||||
// // assign ACL to published files. Useful values: `private` (default),
|
||||
// // `public-read` (public repository), or `none` (don't set ACL).
|
||||
// "acl": "private",
|
||||
|
||||
// // Storage Class (optional)
|
||||
// // GCS storage class, e.g. `STANDARD`.
|
||||
// "storageClass": "STANDARD",
|
||||
|
||||
// // Encryption Key (optional)
|
||||
// // Customer-supplied encryption key (32-byte AES-256 key) for object operations.
|
||||
// "encryptionKey": "",
|
||||
|
||||
// // Disable MultiDel (optional)
|
||||
// // Kept for parity with S3 settings.
|
||||
// // GCS deletes are currently performed one object at a time.
|
||||
// "disableMultiDel": false,
|
||||
|
||||
// // Debug (optional)
|
||||
// // Enables detailed GCS operation logs
|
||||
// "debug": false
|
||||
// }
|
||||
},
|
||||
|
||||
// JFrog Artifactory Endpoint Support
|
||||
// aptly could be configured to publish repository directly to JFrog Artifactory. First,
|
||||
// endpoints should be described in aptly.conf:
|
||||
//
|
||||
// The destination Artifactory repo should be of the "generic" type, not "debian".
|
||||
// Authentication requires one of: user+pass, api key, or access token
|
||||
//
|
||||
// In order to publish to JFrog, specify endpoint as `jfrog:endpoint-name:` before
|
||||
// publishing prefix on the command line, e.g.:
|
||||
//
|
||||
// `aptly publish snapshot wheezy-main jfrog:test:`
|
||||
//
|
||||
"JFrogPublishEndpoints": {
|
||||
"test": {
|
||||
"url": "https://artifactory.example.com/artifactory/",
|
||||
"repository": "apt-local",
|
||||
"username": "admin",
|
||||
"password": "password",
|
||||
"api_key": "api_key",
|
||||
"access_token": "access_token"
|
||||
}
|
||||
}
|
||||
|
||||
// Swift Endpoint Support
|
||||
//
|
||||
// aptly could be configured to publish repository directly to OpenStack Swift. First,
|
||||
|
||||
+31
-8
@@ -7,6 +7,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/aptly-dev/aptly/aptly"
|
||||
"github.com/aptly-dev/aptly/utils"
|
||||
@@ -51,6 +52,7 @@ type PublishedStorage struct {
|
||||
plusWorkaround bool
|
||||
disableMultiDel bool
|
||||
pathCache map[string]string
|
||||
pathCacheMutex sync.RWMutex
|
||||
|
||||
// True if the bucket encrypts objects by default.
|
||||
encryptByDefault bool
|
||||
@@ -251,7 +253,9 @@ func (storage *PublishedStorage) Remove(path string) error {
|
||||
_ = storage.Remove(strings.Replace(path, "+", " ", -1))
|
||||
}
|
||||
|
||||
storage.pathCacheMutex.Lock()
|
||||
delete(storage.pathCache, path)
|
||||
storage.pathCacheMutex.Unlock()
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -280,7 +284,9 @@ func (storage *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error
|
||||
if err != nil {
|
||||
return fmt.Errorf("error deleting path %s from %s: %s", filelist[i], storage, err)
|
||||
}
|
||||
storage.pathCacheMutex.Lock()
|
||||
delete(storage.pathCache, filepath.Join(path, filelist[i]))
|
||||
storage.pathCacheMutex.Unlock()
|
||||
}
|
||||
} else {
|
||||
numParts := (len(filelist) + page - 1) / page
|
||||
@@ -313,9 +319,11 @@ func (storage *PublishedStorage) RemoveDirs(path string, _ aptly.Progress) error
|
||||
if err != nil {
|
||||
return fmt.Errorf("error deleting multiple paths from %s: %s", storage, err)
|
||||
}
|
||||
storage.pathCacheMutex.Lock()
|
||||
for i := range part {
|
||||
delete(storage.pathCache, filepath.Join(path, part[i]))
|
||||
}
|
||||
storage.pathCacheMutex.Unlock()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,20 +345,31 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
|
||||
relPath := filepath.Join(publishedDirectory, fileName)
|
||||
poolPath := filepath.Join(storage.prefix, relPath)
|
||||
|
||||
if storage.pathCache == nil {
|
||||
paths, md5s, err := storage.internalFilelist(filepath.Join(publishedPrefix, "pool"), true)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error caching paths under prefix")
|
||||
}
|
||||
storage.pathCacheMutex.RLock()
|
||||
cacheNil := storage.pathCache == nil
|
||||
storage.pathCacheMutex.RUnlock()
|
||||
|
||||
storage.pathCache = make(map[string]string, len(paths))
|
||||
if cacheNil {
|
||||
storage.pathCacheMutex.Lock()
|
||||
if storage.pathCache == nil {
|
||||
paths, md5s, err := storage.internalFilelist(filepath.Join(publishedPrefix, "pool"), true)
|
||||
if err != nil {
|
||||
storage.pathCacheMutex.Unlock()
|
||||
return errors.Wrap(err, "error caching paths under prefix")
|
||||
}
|
||||
|
||||
for i := range paths {
|
||||
storage.pathCache[filepath.Join(publishedPrefix, "pool", paths[i])] = md5s[i]
|
||||
storage.pathCache = make(map[string]string, len(paths))
|
||||
|
||||
for i := range paths {
|
||||
storage.pathCache[filepath.Join(publishedPrefix, "pool", paths[i])] = md5s[i]
|
||||
}
|
||||
}
|
||||
storage.pathCacheMutex.Unlock()
|
||||
}
|
||||
|
||||
storage.pathCacheMutex.RLock()
|
||||
destinationMD5, exists := storage.pathCache[relPath]
|
||||
storage.pathCacheMutex.RUnlock()
|
||||
sourceMD5 := sourceChecksums.MD5
|
||||
|
||||
if exists {
|
||||
@@ -367,7 +386,9 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
|
||||
err = errors.Wrap(err, fmt.Sprintf("error verifying MD5 for %s: %s", storage, poolPath))
|
||||
return err
|
||||
}
|
||||
storage.pathCacheMutex.Lock()
|
||||
storage.pathCache[relPath] = destinationMD5
|
||||
storage.pathCacheMutex.Unlock()
|
||||
}
|
||||
|
||||
if destinationMD5 == sourceMD5 {
|
||||
@@ -388,7 +409,9 @@ func (storage *PublishedStorage) LinkFromPool(publishedPrefix, publishedRelPath,
|
||||
log.Debug().Msgf("S3: LinkFromPool '%s'", relPath)
|
||||
err = storage.putFile(relPath, source, sourceMD5)
|
||||
if err == nil {
|
||||
storage.pathCacheMutex.Lock()
|
||||
storage.pathCache[relPath] = sourceMD5
|
||||
storage.pathCacheMutex.Unlock()
|
||||
} else {
|
||||
err = errors.Wrap(err, fmt.Sprintf("error uploading %s to %s: %s", sourcePath, storage, poolPath))
|
||||
}
|
||||
|
||||
+7
-4
@@ -1,14 +1,17 @@
|
||||
FROM debian:trixie-slim
|
||||
|
||||
RUN apt-get update -y && apt-get install -y --no-install-recommends curl gnupg bzip2 xz-utils ca-certificates vim procps \
|
||||
golang golang-go golang-doc golang-src \
|
||||
RUN echo 'deb http://deb.debian.org/debian trixie-backports main' > /etc/apt/sources.list.d/backports.list && \
|
||||
apt-get update -y && apt-get install -y --no-install-recommends curl gnupg bzip2 xz-utils ca-certificates vim procps \
|
||||
golang-1.25 golang-1.25-go golang-1.25-src \
|
||||
make git python3 python3-requests-unixsocket python3-termcolor python3-swiftclient python3-boto3 python3-azure-storage \
|
||||
g++ python3-etcd3 python3-plyvel graphviz devscripts sudo dh-golang binutils-i686-linux-gnu binutils-aarch64-linux-gnu \
|
||||
binutils-arm-linux-gnueabihf bash-completion zip ruby-dev lintian npm \
|
||||
libc6-dev-i386-cross libc6-dev-armhf-cross libc6-dev-arm64-cross \
|
||||
gcc-i686-linux-gnu gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu \
|
||||
faketime && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
faketime dput-ng && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/* && \
|
||||
ln -sf /usr/lib/go-1.25/bin/go /usr/local/bin/go && \
|
||||
ln -sf /usr/lib/go-1.25/bin/gofmt /usr/local/bin/gofmt
|
||||
|
||||
RUN useradd -m --shell /bin/bash --home-dir /var/lib/aptly aptly
|
||||
RUN sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/' /var/lib/aptly/.bashrc
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
from lib import BaseTest
|
||||
import os
|
||||
import uuid
|
||||
|
||||
try:
|
||||
from google.cloud import storage
|
||||
|
||||
gcs_project = os.environ.get('GCS_PROJECT')
|
||||
|
||||
if gcs_project:
|
||||
gcs_client = storage.Client(project=gcs_project)
|
||||
else:
|
||||
print('GCS tests disabled: GCS_PROJECT is not set')
|
||||
gcs_client = None
|
||||
except ImportError as e:
|
||||
print("GCS tests disabled: can't import google.cloud.storage", e)
|
||||
gcs_client = None
|
||||
except Exception as e:
|
||||
print('GCS tests disabled: unable to initialize GCS client', e)
|
||||
gcs_client = None
|
||||
|
||||
|
||||
class GCSTest(BaseTest):
|
||||
"""
|
||||
BaseTest + support for GCS
|
||||
"""
|
||||
|
||||
gcsOverrides = {}
|
||||
|
||||
def __init__(self) -> None:
|
||||
super(GCSTest, self).__init__()
|
||||
self.bucket_name = None
|
||||
self.bucket = None
|
||||
self.bucket_contents = None
|
||||
|
||||
def fixture_available(self):
|
||||
return super(GCSTest, self).fixture_available() and gcs_client is not None
|
||||
|
||||
def prepare(self):
|
||||
# GCS bucket names must be globally unique and lower-case.
|
||||
self.bucket_name = 'aptly-sys-test-' + str(uuid.uuid4()).replace('_', '-').lower()
|
||||
self.bucket = gcs_client.create_bucket(self.bucket_name)
|
||||
|
||||
self.configOverride = {
|
||||
'GcsPublishEndpoints': {
|
||||
'test1': {
|
||||
'bucket': self.bucket_name,
|
||||
'project': gcs_project,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
self.configOverride['GcsPublishEndpoints']['test1'].update(**self.gcsOverrides)
|
||||
|
||||
super(GCSTest, self).prepare()
|
||||
|
||||
def shutdown(self):
|
||||
if self.bucket is not None:
|
||||
for blob in self.bucket.list_blobs():
|
||||
blob.delete()
|
||||
self.bucket.delete(force=True)
|
||||
|
||||
super(GCSTest, self).shutdown()
|
||||
|
||||
def _normalize_path(self, path):
|
||||
if path.startswith('public/'):
|
||||
return path[7:]
|
||||
return path
|
||||
|
||||
def check_path(self, path):
|
||||
if self.bucket_contents is None:
|
||||
self.bucket_contents = [blob.name for blob in self.bucket.list_blobs()]
|
||||
|
||||
path = self._normalize_path(path)
|
||||
|
||||
if path in self.bucket_contents:
|
||||
return True
|
||||
|
||||
if not path.endswith('/'):
|
||||
path = path + '/'
|
||||
|
||||
for item in self.bucket_contents:
|
||||
if item.startswith(path):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def check_exists(self, path):
|
||||
if not self.check_path(path):
|
||||
raise Exception("path %s doesn't exist" % (path, ))
|
||||
|
||||
def check_not_exists(self, path):
|
||||
if self.check_path(path):
|
||||
raise Exception("path %s exists" % (path, ))
|
||||
|
||||
def read_file(self, path, mode=''):
|
||||
assert not mode
|
||||
|
||||
path = self._normalize_path(path)
|
||||
blob = self.bucket.blob(path)
|
||||
return blob.download_as_text()
|
||||
@@ -0,0 +1,97 @@
|
||||
from lib import BaseTest
|
||||
import uuid
|
||||
import os
|
||||
|
||||
try:
|
||||
import requests
|
||||
|
||||
if 'JFROG_URL' in os.environ and 'JFROG_USERNAME' in os.environ and \
|
||||
os.environ['JFROG_URL'] != "" and os.environ['JFROG_USERNAME'] != "":
|
||||
jfrog_ready = True
|
||||
else:
|
||||
print("JFrog tests disabled: JFrog creds not found in the environment (JFROG_URL, JFROG_USERNAME, JFROG_PASSWORD)")
|
||||
jfrog_ready = False
|
||||
except ImportError as e:
|
||||
print("JFrog tests disabled: can't import requests", e)
|
||||
jfrog_ready = False
|
||||
|
||||
|
||||
class JFrogTest(BaseTest):
|
||||
"""
|
||||
BaseTest + support for JFrog
|
||||
"""
|
||||
|
||||
jfrogOverrides = {}
|
||||
|
||||
def fixture_available(self):
|
||||
return super(JFrogTest, self).fixture_available() and jfrog_ready
|
||||
|
||||
def prepare(self):
|
||||
self.repository = "aptly-sys-test-" + str(uuid.uuid1())
|
||||
self.jfrog_url = os.environ["JFROG_URL"]
|
||||
self.jfrog_username = os.environ["JFROG_USERNAME"]
|
||||
self.jfrog_password = os.environ["JFROG_PASSWORD"]
|
||||
|
||||
# Create repository via REST API
|
||||
auth = (self.jfrog_username, self.jfrog_password)
|
||||
create_url = f"{self.jfrog_url}/api/repositories/{self.repository}"
|
||||
payload = {
|
||||
"key": self.repository,
|
||||
"rclass": "local",
|
||||
"packageType": "generic"
|
||||
}
|
||||
res = requests.put(create_url, json=payload, auth=auth)
|
||||
if res.status_code >= 400:
|
||||
raise Exception(f"Failed to create JFrog repository: {res.text}")
|
||||
|
||||
self.configOverride = {"JFrogPublishEndpoints": {
|
||||
"test1": {
|
||||
"url": self.jfrog_url,
|
||||
"repository": self.repository,
|
||||
"username": self.jfrog_username,
|
||||
"password": self.jfrog_password
|
||||
}
|
||||
}}
|
||||
|
||||
self.configOverride["JFrogPublishEndpoints"]["test1"].update(**self.jfrogOverrides)
|
||||
|
||||
super(JFrogTest, self).prepare()
|
||||
|
||||
def shutdown(self):
|
||||
if hasattr(self, "repository"):
|
||||
auth = (self.jfrog_username, self.jfrog_password)
|
||||
delete_url = f"{self.jfrog_url}/api/repositories/{self.repository}"
|
||||
requests.delete(delete_url, auth=auth)
|
||||
|
||||
super(JFrogTest, self).shutdown()
|
||||
|
||||
def check_path(self, path):
|
||||
if path.startswith("public/"):
|
||||
path = path[7:]
|
||||
|
||||
# Check against JFrog Artifactory API
|
||||
auth = (self.jfrog_username, self.jfrog_password)
|
||||
check_url = f"{self.jfrog_url}/api/storage/{self.repository}/{path}"
|
||||
res = requests.head(check_url, auth=auth)
|
||||
if res.status_code == 200:
|
||||
return True
|
||||
return False
|
||||
|
||||
def check_exists(self, path):
|
||||
if not self.check_path(path):
|
||||
raise Exception("path %s doesn't exist" % (path, ))
|
||||
|
||||
def check_not_exists(self, path):
|
||||
if self.check_path(path):
|
||||
raise Exception("path %s exists" % (path, ))
|
||||
|
||||
def read_file(self, path, mode=''):
|
||||
assert not mode
|
||||
if path.startswith("public/"):
|
||||
path = path[7:]
|
||||
|
||||
auth = (self.jfrog_username, self.jfrog_password)
|
||||
get_url = f"{self.jfrog_url}/{self.repository}/{path}"
|
||||
res = requests.get(get_url, auth=auth)
|
||||
res.raise_for_status()
|
||||
return res.text
|
||||
@@ -1,4 +1,5 @@
|
||||
azure-storage-blob
|
||||
google-cloud-storage
|
||||
boto
|
||||
requests==2.33.0
|
||||
requests-unixsocket
|
||||
|
||||
@@ -34,7 +34,9 @@
|
||||
"skipContentsPublishing": false,
|
||||
"skipBz2Publishing": false,
|
||||
"FileSystemPublishEndpoints": {},
|
||||
"JFrogPublishEndpoints": null,
|
||||
"S3PublishEndpoints": {},
|
||||
"GcsPublishEndpoints": {},
|
||||
"SwiftPublishEndpoints": {},
|
||||
"AzurePublishEndpoints": {},
|
||||
"packagePoolStorage": {}
|
||||
|
||||
@@ -32,7 +32,9 @@ gpg_keys: []
|
||||
skip_contents_publishing: false
|
||||
skip_bz2_publishing: false
|
||||
filesystem_publish_endpoints: {}
|
||||
jfrog_publish_endpoints: {}
|
||||
s3_publish_endpoints: {}
|
||||
gcs_publish_endpoints: {}
|
||||
swift_publish_endpoints: {}
|
||||
azure_publish_endpoints: {}
|
||||
packagepool_storage: {}
|
||||
|
||||
@@ -196,6 +196,35 @@ filesystem_publish_endpoints:
|
||||
#
|
||||
# `aptly publish snapshot wheezy-main s3:test:`
|
||||
#
|
||||
|
||||
# JFrog Artifactory Endpoint Support
|
||||
#
|
||||
# aptly can be configured to publish repositories directly to JFrog Artifactory. First,
|
||||
# publishing endpoints should be described in the aptly configuration file.
|
||||
#
|
||||
# The destination Artifactory repo should be of the "generic" type, not "debian".
|
||||
#
|
||||
# In order to publish to JFrog, specify endpoint as `jfrog:endpoint-name:` before
|
||||
# publishing prefix on the command line, e.g.:
|
||||
#
|
||||
# `aptly publish snapshot wheezy-main jfrog:test:`
|
||||
#
|
||||
jfrog_publish_endpoints:
|
||||
# # Endpoint Name
|
||||
# test:
|
||||
# # JFrog URL
|
||||
# url: "https://artifactory.example.com/artifactory/"
|
||||
# # Repository
|
||||
# repository: apt-local
|
||||
# # Jfrog credentials to authenticate to Artifactory. If not supplied, the
|
||||
# # environment variables `JFROG_USERNAME`, `JFROG_PASSWORD`, `JFROG_APIKEY`,
|
||||
# # and `JFROG_ACCESSTOKEN` can be used
|
||||
# # Authentication requires one of: user+pass, api key, or access token
|
||||
# username: admin
|
||||
# password: password
|
||||
# api_key: api_key
|
||||
# access_token: access_token
|
||||
|
||||
s3_publish_endpoints:
|
||||
# # Endpoint Name
|
||||
# test:
|
||||
@@ -256,6 +285,58 @@ s3_publish_endpoints:
|
||||
# # Enables detailed request/response dump for each S3 operation
|
||||
# debug: false
|
||||
|
||||
# GCS Endpoint Support
|
||||
#
|
||||
# aptly can be configured to publish repositories directly to Google Cloud
|
||||
# Storage. First, publishing endpoints should be described in the aptly
|
||||
# configuration file. Each endpoint has a name and associated settings.
|
||||
#
|
||||
# In order to publish to GCS, specify endpoint as `gcs:endpoint-name:` before
|
||||
# publishing prefix on the command line, e.g.:
|
||||
#
|
||||
# `aptly publish snapshot wheezy-main gcs:test:`
|
||||
#
|
||||
gcs_publish_endpoints:
|
||||
# # Endpoint Name
|
||||
# test:
|
||||
# # Bucket name
|
||||
# bucket: test-bucket
|
||||
# # Prefix (optional)
|
||||
# # publishing under specified prefix in the bucket, defaults to
|
||||
# # no prefix (bucket root)
|
||||
# prefix: ""
|
||||
# # Credentials File (optional)
|
||||
# # Path to a service account credentials JSON file
|
||||
# credentials_file: ""
|
||||
# # Service Account JSON (optional)
|
||||
# # Inline service account credentials JSON payload
|
||||
# service_account_json: ""
|
||||
# # Project (optional)
|
||||
# # Quota project used for GCS requests
|
||||
# project: ""
|
||||
# # Endpoint (optional)
|
||||
# # Override the GCS endpoint (e.g. for staging or a fake server);
|
||||
# # leave empty to use the default GCS endpoint
|
||||
# endpoint: ""
|
||||
# # Default ACLs (optional)
|
||||
# # assign ACL to published files:
|
||||
# # * private (default)
|
||||
# # * public-read (public repository)
|
||||
# # * none (don't set ACL)
|
||||
# acl: private
|
||||
# # Storage Class (optional)
|
||||
# # GCS storage class, e.g. `STANDARD`
|
||||
# storage_class: STANDARD
|
||||
# # Encryption Key (optional)
|
||||
# # Customer-supplied encryption key (32-byte AES-256 key)
|
||||
# encryption_key: ""
|
||||
# # Disable MultiDel (optional)
|
||||
# # Kept for parity with S3 settings; GCS deletes are one-by-one
|
||||
# disable_multidel: false
|
||||
# # Debug (optional)
|
||||
# # Enables detailed logs for each GCS operation
|
||||
# debug: false
|
||||
|
||||
# Swift Endpoint Support
|
||||
#
|
||||
# aptly can publish a repository directly to OpenStack Swift.
|
||||
@@ -344,3 +425,5 @@ packagepool_storage:
|
||||
# # defaults to "https://<accountName>.blob.core.windows.net"
|
||||
# endpoint: ""
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
from gcs_lib import GCSTest
|
||||
|
||||
|
||||
def strip_processor(output):
|
||||
return '\n'.join(
|
||||
[
|
||||
l
|
||||
for l in output.split('\n')
|
||||
if not l.startswith(' ') and not l.startswith('Date:')
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
class GCSPublish1Test(GCSTest):
|
||||
"""
|
||||
publish to GCS: from repo
|
||||
"""
|
||||
|
||||
fixtureCmds = [
|
||||
'aptly repo create -distribution=maverick local-repo',
|
||||
'aptly repo add local-repo ${files}',
|
||||
'aptly repo remove local-repo libboost-program-options-dev_1.62.0.1_i386',
|
||||
]
|
||||
runCmd = 'aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec local-repo gcs:test1:'
|
||||
|
||||
def check(self):
|
||||
self.check_exists('public/dists/maverick/InRelease')
|
||||
self.check_exists('public/dists/maverick/Release')
|
||||
self.check_exists('public/dists/maverick/Release.gpg')
|
||||
|
||||
self.check_exists('public/dists/maverick/main/binary-i386/Packages')
|
||||
self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz')
|
||||
self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2')
|
||||
self.check_exists('public/dists/maverick/main/source/Sources')
|
||||
self.check_exists('public/dists/maverick/main/source/Sources.gz')
|
||||
self.check_exists('public/dists/maverick/main/source/Sources.bz2')
|
||||
|
||||
self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.dsc')
|
||||
self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.diff.gz')
|
||||
self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz')
|
||||
self.check_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
|
||||
self.check_exists(
|
||||
'public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb'
|
||||
)
|
||||
|
||||
# verify contents except sums/date chunks
|
||||
self.check_file_contents(
|
||||
'public/dists/maverick/Release', 'release', match_prepare=strip_processor
|
||||
)
|
||||
self.check_file_contents(
|
||||
'public/dists/maverick/main/source/Sources',
|
||||
'sources',
|
||||
match_prepare=lambda s: '\n'.join(sorted(s.split('\n'))),
|
||||
)
|
||||
self.check_file_contents(
|
||||
'public/dists/maverick/main/binary-i386/Packages',
|
||||
'binary',
|
||||
match_prepare=lambda s: '\n'.join(sorted(s.split('\n'))),
|
||||
)
|
||||
|
||||
|
||||
class GCSPublish2Test(GCSTest):
|
||||
"""
|
||||
publish to GCS: update after removing package from repo
|
||||
"""
|
||||
|
||||
fixtureCmds = [
|
||||
'aptly repo create -distribution=maverick local-repo',
|
||||
'aptly repo add local-repo ${files}/',
|
||||
'aptly repo remove local-repo libboost-program-options-dev_1.62.0.1_i386',
|
||||
'aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec local-repo gcs:test1:',
|
||||
'aptly repo remove local-repo pyspi',
|
||||
]
|
||||
runCmd = 'aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick gcs:test1:'
|
||||
|
||||
def check(self):
|
||||
self.check_exists('public/dists/maverick/InRelease')
|
||||
self.check_exists('public/dists/maverick/Release')
|
||||
self.check_exists('public/dists/maverick/Release.gpg')
|
||||
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.dsc')
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.diff.gz')
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz')
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
|
||||
self.check_exists(
|
||||
'public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb'
|
||||
)
|
||||
|
||||
|
||||
class GCSPublish3Test(GCSTest):
|
||||
"""
|
||||
publish to GCS: publish drop performs cleanup
|
||||
"""
|
||||
|
||||
fixtureCmds = [
|
||||
'aptly repo create local1',
|
||||
'aptly repo create local2',
|
||||
'aptly repo add local1 ${files}/libboost-program-options-dev_1.49.0.1_i386.deb',
|
||||
'aptly repo add local2 ${files}',
|
||||
'aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=sq1 local1 gcs:test1:',
|
||||
'aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=sq2 local2 gcs:test1:',
|
||||
]
|
||||
runCmd = 'aptly publish drop sq2 gcs:test1:'
|
||||
|
||||
def check(self):
|
||||
self.check_exists('public/dists/sq1')
|
||||
self.check_not_exists('public/dists/sq2')
|
||||
self.check_exists('public/pool/main/')
|
||||
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.dsc')
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.diff.gz')
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz')
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
|
||||
self.check_exists(
|
||||
'public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb'
|
||||
)
|
||||
@@ -0,0 +1,116 @@
|
||||
from jfrog_lib import JFrogTest
|
||||
|
||||
|
||||
def strip_processor(output):
|
||||
return '\n'.join(
|
||||
[
|
||||
l
|
||||
for l in output.split('\n')
|
||||
if not l.startswith(' ') and not l.startswith('Date:')
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
class JFrogPublish1Test(JFrogTest):
|
||||
"""
|
||||
publish to JFrog: from repo
|
||||
"""
|
||||
|
||||
fixtureCmds = [
|
||||
'aptly repo create -distribution=maverick local-repo',
|
||||
'aptly repo add local-repo ${files}',
|
||||
'aptly repo remove local-repo libboost-program-options-dev_1.62.0.1_i386',
|
||||
]
|
||||
runCmd = 'aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec local-repo jfrog:test1:'
|
||||
|
||||
def check(self):
|
||||
self.check_exists('public/dists/maverick/InRelease')
|
||||
self.check_exists('public/dists/maverick/Release')
|
||||
self.check_exists('public/dists/maverick/Release.gpg')
|
||||
|
||||
self.check_exists('public/dists/maverick/main/binary-i386/Packages')
|
||||
self.check_exists('public/dists/maverick/main/binary-i386/Packages.gz')
|
||||
self.check_exists('public/dists/maverick/main/binary-i386/Packages.bz2')
|
||||
self.check_exists('public/dists/maverick/main/source/Sources')
|
||||
self.check_exists('public/dists/maverick/main/source/Sources.gz')
|
||||
self.check_exists('public/dists/maverick/main/source/Sources.bz2')
|
||||
|
||||
self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.dsc')
|
||||
self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.diff.gz')
|
||||
self.check_exists('public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz')
|
||||
self.check_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
|
||||
self.check_exists(
|
||||
'public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb'
|
||||
)
|
||||
|
||||
# verify contents except sums/date chunks
|
||||
self.check_file_contents(
|
||||
'public/dists/maverick/Release', 'release', match_prepare=strip_processor
|
||||
)
|
||||
self.check_file_contents(
|
||||
'public/dists/maverick/main/source/Sources',
|
||||
'sources',
|
||||
match_prepare=lambda s: '\n'.join(sorted(s.split('\n'))),
|
||||
)
|
||||
self.check_file_contents(
|
||||
'public/dists/maverick/main/binary-i386/Packages',
|
||||
'binary',
|
||||
match_prepare=lambda s: '\n'.join(sorted(s.split('\n'))),
|
||||
)
|
||||
|
||||
|
||||
class JFrogPublish2Test(JFrogTest):
|
||||
"""
|
||||
publish to JFrog: update after removing package from repo
|
||||
"""
|
||||
|
||||
fixtureCmds = [
|
||||
'aptly repo create -distribution=maverick local-repo',
|
||||
'aptly repo add local-repo ${files}/',
|
||||
'aptly repo remove local-repo libboost-program-options-dev_1.62.0.1_i386',
|
||||
'aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec local-repo jfrog:test1:',
|
||||
'aptly repo remove local-repo pyspi',
|
||||
]
|
||||
runCmd = 'aptly publish update -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec maverick jfrog:test1:'
|
||||
|
||||
def check(self):
|
||||
self.check_exists('public/dists/maverick/InRelease')
|
||||
self.check_exists('public/dists/maverick/Release')
|
||||
self.check_exists('public/dists/maverick/Release.gpg')
|
||||
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.dsc')
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.diff.gz')
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz')
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
|
||||
self.check_exists(
|
||||
'public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb'
|
||||
)
|
||||
|
||||
|
||||
class JFrogPublish3Test(JFrogTest):
|
||||
"""
|
||||
publish to JFrog: publish drop performs cleanup
|
||||
"""
|
||||
|
||||
fixtureCmds = [
|
||||
'aptly repo create local1',
|
||||
'aptly repo create local2',
|
||||
'aptly repo add local1 ${files}/libboost-program-options-dev_1.49.0.1_i386.deb',
|
||||
'aptly repo add local2 ${files}',
|
||||
'aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=sq1 local1 jfrog:test1:',
|
||||
'aptly publish repo -keyring=${files}/aptly.pub -secret-keyring=${files}/aptly.sec -distribution=sq2 local2 jfrog:test1:',
|
||||
]
|
||||
runCmd = 'aptly publish drop sq2 jfrog:test1:'
|
||||
|
||||
def check(self):
|
||||
self.check_exists('public/dists/sq1')
|
||||
self.check_not_exists('public/dists/sq2')
|
||||
self.check_exists('public/pool/main/')
|
||||
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.dsc')
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1-1.3.diff.gz')
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi_0.6.1.orig.tar.gz')
|
||||
self.check_not_exists('public/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc')
|
||||
self.check_exists(
|
||||
'public/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb'
|
||||
)
|
||||
@@ -1,4 +1,10 @@
|
||||
import inspect
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
from api_lib import APITest
|
||||
from lib import BaseTest
|
||||
|
||||
|
||||
class FilesAPITestUpload(APITest):
|
||||
@@ -97,3 +103,76 @@ class FilesAPITestSecurity(APITest):
|
||||
self.check_equal(self.delete("/api/files/../.").status_code, 404)
|
||||
self.check_equal(self.delete("/api/files/./..").status_code, 404)
|
||||
self.check_equal(self.delete("/api/files/dir/..").status_code, 404)
|
||||
|
||||
|
||||
class FilesAPITestDputUpload(APITest):
|
||||
"""
|
||||
PUT /api/files/:dir/:file via dput, then POST /api/repos/:name/include/:dir
|
||||
|
||||
Uses the real dput binary to upload a .changes file and all its referenced
|
||||
files to the aptly API, then imports them into a local repo via include.
|
||||
Skipped if dput is not installed.
|
||||
"""
|
||||
|
||||
def fixture_available(self):
|
||||
return super().fixture_available() and shutil.which("dput") is not None
|
||||
|
||||
def check(self):
|
||||
d = self.random_name()
|
||||
repo_name = self.random_name()
|
||||
|
||||
# Create target repo
|
||||
self.check_equal(
|
||||
self.post("/api/repos", json={"Name": repo_name}).status_code, 201)
|
||||
|
||||
changes_dir = os.path.join(
|
||||
os.path.dirname(inspect.getsourcefile(BaseTest)), "changes")
|
||||
changes_file = os.path.join(changes_dir, "hardlink_0.2.1_amd64.changes")
|
||||
|
||||
# dput strips leading/trailing slashes from 'incoming' then prepends /,
|
||||
# producing: PUT http://{fqdn}/api/files/{d}/{filename}
|
||||
# fqdn includes host:port so dput connects directly to the test API server.
|
||||
dput_cf = (
|
||||
"[aptly]\n"
|
||||
f"fqdn = {self.base_url}\n"
|
||||
"method = http\n"
|
||||
f"incoming = api/files/{d}\n"
|
||||
"login = *\n"
|
||||
"allow_unsigned_uploads = 1\n"
|
||||
"allow_dcut = 0\n"
|
||||
)
|
||||
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
try:
|
||||
dput_cf_path = os.path.join(tmpdir, "dput.cf")
|
||||
with open(dput_cf_path, "w") as f:
|
||||
f.write(dput_cf)
|
||||
|
||||
# dput -U: allow unsigned uploads (skip local GPG check)
|
||||
# dput reads the .changes and PUTs every file listed in Files: + the .changes itself
|
||||
self.run_cmd(["dput", "-c", dput_cf_path, "-U", "aptly", changes_file])
|
||||
finally:
|
||||
shutil.rmtree(tmpdir)
|
||||
|
||||
# All files referenced in the .changes must now be present in the upload dir
|
||||
self.check_exists(f"upload/{d}/hardlink_0.2.1_amd64.changes")
|
||||
self.check_exists(f"upload/{d}/hardlink_0.2.1.dsc")
|
||||
self.check_exists(f"upload/{d}/hardlink_0.2.1.tar.gz")
|
||||
self.check_exists(f"upload/{d}/hardlink_0.2.1_amd64.deb")
|
||||
|
||||
# Import via the .changes file into the repo
|
||||
resp = self.post_task(
|
||||
f"/api/repos/{repo_name}/include/{d}",
|
||||
params={"ignoreSignature": 1})
|
||||
self.check_task(resp)
|
||||
|
||||
output = self.get(f"/api/tasks/{resp.json()['ID']}/output")
|
||||
self.check_in(b"Added: hardlink_0.2.1_source added, hardlink_0.2.1_amd64 added", output.content)
|
||||
|
||||
# Packages must be in the repo
|
||||
self.check_equal(
|
||||
sorted(self.get(f"/api/repos/{repo_name}/packages").json()),
|
||||
["Pamd64 hardlink 0.2.1 daf8fcecbf8210ad", "Psource hardlink 0.2.1 8f72df429d7166e5"])
|
||||
|
||||
# include cleans up the upload dir
|
||||
self.check_not_exists(f"upload/{d}")
|
||||
|
||||
@@ -666,6 +666,160 @@ class PublishUpdateAPIMultiDist(APITest):
|
||||
self.check_not_exists("public/" + prefix + "dists/")
|
||||
|
||||
|
||||
class PublishUpdateAPIMultiDistToggle(APITest):
|
||||
"""
|
||||
POST /publish/:prefix with MultiDist=false, then PUT to enable MultiDist=true
|
||||
"""
|
||||
fixtureGpg = True
|
||||
|
||||
def check(self):
|
||||
repo_name = self.random_name()
|
||||
self.check_equal(self.post(
|
||||
"/api/repos", json={"Name": repo_name, "DefaultDistribution": "bookworm"}).status_code, 201)
|
||||
|
||||
d = self.random_name()
|
||||
self.check_equal(self.upload("/api/files/" + d,
|
||||
"libboost-program-options-dev_1.49.0.1_i386.deb", "pyspi_0.6.1-1.3.dsc",
|
||||
"pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz",
|
||||
"pyspi-0.6.1-1.3.stripped.dsc").status_code, 200)
|
||||
|
||||
task = self.post_task("/api/repos/" + repo_name + "/file/" + d)
|
||||
self.check_task(task)
|
||||
|
||||
# Publish with MultiDist=false (default)
|
||||
prefix = self.random_name()
|
||||
task = self.post_task(
|
||||
"/api/publish/" + prefix,
|
||||
json={
|
||||
"Architectures": ["i386", "source"],
|
||||
"SourceKind": "local",
|
||||
"Sources": [{"Name": repo_name}],
|
||||
"Signing": DefaultSigningOptions,
|
||||
"MultiDist": False,
|
||||
}
|
||||
)
|
||||
self.check_task(task)
|
||||
|
||||
repo_expected = {
|
||||
'AcquireByHash': False,
|
||||
'Architectures': ['i386', 'source'],
|
||||
'Codename': '',
|
||||
'Distribution': 'bookworm',
|
||||
'Label': '',
|
||||
'Origin': '',
|
||||
'Version': '',
|
||||
'NotAutomatic': '',
|
||||
'ButAutomaticUpgrades': '',
|
||||
'Path': prefix + '/' + 'bookworm',
|
||||
'Prefix': prefix,
|
||||
'SignedBy': '',
|
||||
'SkipContents': False,
|
||||
'MultiDist': False,
|
||||
'SourceKind': 'local',
|
||||
'Sources': [{'Component': 'main', 'Name': repo_name}],
|
||||
'Storage': '',
|
||||
'Suite': ''}
|
||||
|
||||
all_repos = self.get("/api/publish")
|
||||
self.check_equal(all_repos.status_code, 200)
|
||||
self.check_in(repo_expected, all_repos.json())
|
||||
|
||||
# With MultiDist=false packages are stored under pool/main/...
|
||||
self.check_exists("public/" + prefix + "/dists/bookworm/Release")
|
||||
self.check_exists("public/" + prefix +
|
||||
"/dists/bookworm/main/binary-i386/Packages")
|
||||
self.check_exists("public/" + prefix +
|
||||
"/dists/bookworm/main/source/Sources")
|
||||
self.check_exists(
|
||||
"public/" + prefix + "/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb")
|
||||
self.check_exists(
|
||||
"public/" + prefix + "/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc")
|
||||
# MultiDist-style per-distribution pool must not exist yet
|
||||
self.check_not_exists(
|
||||
"public/" + prefix + "/pool/bookworm/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb")
|
||||
|
||||
# Now update the published repo enabling MultiDist=true
|
||||
task = self.put_task(
|
||||
"/api/publish/" + prefix + "/bookworm",
|
||||
json={
|
||||
"MultiDist": True,
|
||||
"Signing": DefaultSigningOptions,
|
||||
}
|
||||
)
|
||||
self.check_task(task)
|
||||
|
||||
repo_expected_multidist = {
|
||||
'AcquireByHash': False,
|
||||
'Architectures': ['i386', 'source'],
|
||||
'Codename': '',
|
||||
'Distribution': 'bookworm',
|
||||
'Label': '',
|
||||
'Origin': '',
|
||||
'Version': '',
|
||||
'NotAutomatic': '',
|
||||
'ButAutomaticUpgrades': '',
|
||||
'Path': prefix + '/' + 'bookworm',
|
||||
'Prefix': prefix,
|
||||
'SignedBy': '',
|
||||
'SkipContents': False,
|
||||
'MultiDist': True,
|
||||
'SourceKind': 'local',
|
||||
'Sources': [{'Component': 'main', 'Name': repo_name}],
|
||||
'Storage': '',
|
||||
'Suite': ''}
|
||||
|
||||
all_repos = self.get("/api/publish")
|
||||
self.check_equal(all_repos.status_code, 200)
|
||||
self.check_in(repo_expected_multidist, all_repos.json())
|
||||
|
||||
# After enabling MultiDist, packages are stored under pool/<distribution>/main/...
|
||||
self.check_exists("public/" + prefix + "/dists/bookworm/Release")
|
||||
self.check_exists("public/" + prefix +
|
||||
"/dists/bookworm/main/binary-i386/Packages")
|
||||
self.check_exists("public/" + prefix +
|
||||
"/dists/bookworm/main/source/Sources")
|
||||
self.check_exists(
|
||||
"public/" + prefix + "/pool/bookworm/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb")
|
||||
self.check_exists(
|
||||
"public/" + prefix + "/pool/bookworm/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc")
|
||||
# Flat pool must not exist while MultiDist is on
|
||||
self.check_not_exists(
|
||||
"public/" + prefix + "/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb")
|
||||
|
||||
# Switch MultiDist back to false
|
||||
task = self.put_task(
|
||||
"/api/publish/" + prefix + "/bookworm",
|
||||
json={
|
||||
"MultiDist": False,
|
||||
"Signing": DefaultSigningOptions,
|
||||
}
|
||||
)
|
||||
self.check_task(task)
|
||||
|
||||
repo_expected["MultiDist"] = False
|
||||
all_repos = self.get("/api/publish")
|
||||
self.check_equal(all_repos.status_code, 200)
|
||||
self.check_in(repo_expected, all_repos.json())
|
||||
|
||||
# Packages are back under the flat pool/main/...
|
||||
self.check_exists("public/" + prefix + "/dists/bookworm/Release")
|
||||
self.check_exists("public/" + prefix +
|
||||
"/dists/bookworm/main/binary-i386/Packages")
|
||||
self.check_exists("public/" + prefix +
|
||||
"/dists/bookworm/main/source/Sources")
|
||||
self.check_exists(
|
||||
"public/" + prefix + "/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb")
|
||||
self.check_exists(
|
||||
"public/" + prefix + "/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc")
|
||||
# Per-distribution pool must be gone
|
||||
self.check_not_exists(
|
||||
"public/" + prefix + "/pool/bookworm/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb")
|
||||
|
||||
task = self.delete_task("/api/publish/" + prefix + "/bookworm")
|
||||
self.check_task(task)
|
||||
self.check_not_exists("public/" + prefix + "dists/")
|
||||
|
||||
|
||||
class PublishConcurrentUpdateAPITestRepo(APITest):
|
||||
"""
|
||||
PUT /publish/:prefix/:distribution (local repos), DELETE /publish/:prefix/:distribution
|
||||
@@ -992,6 +1146,231 @@ class PublishSwitchAPITestRepo(APITest):
|
||||
self.check_not_exists("public/" + prefix + "dists/")
|
||||
|
||||
|
||||
class PublishSwitchAPITestMirror(APITest):
|
||||
"""
|
||||
PUT /publish/:prefix/:distribution (snapshots), DELETE /publish/:prefix/:distribution
|
||||
"""
|
||||
fixtureGpg = True
|
||||
|
||||
def check(self):
|
||||
mirror_name = self.random_name()
|
||||
mirror_desc = {'Name': mirror_name,
|
||||
'ArchiveURL': 'http://repo.aptly.info/system-tests/packagecloud.io/varnishcache/varnish30/debian/',
|
||||
'Distribution': 'wheezy',
|
||||
'Keyrings': ["aptlytest.gpg"],
|
||||
'Architectures': ["amd64"],
|
||||
'Components': ['main']}
|
||||
mirror_desc['IgnoreSignatures'] = True
|
||||
|
||||
# Create Mirror
|
||||
resp = self.post("/api/mirrors", json=mirror_desc)
|
||||
self.check_equal(resp.status_code, 201)
|
||||
|
||||
# Get Mirror
|
||||
resp = self.get("/api/mirrors/" + mirror_name + "/packages")
|
||||
self.check_equal(resp.status_code, 404)
|
||||
|
||||
# Update Mirror
|
||||
resp = self.put_task("/api/mirrors/" + mirror_name, json=mirror_desc)
|
||||
self.check_task(resp)
|
||||
|
||||
# Snapshot Mirror
|
||||
snapshot1_name = self.random_name()
|
||||
task = self.post_task("/api/mirrors/" + mirror_name + '/snapshots', json={'Name': snapshot1_name})
|
||||
self.check_task(task)
|
||||
|
||||
# Publish Snapshot
|
||||
prefix = self.random_name()
|
||||
task = self.post_task(
|
||||
"/api/publish/" + prefix,
|
||||
json={
|
||||
"Architectures": ["i386", "source"],
|
||||
"SourceKind": "snapshot",
|
||||
"Sources": [{"Name": snapshot1_name}],
|
||||
"Signing": DefaultSigningOptions,
|
||||
})
|
||||
self.check_task(task)
|
||||
|
||||
repo_expected = {
|
||||
'AcquireByHash': False,
|
||||
'Architectures': ['i386', 'source'],
|
||||
'Codename': '',
|
||||
'Distribution': 'wheezy',
|
||||
'Label': '',
|
||||
'NotAutomatic': '',
|
||||
'ButAutomaticUpgrades': '',
|
||||
'Origin': 'packagecloud.io/varnishcache/varnish30',
|
||||
'Version': '',
|
||||
'Path': prefix + '/' + 'wheezy',
|
||||
'Prefix': prefix,
|
||||
'SignedBy': '',
|
||||
'SkipContents': False,
|
||||
'MultiDist': False,
|
||||
'SourceKind': 'snapshot',
|
||||
'Sources': [{'Component': 'main', 'Name': snapshot1_name}],
|
||||
'Storage': '',
|
||||
'Suite': ''}
|
||||
all_repos = self.get("/api/publish")
|
||||
self.check_equal(all_repos.status_code, 200)
|
||||
self.check_in(repo_expected, all_repos.json())
|
||||
|
||||
# Snapshot Mirror 2
|
||||
snapshot2_name = self.random_name()
|
||||
task = self.post_task("/api/mirrors/" + mirror_name + '/snapshots', json={'Name': snapshot2_name})
|
||||
self.check_task(task)
|
||||
|
||||
task = self.put_task(
|
||||
"/api/publish/" + prefix + "/wheezy",
|
||||
json={
|
||||
"Snapshots": [{"Component": "main", "Name": snapshot2_name}],
|
||||
"Signing": DefaultSigningOptions,
|
||||
"SkipContents": True,
|
||||
"Label": "fun",
|
||||
"Origin": "earth",
|
||||
"Version": "13.3",
|
||||
})
|
||||
self.check_task(task)
|
||||
repo_expected = {
|
||||
'AcquireByHash': False,
|
||||
'Architectures': ['i386', 'source'],
|
||||
'Codename': '',
|
||||
'Distribution': 'wheezy',
|
||||
'Label': 'fun',
|
||||
'Origin': 'earth',
|
||||
'Version': '13.3',
|
||||
'NotAutomatic': '',
|
||||
'ButAutomaticUpgrades': '',
|
||||
'Path': prefix + '/' + 'wheezy',
|
||||
'Prefix': prefix,
|
||||
'SignedBy': '',
|
||||
'SkipContents': True,
|
||||
'MultiDist': False,
|
||||
'SourceKind': 'snapshot',
|
||||
'Sources': [{'Component': 'main', 'Name': snapshot2_name}],
|
||||
'Storage': '',
|
||||
'Suite': ''}
|
||||
|
||||
all_repos = self.get("/api/publish")
|
||||
self.check_equal(all_repos.status_code, 200)
|
||||
self.check_in(repo_expected, all_repos.json())
|
||||
|
||||
task = self.delete_task("/api/publish/" + prefix + "/wheezy")
|
||||
self.check_task(task)
|
||||
self.check_not_exists("public/" + prefix + "dists/")
|
||||
|
||||
|
||||
class PublishSwitchAPITestSnapshot(APITest):
|
||||
"""
|
||||
publish snapshot of snapshot
|
||||
"""
|
||||
fixtureGpg = True
|
||||
|
||||
def check(self):
|
||||
repo_name = self.random_name()
|
||||
self.check_equal(self.post(
|
||||
"/api/repos", json={"Name": repo_name, "DefaultDistribution": "wheezy"}).status_code, 201)
|
||||
|
||||
d = self.random_name()
|
||||
self.check_equal(
|
||||
self.upload("/api/files/" + d,
|
||||
"pyspi_0.6.1-1.3.dsc",
|
||||
"pyspi_0.6.1-1.3.diff.gz", "pyspi_0.6.1.orig.tar.gz",
|
||||
"pyspi-0.6.1-1.3.stripped.dsc").status_code, 200)
|
||||
task = self.post_task("/api/repos/" + repo_name + "/file/" + d)
|
||||
self.check_task(task)
|
||||
|
||||
snapshot1_name = self.random_name()
|
||||
task = self.post_task("/api/repos/" + repo_name + '/snapshots', json={'Name': snapshot1_name})
|
||||
self.check_task(task)
|
||||
|
||||
prefix = self.random_name()
|
||||
task = self.post_task(
|
||||
"/api/publish/" + prefix,
|
||||
json={
|
||||
"Architectures": ["i386", "source"],
|
||||
"SourceKind": "snapshot",
|
||||
"Sources": [{"Name": snapshot1_name}],
|
||||
"Signing": DefaultSigningOptions,
|
||||
})
|
||||
self.check_task(task)
|
||||
|
||||
repo_expected = {
|
||||
'AcquireByHash': False,
|
||||
'Architectures': ['i386', 'source'],
|
||||
'Codename': '',
|
||||
'Distribution': 'wheezy',
|
||||
'Label': '',
|
||||
'NotAutomatic': '',
|
||||
'ButAutomaticUpgrades': '',
|
||||
'Origin': '',
|
||||
'Version': '',
|
||||
'Path': prefix + '/' + 'wheezy',
|
||||
'Prefix': prefix,
|
||||
'SignedBy': '',
|
||||
'SkipContents': False,
|
||||
'MultiDist': False,
|
||||
'SourceKind': 'snapshot',
|
||||
'Sources': [{'Component': 'main', 'Name': snapshot1_name}],
|
||||
'Storage': '',
|
||||
'Suite': ''}
|
||||
all_repos = self.get("/api/publish")
|
||||
self.check_equal(all_repos.status_code, 200)
|
||||
self.check_in(repo_expected, all_repos.json())
|
||||
|
||||
self.check_not_exists(
|
||||
"public/" + prefix + "/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb")
|
||||
self.check_exists("public/" + prefix +
|
||||
"/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc")
|
||||
|
||||
snapshot2_name = self.random_name()
|
||||
task = self.post_task("/api/snapshots", json={"Name": snapshot2_name, 'SourceSnapshots': [snapshot1_name]})
|
||||
self.check_task(task)
|
||||
|
||||
task = self.put_task(
|
||||
"/api/publish/" + prefix + "/wheezy",
|
||||
json={
|
||||
"Snapshots": [{"Component": "main", "Name": snapshot2_name}],
|
||||
"Signing": DefaultSigningOptions,
|
||||
"SkipContents": True,
|
||||
"Label": "fun",
|
||||
"Origin": "earth",
|
||||
"Version": "13.3",
|
||||
})
|
||||
self.check_task(task)
|
||||
repo_expected = {
|
||||
'AcquireByHash': False,
|
||||
'Architectures': ['i386', 'source'],
|
||||
'Codename': '',
|
||||
'Distribution': 'wheezy',
|
||||
'Label': 'fun',
|
||||
'Origin': 'earth',
|
||||
'Version': '13.3',
|
||||
'NotAutomatic': '',
|
||||
'ButAutomaticUpgrades': '',
|
||||
'Path': prefix + '/' + 'wheezy',
|
||||
'Prefix': prefix,
|
||||
'SignedBy': '',
|
||||
'SkipContents': True,
|
||||
'MultiDist': False,
|
||||
'SourceKind': 'snapshot',
|
||||
'Sources': [{'Component': 'main', 'Name': snapshot2_name}],
|
||||
'Storage': '',
|
||||
'Suite': ''}
|
||||
|
||||
all_repos = self.get("/api/publish")
|
||||
self.check_equal(all_repos.status_code, 200)
|
||||
self.check_in(repo_expected, all_repos.json())
|
||||
|
||||
self.check_not_exists(
|
||||
"public/" + prefix + "/pool/main/b/boost-defaults/libboost-program-options-dev_1.49.0.1_i386.deb")
|
||||
self.check_exists("public/" + prefix +
|
||||
"/pool/main/p/pyspi/pyspi-0.6.1-1.3.stripped.dsc")
|
||||
|
||||
task = self.delete_task("/api/publish/" + prefix + "/wheezy")
|
||||
self.check_task(task)
|
||||
self.check_not_exists("public/" + prefix + "dists/")
|
||||
|
||||
|
||||
class PublishSwitchAPITestRepoSignedBy(APITest):
|
||||
"""
|
||||
PUT /publish/:prefix/:distribution (snapshots), DELETE /publish/:prefix/:distribution
|
||||
|
||||
@@ -461,3 +461,34 @@ class ReposAPITestCopyPackage(APITest):
|
||||
|
||||
self.check_equal(self.get(f"/api/repos/{repo2_name}/packages").json(),
|
||||
['Pi386 libboost-program-options-dev 1.49.0.1 918d2f433384e378'])
|
||||
|
||||
|
||||
class ReposAPITestCreateEdit(APITest):
|
||||
"""
|
||||
POST /api/repos,
|
||||
"""
|
||||
def check(self):
|
||||
repo_name = self.random_name() + ' with space'
|
||||
repo_desc = {'Comment': 'fun repo',
|
||||
'DefaultComponent': 'contrib',
|
||||
'DefaultDistribution': 'bookworm',
|
||||
'Name': repo_name}
|
||||
|
||||
resp = self.post("/api/repos", json=repo_desc)
|
||||
self.check_equal(resp.json(), repo_desc)
|
||||
self.check_equal(resp.status_code, 201)
|
||||
|
||||
repo_desc = {'Comment': 'modified repo',
|
||||
'DefaultComponent': 'main',
|
||||
'DefaultDistribution': 'trixie',
|
||||
'Name': repo_name + '@renamed'}
|
||||
resp = self.put(f"/api/repos/{repo_name}", json=repo_desc)
|
||||
self.check_equal(resp.json(), repo_desc)
|
||||
self.check_equal(resp.status_code, 200)
|
||||
|
||||
resp = self.get("/api/repos/" + repo_name + '@renamed')
|
||||
self.check_equal(resp.json(), repo_desc)
|
||||
self.check_equal(resp.status_code, 200)
|
||||
|
||||
resp = self.delete("/api/repos/" + repo_name + '@renamed')
|
||||
self.check_equal(resp.status_code, 200)
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import tempfile
|
||||
|
||||
class TestOut:
|
||||
def __init__(self):
|
||||
self.tmp_file = tempfile.NamedTemporaryFile(delete=False)
|
||||
self.tmp_file = tempfile.NamedTemporaryFile(delete=True)
|
||||
self.read_pos = 0
|
||||
|
||||
def fileno(self):
|
||||
|
||||
+38
-25
@@ -44,28 +44,30 @@ func (list *List) consumer() {
|
||||
for {
|
||||
select {
|
||||
case task := <-list.queue:
|
||||
// Set task state to RUNNING before processing
|
||||
list.Lock()
|
||||
{
|
||||
task.State = RUNNING
|
||||
}
|
||||
task.State = RUNNING
|
||||
list.Unlock()
|
||||
|
||||
go func() {
|
||||
retValue, err := task.process(aptly.Progress(task.output), task.detail)
|
||||
|
||||
// Update task completion state and cleanup with list lock held
|
||||
list.Lock()
|
||||
{
|
||||
task.processReturnValue = retValue
|
||||
task.err = err
|
||||
if err != nil {
|
||||
task.output.Printf("Task failed with error: %v", err)
|
||||
task.State = FAILED
|
||||
task.err = err
|
||||
task.processReturnValue = retValue
|
||||
} else {
|
||||
task.output.Print("Task succeeded")
|
||||
task.State = SUCCEEDED
|
||||
task.err = nil
|
||||
task.processReturnValue = retValue
|
||||
}
|
||||
|
||||
list.usedResources.Free(task.resources)
|
||||
list.usedResources.Free(task.Resources)
|
||||
|
||||
task.wgTask.Done()
|
||||
list.wg.Done()
|
||||
@@ -74,9 +76,9 @@ func (list *List) consumer() {
|
||||
for _, t := range list.tasks {
|
||||
if t.State == IDLE {
|
||||
// check resources
|
||||
blockingTasks := list.usedResources.UsedBy(t.resources)
|
||||
blockingTasks := list.usedResources.UsedBy(t.Resources)
|
||||
if len(blockingTasks) == 0 {
|
||||
list.usedResources.MarkInUse(t.resources, t)
|
||||
list.usedResources.MarkInUse(t.Resources, t)
|
||||
// unlock list since queueing may block
|
||||
list.Unlock()
|
||||
unlocked = true
|
||||
@@ -105,13 +107,15 @@ func (list *List) Stop() {
|
||||
|
||||
// GetTasks gets complete list of tasks
|
||||
func (list *List) GetTasks() []Task {
|
||||
tasks := []Task{}
|
||||
list.Lock()
|
||||
defer list.Unlock()
|
||||
|
||||
tasks := []Task{}
|
||||
for _, task := range list.tasks {
|
||||
// Copy task while holding list lock
|
||||
tasks = append(tasks, *task)
|
||||
}
|
||||
|
||||
list.Unlock()
|
||||
return tasks
|
||||
}
|
||||
|
||||
@@ -139,11 +143,11 @@ func (list *List) DeleteTaskByID(ID int) (Task, error) {
|
||||
// GetTaskByID returns task with given id
|
||||
func (list *List) GetTaskByID(ID int) (Task, error) {
|
||||
list.Lock()
|
||||
tasks := list.tasks
|
||||
list.Unlock()
|
||||
defer list.Unlock()
|
||||
|
||||
for _, task := range tasks {
|
||||
for _, task := range list.tasks {
|
||||
if task.ID == ID {
|
||||
// Copy task while holding list lock
|
||||
return *task, nil
|
||||
}
|
||||
}
|
||||
@@ -180,13 +184,16 @@ func (list *List) GetTaskDetailByID(ID int) (interface{}, error) {
|
||||
|
||||
// GetTaskReturnValueByID returns process return value of task with given id
|
||||
func (list *List) GetTaskReturnValueByID(ID int) (*ProcessReturnValue, error) {
|
||||
task, err := list.GetTaskByID(ID)
|
||||
list.Lock()
|
||||
defer list.Unlock()
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
for _, task := range list.tasks {
|
||||
if task.ID == ID {
|
||||
return task.processReturnValue, nil
|
||||
}
|
||||
}
|
||||
|
||||
return task.processReturnValue, nil
|
||||
return nil, fmt.Errorf("could not find task with id %v", ID)
|
||||
}
|
||||
|
||||
// RunTaskInBackground creates task and runs it in background. This will block until the necessary resources
|
||||
@@ -204,11 +211,15 @@ func (list *List) RunTaskInBackground(name string, resources []string, process P
|
||||
list.wg.Add(1)
|
||||
task.wgTask.Add(1)
|
||||
|
||||
// Copy task while still holding the lock to avoid racing with consumer
|
||||
// setting State=RUNNING after receiving from queue
|
||||
taskCopy := *task
|
||||
|
||||
// add task to queue for processing if resources are available
|
||||
// if not, task will be queued by the consumer once resources are available
|
||||
tasks := list.usedResources.UsedBy(resources)
|
||||
if len(tasks) == 0 {
|
||||
list.usedResources.MarkInUse(task.resources, task)
|
||||
list.usedResources.MarkInUse(task.Resources, task)
|
||||
// queueing task might block if channel not ready, unlock list before queueing
|
||||
list.Unlock()
|
||||
list.queue <- task
|
||||
@@ -216,12 +227,13 @@ func (list *List) RunTaskInBackground(name string, resources []string, process P
|
||||
list.Unlock()
|
||||
}
|
||||
|
||||
return *task, nil
|
||||
return taskCopy, nil
|
||||
}
|
||||
|
||||
// Clear removes finished tasks from list
|
||||
func (list *List) Clear() {
|
||||
list.Lock()
|
||||
defer list.Unlock()
|
||||
|
||||
var tasks []*Task
|
||||
for _, task := range list.tasks {
|
||||
@@ -230,8 +242,6 @@ func (list *List) Clear() {
|
||||
}
|
||||
}
|
||||
list.tasks = tasks
|
||||
|
||||
list.Unlock()
|
||||
}
|
||||
|
||||
// Wait waits till all tasks are processed
|
||||
@@ -254,11 +264,14 @@ func (list *List) WaitForTaskByID(ID int) (Task, error) {
|
||||
|
||||
// GetTaskErrorByID returns the Task error for a given id
|
||||
func (list *List) GetTaskErrorByID(ID int) (error, error) {
|
||||
task, err := list.GetTaskByID(ID)
|
||||
list.Lock()
|
||||
defer list.Unlock()
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
for _, task := range list.tasks {
|
||||
if task.ID == ID {
|
||||
return task.err, nil
|
||||
}
|
||||
}
|
||||
|
||||
return task.err, nil
|
||||
return nil, fmt.Errorf("could not find task with id %v", ID)
|
||||
}
|
||||
|
||||
+3
-2
@@ -42,6 +42,7 @@ const (
|
||||
)
|
||||
|
||||
// Task represents as task in a queue encapsulates process code
|
||||
// All fields are protected by List.Mutex - access task fields only while holding list.Lock()
|
||||
type Task struct {
|
||||
output *Output
|
||||
detail *Detail
|
||||
@@ -51,7 +52,7 @@ type Task struct {
|
||||
Name string
|
||||
ID int
|
||||
State State
|
||||
resources []string
|
||||
Resources []string
|
||||
wgTask *sync.WaitGroup
|
||||
}
|
||||
|
||||
@@ -64,7 +65,7 @@ func NewTask(process Process, name string, ID int, resources []string, wgTask *s
|
||||
Name: name,
|
||||
ID: ID,
|
||||
State: IDLE,
|
||||
resources: resources,
|
||||
Resources: resources,
|
||||
wgTask: wgTask,
|
||||
}
|
||||
return task
|
||||
|
||||
@@ -61,7 +61,9 @@ type ConfigStructure struct { // nolint: maligned
|
||||
|
||||
// Storage
|
||||
FileSystemPublishRoots map[string]FileSystemPublishRoot `json:"FileSystemPublishEndpoints" yaml:"filesystem_publish_endpoints"`
|
||||
JFrogPublishRoots map[string]JFrogPublishRoot `json:"JFrogPublishEndpoints" yaml:"jfrog_publish_endpoints"`
|
||||
S3PublishRoots map[string]S3PublishRoot `json:"S3PublishEndpoints" yaml:"s3_publish_endpoints"`
|
||||
GCSPublishRoots map[string]GCSPublishRoot `json:"GcsPublishEndpoints" yaml:"gcs_publish_endpoints"`
|
||||
SwiftPublishRoots map[string]SwiftPublishRoot `json:"SwiftPublishEndpoints" yaml:"swift_publish_endpoints"`
|
||||
AzurePublishRoots map[string]AzureEndpoint `json:"AzurePublishEndpoints" yaml:"azure_publish_endpoints"`
|
||||
PackagePoolStorage PackagePoolStorage `json:"packagePoolStorage" yaml:"packagepool_storage"`
|
||||
@@ -171,6 +173,19 @@ type FileSystemPublishRoot struct {
|
||||
}
|
||||
|
||||
// S3PublishRoot describes single S3 publishing entry point
|
||||
|
||||
type JFrogPublishRoot struct {
|
||||
Repository string `json:"repository" yaml:"repository"`
|
||||
URL string `json:"url" yaml:"url"`
|
||||
User string `json:"user" yaml:"user"`
|
||||
Password string `json:"password" yaml:"password"`
|
||||
APIKey string `json:"apiKey" yaml:"api_key"`
|
||||
AccessToken string `json:"accessToken" yaml:"access_token"`
|
||||
Prefix string `json:"prefix" yaml:"prefix"`
|
||||
PlusWorkaround bool `json:"plusWorkaround" yaml:"plus_workaround"`
|
||||
Debug bool `json:"debug" yaml:"debug"`
|
||||
}
|
||||
|
||||
type S3PublishRoot struct {
|
||||
Region string `json:"region" yaml:"region"`
|
||||
Bucket string `json:"bucket" yaml:"bucket"`
|
||||
@@ -189,6 +204,21 @@ type S3PublishRoot struct {
|
||||
Debug bool `json:"debug" yaml:"debug"`
|
||||
}
|
||||
|
||||
// GCSPublishRoot describes single GCS publishing entry point
|
||||
type GCSPublishRoot struct {
|
||||
Bucket string `json:"bucket" yaml:"bucket"`
|
||||
Prefix string `json:"prefix" yaml:"prefix"`
|
||||
CredentialsFile string `json:"credentialsFile" yaml:"credentials_file"`
|
||||
ServiceAccountJSON string `json:"serviceAccountJSON" yaml:"service_account_json"`
|
||||
Project string `json:"project" yaml:"project"`
|
||||
Endpoint string `json:"endpoint" yaml:"endpoint"`
|
||||
ACL string `json:"acl" yaml:"acl"`
|
||||
StorageClass string `json:"storageClass" yaml:"storage_class"`
|
||||
EncryptionKey string `json:"encryptionKey" yaml:"encryption_key"`
|
||||
DisableMultiDel bool `json:"disableMultiDel" yaml:"disable_multidel"`
|
||||
Debug bool `json:"debug" yaml:"debug"`
|
||||
}
|
||||
|
||||
// SwiftPublishRoot describes single OpenStack Swift publishing entry point
|
||||
type SwiftPublishRoot struct {
|
||||
Container string `json:"container" yaml:"container"`
|
||||
@@ -239,6 +269,7 @@ var Config = ConfigStructure{
|
||||
PpaBaseURL: "http://ppa.launchpad.net",
|
||||
FileSystemPublishRoots: map[string]FileSystemPublishRoot{},
|
||||
S3PublishRoots: map[string]S3PublishRoot{},
|
||||
GCSPublishRoots: map[string]GCSPublishRoot{},
|
||||
SwiftPublishRoots: map[string]SwiftPublishRoot{},
|
||||
AzurePublishRoots: map[string]AzureEndpoint{},
|
||||
AsyncAPI: false,
|
||||
|
||||
+233
-183
@@ -45,10 +45,17 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
|
||||
s.config.FileSystemPublishRoots = map[string]FileSystemPublishRoot{"test": {
|
||||
RootDir: "/opt/aptly-publish"}}
|
||||
|
||||
s.config.JFrogPublishRoots = map[string]JFrogPublishRoot{"test": {
|
||||
Repository: "repo",
|
||||
URL: "jfrog.example.com"}}
|
||||
|
||||
s.config.S3PublishRoots = map[string]S3PublishRoot{"test": {
|
||||
Region: "us-east-1",
|
||||
Bucket: "repo"}}
|
||||
|
||||
s.config.GCSPublishRoots = map[string]GCSPublishRoot{"test": {
|
||||
Bucket: "repo"}}
|
||||
|
||||
s.config.SwiftPublishRoots = map[string]SwiftPublishRoot{"test": {
|
||||
Container: "repo"}}
|
||||
|
||||
@@ -70,216 +77,245 @@ func (s *ConfigSuite) TestSaveConfig(c *C) {
|
||||
buf := make([]byte, st.Size())
|
||||
_, _ = f.Read(buf)
|
||||
|
||||
c.Check(string(buf), Equals, ""+
|
||||
"{\n" +
|
||||
" \"rootDir\": \"/tmp/aptly\",\n" +
|
||||
" \"logLevel\": \"info\",\n" +
|
||||
" \"logFormat\": \"json\",\n" +
|
||||
" \"databaseOpenAttempts\": 5,\n" +
|
||||
" \"architectures\": null,\n" +
|
||||
" \"skipLegacyPool\": false,\n" +
|
||||
" \"dependencyFollowSuggests\": false,\n" +
|
||||
" \"dependencyFollowRecommends\": false,\n" +
|
||||
" \"dependencyFollowAllVariants\": false,\n" +
|
||||
" \"dependencyFollowSource\": false,\n" +
|
||||
" \"dependencyVerboseResolve\": false,\n" +
|
||||
" \"ppaDistributorID\": \"\",\n" +
|
||||
" \"ppaCodename\": \"\",\n" +
|
||||
" \"ppaBaseURL\": \"\",\n" +
|
||||
" \"serveInAPIMode\": false,\n" +
|
||||
" \"enableMetricsEndpoint\": false,\n" +
|
||||
" \"enableSwaggerEndpoint\": false,\n" +
|
||||
" \"AsyncAPI\": false,\n" +
|
||||
" \"databaseBackend\": {\n" +
|
||||
" \"type\": \"\",\n" +
|
||||
" \"dbPath\": \"\",\n" +
|
||||
" \"url\": \"\"\n" +
|
||||
" },\n" +
|
||||
" \"downloader\": \"\",\n" +
|
||||
" \"downloadConcurrency\": 5,\n" +
|
||||
" \"downloadSpeedLimit\": 0,\n" +
|
||||
" \"downloadRetries\": 0,\n" +
|
||||
" \"downloadSourcePackages\": false,\n" +
|
||||
" \"gpgProvider\": \"gpg\",\n" +
|
||||
" \"gpgDisableSign\": false,\n" +
|
||||
" \"gpgDisableVerify\": false,\n" +
|
||||
" \"gpgKeys\": null,\n" +
|
||||
" \"skipContentsPublishing\": false,\n" +
|
||||
" \"skipBz2Publishing\": false,\n" +
|
||||
" \"FileSystemPublishEndpoints\": {\n" +
|
||||
" \"test\": {\n" +
|
||||
" \"rootDir\": \"/opt/aptly-publish\",\n" +
|
||||
" \"linkMethod\": \"\",\n" +
|
||||
" \"verifyMethod\": \"\"\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"S3PublishEndpoints\": {\n" +
|
||||
" \"test\": {\n" +
|
||||
" \"region\": \"us-east-1\",\n" +
|
||||
" \"bucket\": \"repo\",\n" +
|
||||
" \"prefix\": \"\",\n" +
|
||||
" \"acl\": \"\",\n" +
|
||||
" \"awsAccessKeyID\": \"\",\n" +
|
||||
" \"awsSecretAccessKey\": \"\",\n" +
|
||||
" \"awsSessionToken\": \"\",\n" +
|
||||
" \"endpoint\": \"\",\n" +
|
||||
" \"storageClass\": \"\",\n" +
|
||||
" \"encryptionMethod\": \"\",\n" +
|
||||
" \"plusWorkaround\": false,\n" +
|
||||
" \"disableMultiDel\": false,\n" +
|
||||
" \"forceSigV2\": false,\n" +
|
||||
" \"forceVirtualHostedStyle\": false,\n" +
|
||||
" \"debug\": false\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"SwiftPublishEndpoints\": {\n" +
|
||||
" \"test\": {\n" +
|
||||
" \"container\": \"repo\",\n" +
|
||||
" \"prefix\": \"\",\n" +
|
||||
" \"osname\": \"\",\n" +
|
||||
" \"password\": \"\",\n" +
|
||||
" \"tenant\": \"\",\n" +
|
||||
" \"tenantid\": \"\",\n" +
|
||||
" \"domain\": \"\",\n" +
|
||||
" \"domainid\": \"\",\n" +
|
||||
" \"tenantdomain\": \"\",\n" +
|
||||
" \"tenantdomainid\": \"\",\n" +
|
||||
" \"authurl\": \"\"\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"AzurePublishEndpoints\": {\n" +
|
||||
" \"test\": {\n" +
|
||||
" \"container\": \"repo\",\n" +
|
||||
" \"prefix\": \"\",\n" +
|
||||
" \"accountName\": \"\",\n" +
|
||||
" \"accountKey\": \"\",\n" +
|
||||
" \"endpoint\": \"\"\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"packagePoolStorage\": {\n" +
|
||||
" \"type\": \"local\",\n" +
|
||||
" \"path\": \"/tmp/aptly-pool\"\n" +
|
||||
" }\n" +
|
||||
"}")
|
||||
c.Check(string(buf), Equals, `{
|
||||
"rootDir": "/tmp/aptly",
|
||||
"logLevel": "info",
|
||||
"logFormat": "json",
|
||||
"databaseOpenAttempts": 5,
|
||||
"architectures": null,
|
||||
"skipLegacyPool": false,
|
||||
"dependencyFollowSuggests": false,
|
||||
"dependencyFollowRecommends": false,
|
||||
"dependencyFollowAllVariants": false,
|
||||
"dependencyFollowSource": false,
|
||||
"dependencyVerboseResolve": false,
|
||||
"ppaDistributorID": "",
|
||||
"ppaCodename": "",
|
||||
"ppaBaseURL": "",
|
||||
"serveInAPIMode": false,
|
||||
"enableMetricsEndpoint": false,
|
||||
"enableSwaggerEndpoint": false,
|
||||
"AsyncAPI": false,
|
||||
"databaseBackend": {
|
||||
"type": "",
|
||||
"dbPath": "",
|
||||
"url": ""
|
||||
},
|
||||
"downloader": "",
|
||||
"downloadConcurrency": 5,
|
||||
"downloadSpeedLimit": 0,
|
||||
"downloadRetries": 0,
|
||||
"downloadSourcePackages": false,
|
||||
"gpgProvider": "gpg",
|
||||
"gpgDisableSign": false,
|
||||
"gpgDisableVerify": false,
|
||||
"gpgKeys": null,
|
||||
"skipContentsPublishing": false,
|
||||
"skipBz2Publishing": false,
|
||||
"FileSystemPublishEndpoints": {
|
||||
"test": {
|
||||
"rootDir": "/opt/aptly-publish",
|
||||
"linkMethod": "",
|
||||
"verifyMethod": ""
|
||||
}
|
||||
},
|
||||
"JFrogPublishEndpoints": {
|
||||
"test": {
|
||||
"repository": "repo",
|
||||
"url": "jfrog.example.com",
|
||||
"user": "",
|
||||
"password": "",
|
||||
"apiKey": "",
|
||||
"accessToken": "",
|
||||
"prefix": "",
|
||||
"plusWorkaround": false,
|
||||
"debug": false
|
||||
}
|
||||
},
|
||||
"S3PublishEndpoints": {
|
||||
"test": {
|
||||
"region": "us-east-1",
|
||||
"bucket": "repo",
|
||||
"prefix": "",
|
||||
"acl": "",
|
||||
"awsAccessKeyID": "",
|
||||
"awsSecretAccessKey": "",
|
||||
"awsSessionToken": "",
|
||||
"endpoint": "",
|
||||
"storageClass": "",
|
||||
"encryptionMethod": "",
|
||||
"plusWorkaround": false,
|
||||
"disableMultiDel": false,
|
||||
"forceSigV2": false,
|
||||
"forceVirtualHostedStyle": false,
|
||||
"debug": false
|
||||
}
|
||||
},
|
||||
"GcsPublishEndpoints": {
|
||||
"test": {
|
||||
"bucket": "repo",
|
||||
"prefix": "",
|
||||
"credentialsFile": "",
|
||||
"serviceAccountJSON": "",
|
||||
"project": "",
|
||||
"endpoint": "",
|
||||
"acl": "",
|
||||
"storageClass": "",
|
||||
"encryptionKey": "",
|
||||
"disableMultiDel": false,
|
||||
"debug": false
|
||||
}
|
||||
},
|
||||
"SwiftPublishEndpoints": {
|
||||
"test": {
|
||||
"container": "repo",
|
||||
"prefix": "",
|
||||
"osname": "",
|
||||
"password": "",
|
||||
"tenant": "",
|
||||
"tenantid": "",
|
||||
"domain": "",
|
||||
"domainid": "",
|
||||
"tenantdomain": "",
|
||||
"tenantdomainid": "",
|
||||
"authurl": ""
|
||||
}
|
||||
},
|
||||
"AzurePublishEndpoints": {
|
||||
"test": {
|
||||
"container": "repo",
|
||||
"prefix": "",
|
||||
"accountName": "",
|
||||
"accountKey": "",
|
||||
"endpoint": ""
|
||||
}
|
||||
},
|
||||
"packagePoolStorage": {
|
||||
"type": "local",
|
||||
"path": "/tmp/aptly-pool"
|
||||
}
|
||||
}`)
|
||||
}
|
||||
|
||||
func (s *ConfigSuite) TestLoadYAMLConfig(c *C) {
|
||||
configname := filepath.Join(c.MkDir(), "aptly.yaml1")
|
||||
f, _ := os.Create(configname)
|
||||
_, _ = f.WriteString(configFileYAML)
|
||||
_ = f.Close()
|
||||
configname := filepath.Join(c.MkDir(), "aptly.yaml1")
|
||||
f, _ := os.Create(configname)
|
||||
_, _ = f.WriteString(configFileYAML)
|
||||
_ = f.Close()
|
||||
|
||||
// start with empty config
|
||||
s.config = ConfigStructure{}
|
||||
// start with empty config
|
||||
s.config = ConfigStructure{}
|
||||
|
||||
err := LoadConfig(configname, &s.config)
|
||||
c.Assert(err, IsNil)
|
||||
c.Check(s.config.GetRootDir(), Equals, "/opt/aptly/")
|
||||
c.Check(s.config.DownloadConcurrency, Equals, 40)
|
||||
c.Check(s.config.DatabaseOpenAttempts, Equals, 10)
|
||||
err := LoadConfig(configname, &s.config)
|
||||
c.Assert(err, IsNil)
|
||||
c.Check(s.config.GetRootDir(), Equals, "/opt/aptly/")
|
||||
c.Check(s.config.DownloadConcurrency, Equals, 40)
|
||||
c.Check(s.config.DatabaseOpenAttempts, Equals, 10)
|
||||
}
|
||||
|
||||
func (s *ConfigSuite) TestLoadYAMLErrorConfig(c *C) {
|
||||
configname := filepath.Join(c.MkDir(), "aptly.yaml2")
|
||||
f, _ := os.Create(configname)
|
||||
_, _ = f.WriteString(configFileYAMLError)
|
||||
_ = f.Close()
|
||||
configname := filepath.Join(c.MkDir(), "aptly.yaml2")
|
||||
f, _ := os.Create(configname)
|
||||
_, _ = f.WriteString(configFileYAMLError)
|
||||
_ = f.Close()
|
||||
|
||||
// start with empty config
|
||||
s.config = ConfigStructure{}
|
||||
// start with empty config
|
||||
s.config = ConfigStructure{}
|
||||
|
||||
err := LoadConfig(configname, &s.config)
|
||||
c.Assert(err.Error(), Equals, "invalid yaml (unknown pool storage type: invalid) or json (invalid character 'p' looking for beginning of value)")
|
||||
err := LoadConfig(configname, &s.config)
|
||||
c.Assert(err.Error(), Equals, "invalid yaml (unknown pool storage type: invalid) or json (invalid character 'p' looking for beginning of value)")
|
||||
}
|
||||
|
||||
func (s *ConfigSuite) TestSaveYAMLConfig(c *C) {
|
||||
configname := filepath.Join(c.MkDir(), "aptly.yaml3")
|
||||
f, _ := os.Create(configname)
|
||||
_, _ = f.WriteString(configFileYAML)
|
||||
_ = f.Close()
|
||||
configname := filepath.Join(c.MkDir(), "aptly.yaml3")
|
||||
f, _ := os.Create(configname)
|
||||
_, _ = f.WriteString(configFileYAML)
|
||||
_ = f.Close()
|
||||
|
||||
// start with empty config
|
||||
s.config = ConfigStructure{}
|
||||
// start with empty config
|
||||
s.config = ConfigStructure{}
|
||||
|
||||
err := LoadConfig(configname, &s.config)
|
||||
c.Assert(err, IsNil)
|
||||
err := LoadConfig(configname, &s.config)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
err = SaveConfigYAML(configname, &s.config)
|
||||
c.Assert(err, IsNil)
|
||||
err = SaveConfigYAML(configname, &s.config)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
f, _ = os.Open(configname)
|
||||
defer func() {
|
||||
_ = f.Close()
|
||||
}()
|
||||
f, _ = os.Open(configname)
|
||||
defer func() {
|
||||
_ = f.Close()
|
||||
}()
|
||||
|
||||
st, _ := f.Stat()
|
||||
buf := make([]byte, st.Size())
|
||||
_, _ = f.Read(buf)
|
||||
st, _ := f.Stat()
|
||||
buf := make([]byte, st.Size())
|
||||
_, _ = f.Read(buf)
|
||||
|
||||
c.Check(string(buf), Equals, configFileYAML)
|
||||
c.Check(string(buf), Equals, configFileYAML)
|
||||
}
|
||||
|
||||
func (s *ConfigSuite) TestSaveYAML2Config(c *C) {
|
||||
// start with empty config
|
||||
s.config = ConfigStructure{}
|
||||
// start with empty config
|
||||
s.config = ConfigStructure{}
|
||||
|
||||
s.config.PackagePoolStorage.Local = &LocalPoolStorage{"/tmp/aptly-pool"}
|
||||
s.config.PackagePoolStorage.Azure = nil
|
||||
s.config.PackagePoolStorage.Local = &LocalPoolStorage{"/tmp/aptly-pool"}
|
||||
s.config.PackagePoolStorage.Azure = nil
|
||||
|
||||
configname := filepath.Join(c.MkDir(), "aptly.yaml4")
|
||||
err := SaveConfigYAML(configname, &s.config)
|
||||
c.Assert(err, IsNil)
|
||||
configname := filepath.Join(c.MkDir(), "aptly.yaml4")
|
||||
err := SaveConfigYAML(configname, &s.config)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
f, _ := os.Open(configname)
|
||||
defer func() {
|
||||
_ = f.Close()
|
||||
}()
|
||||
f, _ := os.Open(configname)
|
||||
defer func() {
|
||||
_ = f.Close()
|
||||
}()
|
||||
|
||||
st, _ := f.Stat()
|
||||
buf := make([]byte, st.Size())
|
||||
_, _ = f.Read(buf)
|
||||
st, _ := f.Stat()
|
||||
buf := make([]byte, st.Size())
|
||||
_, _ = f.Read(buf)
|
||||
|
||||
c.Check(string(buf), Equals, "" +
|
||||
"root_dir: \"\"\n" +
|
||||
"log_level: \"\"\n" +
|
||||
"log_format: \"\"\n" +
|
||||
"database_open_attempts: 0\n" +
|
||||
"architectures: []\n" +
|
||||
"skip_legacy_pool: false\n" +
|
||||
"dep_follow_suggests: false\n" +
|
||||
"dep_follow_recommends: false\n" +
|
||||
"dep_follow_all_variants: false\n" +
|
||||
"dep_follow_source: false\n" +
|
||||
"dep_verboseresolve: false\n" +
|
||||
"ppa_distributor_id: \"\"\n" +
|
||||
"ppa_codename: \"\"\n" +
|
||||
"ppa_baseurl: \"\"\n" +
|
||||
"serve_in_api_mode: false\n" +
|
||||
"enable_metrics_endpoint: false\n" +
|
||||
"enable_swagger_endpoint: false\n" +
|
||||
"async_api: false\n" +
|
||||
"database_backend:\n" +
|
||||
" type: \"\"\n" +
|
||||
" db_path: \"\"\n" +
|
||||
" url: \"\"\n" +
|
||||
"downloader: \"\"\n" +
|
||||
"download_concurrency: 0\n" +
|
||||
"download_limit: 0\n" +
|
||||
"download_retries: 0\n" +
|
||||
"download_sourcepackages: false\n" +
|
||||
"gpg_provider: \"\"\n" +
|
||||
"gpg_disable_sign: false\n" +
|
||||
"gpg_disable_verify: false\n" +
|
||||
"gpg_keys: []\n" +
|
||||
"skip_contents_publishing: false\n" +
|
||||
"skip_bz2_publishing: false\n" +
|
||||
"filesystem_publish_endpoints: {}\n" +
|
||||
"s3_publish_endpoints: {}\n" +
|
||||
"swift_publish_endpoints: {}\n" +
|
||||
"azure_publish_endpoints: {}\n" +
|
||||
"packagepool_storage:\n" +
|
||||
" type: local\n" +
|
||||
" path: /tmp/aptly-pool\n")
|
||||
c.Check(string(buf), Equals, ""+
|
||||
"root_dir: \"\"\n"+
|
||||
"log_level: \"\"\n"+
|
||||
"log_format: \"\"\n"+
|
||||
"database_open_attempts: 0\n"+
|
||||
"architectures: []\n"+
|
||||
"skip_legacy_pool: false\n"+
|
||||
"dep_follow_suggests: false\n"+
|
||||
"dep_follow_recommends: false\n"+
|
||||
"dep_follow_all_variants: false\n"+
|
||||
"dep_follow_source: false\n"+
|
||||
"dep_verboseresolve: false\n"+
|
||||
"ppa_distributor_id: \"\"\n"+
|
||||
"ppa_codename: \"\"\n"+
|
||||
"ppa_baseurl: \"\"\n"+
|
||||
"serve_in_api_mode: false\n"+
|
||||
"enable_metrics_endpoint: false\n"+
|
||||
"enable_swagger_endpoint: false\n"+
|
||||
"async_api: false\n"+
|
||||
"database_backend:\n"+
|
||||
" type: \"\"\n"+
|
||||
" db_path: \"\"\n"+
|
||||
" url: \"\"\n"+
|
||||
"downloader: \"\"\n"+
|
||||
"download_concurrency: 0\n"+
|
||||
"download_limit: 0\n"+
|
||||
"download_retries: 0\n"+
|
||||
"download_sourcepackages: false\n"+
|
||||
"gpg_provider: \"\"\n"+
|
||||
"gpg_disable_sign: false\n"+
|
||||
"gpg_disable_verify: false\n"+
|
||||
"gpg_keys: []\n"+
|
||||
"skip_contents_publishing: false\n"+
|
||||
"skip_bz2_publishing: false\n"+
|
||||
"filesystem_publish_endpoints: {}\n"+
|
||||
"jfrog_publish_endpoints: {}\n"+
|
||||
"s3_publish_endpoints: {}\n"+
|
||||
"gcs_publish_endpoints: {}\n"+
|
||||
"swift_publish_endpoints: {}\n"+
|
||||
"azure_publish_endpoints: {}\n"+
|
||||
"packagepool_storage:\n"+
|
||||
" type: local\n"+
|
||||
" path: /tmp/aptly-pool\n")
|
||||
}
|
||||
|
||||
func (s *ConfigSuite) TestLoadEmptyConfig(c *C) {
|
||||
@@ -335,6 +371,7 @@ filesystem_publish_endpoints:
|
||||
root_dir: /opt/srv/aptly_public
|
||||
link_method: hardlink
|
||||
verify_method: md5
|
||||
jfrog_publish_endpoints: {}
|
||||
s3_publish_endpoints:
|
||||
test:
|
||||
region: us-east-1
|
||||
@@ -352,6 +389,19 @@ s3_publish_endpoints:
|
||||
force_sigv2: true
|
||||
force_virtualhosted_style: true
|
||||
debug: true
|
||||
gcs_publish_endpoints:
|
||||
test:
|
||||
bucket: gcs-bucket
|
||||
prefix: pre-gcs
|
||||
credentials_file: /tmp/creds.json
|
||||
service_account_json: '{"type":"service_account"}'
|
||||
project: test-project
|
||||
endpoint: ""
|
||||
acl: public-read
|
||||
storage_class: STANDARD
|
||||
encryption_key: "12345678901234567890123456789012"
|
||||
disable_multidel: true
|
||||
debug: true
|
||||
swift_publish_endpoints:
|
||||
test:
|
||||
container: c1
|
||||
|
||||
Reference in New Issue
Block a user