195 Commits

Author SHA1 Message Date
south-mer
11d674c8fb feat: GCP checksum (#2052) 2025-08-06 08:24:54 +02:00
south-mer
33f32fd3af Fix GCP Storage Backend Locking Issue (#2051) 2025-06-25 05:04:34 +02:00
Nicholas Wiersma
1d91fa5d9b chore: bump golangci-lint to v2 (#2042) 2025-04-01 09:08:02 +02:00
Connor McCarthy
ebb5ac698b feat: add pagination to s3 lister (#2037)
By default `ListObjectsV2()` returns the first 1000 objects matching the
list parameters. Normally this is fine, as it supports up to 333
versions (1000 / 3 files in proxy-triplet). For modules with more
versions, this is insufficient and must be upgraded to paginate.
2025-04-01 07:01:35 +02:00
yatesliang
8f0ee5e52f Swith s3 ListObjects api to ListObjectsV2 (#2006)
Switch the ListObjects API used in s3 storage to ListObjectsV2
2024-11-26 03:08:21 +00:00
Matt
0092d3a118 Upgrade to Go 1.22 toolchain (#1987)
Upgrades to the Go 1.22 toolchain. Upgrades golangci-lint to 1.61.0 and disables some new linters.

---------

Co-authored-by: Nicholas Wiersma <nick@wiersma.co.za>
2024-09-28 05:51:14 +00:00
yueluhuan
34002b8408 Switch from ADAL to AzIdentity, Add Azure Storage Token Refresh, and Update Golang Version (#1977)
Uses the new Azure Identity package for current support. Support automated Azure storage token refresh. Sets the default value of Athens storage account key and Azure managed identity resource id should be empty.
2024-09-09 03:03:26 +00:00
yueluhuan
1e39c23d72 Add aad auth option when using azure storage account (#1973)
Support managed identity authentication in Azure Blob Storage.
2024-07-14 18:21:31 -07:00
Derek Buitenhuis
0ef761cc8b gcp/saver: Only return errors.KindAlreadyExists if all three exist (#1957)
* gcp/saver: Only return errors.KindAlreadyExists if all three exist

In #1124, a GCP lock type was added as a singleflight backend. As part of this work, the GCP backend's Save() was made serial, likely because moduploader.Upload requires a call to Exists() before it, rendering the GCP lock less useful, by doubling the calls to GCS.

However, by doing this, the existence check was now only checking the existence of the mod file, and not the info or zip. This meant that if during a Save, the zip or info uploads failed, on subsequent rquests, that when using the GCP singleflight backend, Athens would assume everything had been stashed and saved properly, and then fail to serve up the info or zip that had failed upload, meaning the cache was in an unhealable broklen state, requiring a manual intervention.

To fix this, without breaking the singleflight behavior, introduce a metadata key that is set on the mod file during its initial upload, indicating that a Stash is still in progress on subsequent files, which gets removed once all three files are uploaded successfully, which can be checked if it it is determined that the mod file already exists. That way we can return a errors.KindAlreadyExists if a Stash is in progress, but also properly return it when a Stash is *not* currently in progress if and only if all three files exist on GCS, which prevents the cache from becoming permanently poisoned.

One note is that it is possible the GCS call to remove the metadata key fails, which would mean it is left on the mod object forever. To avoid this, consider it stale after 2 minutes.

---------

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Co-authored-by: Matt <matt.ouille@protonmail.com>
2024-06-02 19:32:54 +00:00
Yong Zhang
0e1af85c0b Fix AWS default credentials (#1963)
Fix a bug where default credentials were erroneously cleared out, which broke several implementations.
2024-05-22 19:15:48 -07:00
Vanes Angelo
900cb4f7c1 Upgrade to AWS SDK v2 (#1938) (#1950)
Upgrades the AWS SDK to v2. AWS S3 bucket urls will now error if they are not prefixed with a schema (example: https://).
2024-04-28 21:38:42 -07:00
tanx
c072f6089a Update mongodb driver (#1928)
Updates the MongoDB driver
2024-03-25 15:39:14 -07:00
yatesliang
aca3cc0090 test: unit test for testing KindUnexpected case in Mongo query function (#1883) 2023-09-25 00:24:02 -07:00
Zhongpeng Lin
b72a768a05 use errors.AsErr (#1849)
Co-authored-by: Manu Gupta <manugupt1@gmail.com>
2023-03-12 22:04:12 -07:00
Zhongpeng Lin
5099b30ac6 Removing Exists() check from S3 getters (#1842)
* Atomic access to S3

* fixing linting errors

* make delete return KindNotFound

* restore checker and deleter
2023-03-03 19:46:09 -08:00
Zhongpeng Lin
1f0a460687 Calling HeadObjectWithContext() concurrently to check the existence of a module (#1844)
* Using HeadObject to check the existence of a module

* fixing build

* calling cancel before closing channel

* fixing test

* using waitgroup

* calling cancel

* calling wg.Done

* only return the first error

* Revert "only return the first error"

This reverts commit c0aa18b522.

* clean err if not exist
2023-03-03 14:56:12 -05:00
Nicholas Wiersma
748aa4d165 chore: remove last drone remains (#1839)
* chore: remove drone

* fix: cr suggestions

* fix: cr suggestions
2023-02-28 18:51:12 +08:00
Nicholas Wiersma
d932d50232 chore: lint code with golangci-lint (#1828)
* feat: add golangci-lint linting

* chore: fix linter issues

* feat: add linting into the workflow

* docs: update lint docs

* fix: cr suggestions

* fix: remove old formatting and vetting scripts

* fix: add docker make target

* fix: action go caching

* fix: depreciated actions checkout version

* fix: cr suggestion

* fix: cr suggestions

---------

Co-authored-by: Manu Gupta <manugupt1@gmail.com>
2023-02-24 20:39:17 -08:00
Ashish Ranjan
3f26845cff move to github actions from drone (#1823)
* add github actions workflow for tag releases

* migrate drone build &test step to github actions

* fix minio service

* fix indentation

* fix dependency syntax

* remove needs keyword

* fix service hostnames, add protectedredis

* update protected redis docker image

* fix too many args error

* exclude vendor dir from gofmt

* fix fmt errors

* fix fmt errors

* rm .drone.yml

* rename workflow name

* break test step

* remove vendor step

* use makefile rule

* use buildx
2023-02-22 22:47:37 -08:00
Zhongpeng Lin
6aaf9e5b17 Handle duplicate keys returned by S3 ListObject (#1793)
S3 API sometimes returns duplicate keys, causing the number of file for a specific module greater than 3. This PR makes Athens handle that situation gracefully and log a warning message instead of treating the module as not found.

logging string content

Co-authored-by: Manu Gupta <manugupt1@gmail.com>
Co-authored-by: Ashish Ranjan <ashishranjan2912@gmail.com>
2023-01-30 13:01:09 +08:00
Nicholas Wiersma
ab64133949 feat: replace ioutil with io and os (#1816) 2023-01-27 20:42:47 +05:30
Zhongpeng Lin
4c3443328e Adding new fields to RevInfo (#1812)
* Allow unknown fields in RevInfo

* Revert "Allow unknown fields in RevInfo"

This reverts commit 902d791554.

* Adding new fields to rev_info.go

* fixed tests
2023-01-16 12:11:10 -08:00
Jerry Ng
92150d0500 Update s3 checker to iterate through all objects pages (#1802) 2023-01-08 13:46:20 -08:00
Ashish Ranjan
7d67ee76ce fix default s3 credentials set as anonymous (#1789) 2022-09-15 18:30:54 -07:00
Rob Prentiss
3fab46905e Resolve memory leaks when using Minio storage (#1777)
When using Minio storage, memory usage constantly increases. After
profiling, it appears that memory usage is building in the minio client,
and not being released.

Finding a similar issue listed in the minio/warp project, I found that
they fixed the issue by closing the *minio.Object instances. In the
athens usage, the minio.Object instances are never closed after reading
the data from them.

This adds deferred 'Close' calls in the 'storageImpl.Info' and
'storageImpl.GoMod' functions so that the objects may be released and
garbage collected. The 'storageImpl.Zip' function does not use defer,
since it has the object embedded into the return value, so the 'Close'
is only called on error.
2022-06-06 19:04:33 -04:00
Aaron Schlesinger
2a8b8eed75 Fixing panic with S3 storage (#1730)
Signed-off-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>
2021-10-01 13:11:33 -07:00
Marwan Sulaiman
a724fcdddc Update mongo client to address CVE (#1728) 2021-08-18 22:49:44 -04:00
Zhongpeng Lin
4abe908a58 Using directory as prefix for S3 (#1720)
* Using directory as prefix for S3

* address comments

Co-authored-by: Marwan Sulaiman <marwan.sameer@gmail.com>
2021-08-18 21:06:51 -04:00
Marwan Sulaiman
151c4922fb Enable Athens to work in offline mode (#1717)
Co-authored-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>
2021-08-18 19:09:14 -04:00
Marwan Sulaiman
6ef4a793c3 Add Content-Length to .zip requests (#1681)
* Add Content-Length to .zip requests

* pr comments

Co-authored-by: Aaron Schlesinger <70865+arschles@users.noreply.github.com>
2020-11-24 10:00:47 -05:00
Abhisek Banerjee
46b68e4da8 Support IRSA for S3 bucket (#1673) 2020-11-20 11:24:54 -08:00
Marwan Sulaiman
90af973c3d pkg/storage/external: remove debug lines (#1606) 2020-04-20 09:38:47 -04:00
Marwan Sulaiman
3c4db4ce86 pkg/storage: add External implementation (#1587)
* pkg/storage: add External implementation

* fix conflicts

* use newly instantiated client
2020-03-27 13:35:52 -04:00
Marwan Sulaiman
0bb95c7351 pkg/storage: make Checker optional in storage.Backend (#1580)
* pkg/storage: make Checker optional in storage.Backend

* pass storage
2020-03-18 19:07:00 -04:00
vapod
4530a58359 Add forcepathstyle config for s3 (#1533)
* Add forcepathstyle config for s3

* Bump chart version

* Fix typos in s3 config struct
2020-02-10 16:03:25 -08:00
Aleksandr Razumov
5b194688a0 storage/s3: add custom endpoint url support (#1467) 2019-12-05 13:04:03 -08:00
Aaron Schlesinger
707b7b5413 Fixing the build failures from a missing GCS Key (#1480)
* Fixing the build failures from a missing GCS Key

Accidentally introduced in https://github.com/gomods/athens/pull/1428

* Adding a TODO to the drone build

* adding a step to test the Athens server startup

* Adding the JSONKey back to the default config

* use temporary image

* Switching back to the old env var for the GCS JSON Key

cc/ @marwan-at-work

* removing the ServiceAccount. we want to stick with JSONKey

* reverting to original key fetching code

* fixing build err

* bumping chart ver
2019-12-05 10:49:56 -08:00
Aditya Sharma
e0ec46b221 Add GCS to helm chart (#1428)
* Add GCS to helm chart

* base64 encode serviceAccount in the chart

* Standardize GCP Service Account references

* pipe storage.gcp.serviceAccount to quote
2019-12-03 18:28:07 -08:00
Jens Hausherr
f578472490 Unescape key before attempting to split module and version (#1457)
* Unescape key before attempting to split module and version

* PathUnescape key in minio/lister

* use unescaped path for module

* Compare againse escaped key

* Exctract common key parsing from cataloger and lister
2019-11-25 16:27:25 -08:00
Chris Mills
82ecff968f Correct issue with continuation token failures on deploy (#1415)
* Add working image for minio

Between RELEASE.2019-09-26T19-42-35Z and RELEASE.2019-10-02T21-19-38Z
there's an issue with continuation tokens that's caused #1414 and #1413
to fail.

Signed-off-by: Chris M <me@christophermills.co.uk>

* Undo docker changes, update minio to v6

* Narrow issue down to catalog compliance test

Signed-off-by: Chris M <me@christophermills.co.uk>
2019-10-08 16:54:20 -04:00
Kenshi Kamata
800024fc6f Fix ignoring error (#1356)
* fix ignoring error

* fix operator

* fix minio error handling

* fix get url to return error if failed parsing

* add error handling

* position of statement to get redirect url was wrong.
2019-09-16 16:15:51 -05:00
Kenshi Kamata
667b9fdf65 Fix typo (#1358)
* fix duplicated 'the'

* fix typo found by misspell
2019-08-27 10:55:09 -07:00
Manu Gupta
16739a1213 Add relative URI for AWS fargate. (#1337)
* f

* r

* f

* gofmt

* ep

* Container url

* Asd

* nit

* Update docs

* keep old stuff

* old is gold

* indent

* asd
2019-08-21 14:21:01 +01:00
Bob Maertz
049d58caa8 Write tests for the new Mongo query function (#1314)
* WIP: Added tests to query implemetation.

* Fixed tests for mongo getter query function.
2019-08-15 14:04:19 -07:00
Bob Maertz
994810324e Fix Mongo initialization to use environment variables for db/coll names (#1331)
* Updated mongo init to use db name env variable.

* Updated mongo init to use coll name env var.

* Fixed merge conflict.

* Updated formatting in mongo_test.
2019-08-14 21:41:21 -07:00
Bob Maertz
3a3d474e1b Add check for mongo configuration errors. (#1329) 2019-08-12 23:54:23 -07:00
Soumya GB
603e2f3dc7 Adds cataloger for Azure blob storage (#1313)
* Adds cataloger for Azure Blob storage

* Revert "Adds cataloger for Azure Blob storage"

This reverts commit 9476c9e256.

* Implements Cataloger interface for Azure blob storage. Fixes #995.

* Upgraded azblob version to v0.7.0

* Upgrades azblob version to v0.7.0

* Fix formatting

* Fix formatting issues

* Use keyed field for comp literal

* reorder import pkgs
2019-08-12 23:49:29 -07:00
Manu Gupta
be908fe713 Fixes endpoint creds (#1325)
* f

* r
2019-08-06 10:45:14 -04:00
Yi Tang
b6bcf0e191 storage/fs,minio: fix list module with same prefix (#1312) 2019-08-01 13:16:52 -04:00
Manu Gupta
5bff5fe74d endpoint creds (#1291)
* endpoint creds

* gofmt

* Add credential chain

* error handling

* Fix things

* add docs

* f

* asd

* fix
2019-07-22 22:47:36 +02:00