Commit Graph

6 Commits

Author SHA1 Message Date
south-mer
11d674c8fb feat: GCP checksum (#2052) 2025-08-06 08:24:54 +02: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
Nicholas Wiersma
ab64133949 feat: replace ioutil with io and os (#1816) 2023-01-27 20:42:47 +05:30
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
Marwan Sulaiman
081ec9126e pkg/stash: Add GCS implementation (#1124)
* pkg/stash: Add GCS implementation

* fix docs
2019-03-13 11:07:07 -07:00