Commit Graph

260 Commits

Author SHA1 Message Date
ashmrtn
30079e4077 feat(repository): role assumption for S3 storage (#4182)
* Use an AssumeRole credential provider if a role was specified
* Use minio's assumerole call
* Update assume role test

---------

Co-authored-by: Vaibhav Kamra <vkamra@alcion.ai>
2025-04-30 22:49:33 -07:00
Julio Lopez
c27c5e8c05 refactor(provider): change StartupTimeout type to Duration (#4528)
This allows persisting and reading back the timeout as a duration.

There are be no backwards compatibility issues, since the field is
not currently set, so it is not persisted in the configuration file.
2025-04-30 15:59:43 -07:00
Julio Lopez
2d9b7f1e33 feat(providers): Azure Blob client certificate authentication (#4535)
Allow the use of a client certificate when authenticating
to an Azure Blob storage provider.

Tests included.

Credit: @DeepikaDixit

Authored-by: Deepika Dixit <DeepikaDixit@users.noreply.github.com>
2025-04-29 23:47:41 -07:00
Julio Lopez
8098f49c90 chore(ci): remove exclusion for unused ctx parameters (#4530)
Remove unused-parameter exclusion for `ctx` in revive linter.

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Co-authored-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-04-26 23:11:36 -07:00
Matthieu MOREL
8a176255c0 fix(general): enable wsl for all go files (#4524)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-04-26 13:01:20 -07:00
Matthieu MOREL
b0827d128a fix(ci): remove gocritic unnecessaryDefer exclusion (#4525)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-04-25 14:47:08 -07:00
Matthieu MOREL
675e958877 chore(ci): bump golangci-lint to v2.1.2 (#4500)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-04-15 22:49:13 -07:00
dependabot[bot]
5ec112eb38 build(deps): bump github.com/minio/minio-go/v7 from 7.0.82 to 7.0.83 in the common-golang-dependencies group (#4337)
* build(deps): bump github.com/minio/minio-go/v7

Bumps the common-golang-dependencies group with 1 update: [github.com/minio/minio-go/v7](https://github.com/minio/minio-go).


Updates `github.com/minio/minio-go/v7` from 7.0.82 to 7.0.83
- [Release notes](https://github.com/minio/minio-go/releases)
- [Commits](https://github.com/minio/minio-go/compare/v7.0.82...v7.0.83)

---
updated-dependencies:
- dependency-name: github.com/minio/minio-go/v7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: common-golang-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>

* fixed the build

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jarek Kowalski <jaak@jkowalski.net>
2025-01-11 13:49:17 -08:00
Jarek Kowalski
eb1cf64c27 chore(ci): upgraded linter to 1.62.0 (#4250) 2024-11-16 07:16:50 -08:00
Jarek Kowalski
91d00e8256 feat(providers): upgraded rclone to 1.68.2, fixed Google Drive rclone compatibility (#4249)
* chore(ci): upgrade rclone to 1.68.2

* fix(providers): fixed Google Drive rclone compatibility
2024-11-15 20:02:08 -08:00
Julio López
a3c570d264 refactor(providers): simplify GCS client construction (#4120)
Changes:
* simplify GCS client creation;
* early parameter validation in `gcs.New()`;
* remove GCS internal tests;
* remove no-longer used GCS creds helpers.
2024-10-27 18:39:45 -07:00
Prasad Ghangal
3bf947d746 feat(repository): Metadata compression config support for directory and indirect content (#4080)
* Configure compressor for k and x prefixed content

Adds metadata compression setting to policy
Add support to configure compressor for k and x prefixed content
Set zstd-fastest as the default compressor for metadata in the policy
Adds support to set and show metadata compression to kopia policy commands
Adds metadata compression config to dir writer

Signed-off-by: Prasad Ghangal <prasad.ganghal@veeam.com>

* Pass concatenate options with ConcatenateOptions struct

Signed-off-by: Prasad Ghangal <prasad.ganghal@veeam.com>

* Move content compression handling to caller

Signed-off-by: Prasad Ghangal <prasad.ganghal@veeam.com>

* Move handling manifests to manifest pkg

Signed-off-by: Prasad Ghangal <prasad.ganghal@veeam.com>

* Correct const in server_test

Signed-off-by: Prasad Ghangal <prasad.ganghal@veeam.com>

* Remove unnecessary whitespace

Signed-off-by: Prasad Ghangal <prasad.ganghal@veeam.com>

* Disable metadata compression for < V2 format

Signed-off-by: Prasad Ghangal <prasad.ganghal@veeam.com>

---------

Signed-off-by: Prasad Ghangal <prasad.ganghal@veeam.com>
2024-10-23 23:28:23 -07:00
Mike McKay-Dirden
e20ec3d290 fix(repository): Allow extending blob retentions (#4151) 2024-10-23 18:46:51 -07:00
Julio López
961a39039b refactor(general): use errors.New where appropriate (#4160)
Replaces 'errors.Errorf\("([^"]+)"\)' => 'errors.New("\1")'
2024-10-05 19:05:00 -07:00
Julio López
8ce8245f32 test(providers): cleanup GCS tests (#4138)
* use `getEnvVarOrSkip()` helper
* use creds from JSON env for test to actually run the test
* prefer require
* nit: relocate helpers
* fail tests if credentials cannot be decoded
2024-09-27 10:24:16 -07:00
Julio López
97b0c02e36 fix(providers): GCS tests (#4136)
* `getCredJSONFromEnv` helper
* use `getCredJSONFromEnv`
* `getEnvVarOrSkip` helper
* skip GCS immutable tests if bucket name is not provided
2024-09-26 22:22:10 -07:00
Julio López
b60804198c refactor(provider): always clone default HTTP transport in S3 provider (#4132)
The s3 storage provider had a different http transports for different cases:

- https without TLS verification: `&http.Transport{}` with default values;
- https with TLS verification: `http.DefaultTransport.Clone()`

This change uses `http.DefaultTransport` in all cases, instead of creating an
empty (zero-value) `http.Transport` for consistency.

Authored-by: aleksandr.samarin (@alexvbg)
2024-09-26 21:51:07 -07:00
Mike McKay-Dirden
1bceb7155e feat(providers): GCS immutability (#4134)
- Allow blob `Put/ExtendBlobRetention`
- PITR support
- PITR/versioning tests
2024-09-26 21:46:25 -07:00
Julio López
948162dce5 refactor(general): minor miscellaneous cleanups (#4074)
Cleanups:

- use non-format variants of Log/Print with no additional args;
- fold in Fprintf call with no args into the following one;
- add missing arg placeholder in format strings;
- use require.Positive instead of Greater(..., 0);
- rename function to fillWithZeros to avoid collision with builtin clear;
- define type for context key to avoid collisions.
2024-08-25 22:10:46 -07:00
Julio López
1f9f9a1846 chore(general): use non-formatting log variants when there is no formatting (#3931)
Use non-formatting logging functions for message without formatting.
For example, `log.Info("message")` instead of `log.Infof("message")`

Configure linter for printf-like functions
2024-06-18 23:13:17 -07:00
Jarek Kowalski
fcb8197f3f chore(ci): upgraded linter to 1.59.0 (#3883) 2024-05-29 20:31:57 -07:00
Jarek Kowalski
09415e0c7d chore(ci): upgraded to go 1.22 (#3746)
Upgrades go to 1.22 and switches to new-style for loops

---------

Co-authored-by: Julio López <1953782+julio-lopez@users.noreply.github.com>
2024-04-08 09:52:47 -07:00
Julio López
2ecf8c9488 fix(providers): check for ContainerAlreadyExists in Azure test (#3767)
Fixes test failure introduced in #3760
2024-04-01 23:14:46 -07:00
Matthieu MOREL
5120313c5e refactor(deps): migrate from github.com/Azure/azure-storage-blob-go to github.com/Azure/azure-sdk-for-go/sdk/storage/azblob (#3760)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-04-01 22:52:26 -07:00
Jarek Kowalski
7278f570e2 chore(ci): upgraded linter to 1.57.1 (#3753) 2024-03-25 22:20:38 -07:00
Jarek Kowalski
29cd545c33 chore(ci): upgrade linter to 1.56.2 (#3714) 2024-03-09 10:39:11 -08:00
Jarek Kowalski
a8e4d50600 build(deps): upgraded linter to v1.55.2, fixed warnings (#3611)
* build(deps): upgraded linter to v1.55.2, fixed warnings

* removed unsafe hacks with better equivalents

* test fixes
2024-02-02 23:34:34 -08:00
Mike McKay-Dirden
fc640a98e4 fix(providers): change versioning check for Azure storage (#3520)
* Change the way the versioning check is done
* Add test to ensure check fails on non-versioned Azure Blob containers (buckets)
2023-12-21 16:39:58 -08:00
Julio Lopez
fa24dfc705 chore(general): cleanup nits (#3481)
- rename variable
- clarify comment
2023-12-02 17:34:00 -08:00
Mike McKay-Dirden
936ed137ff feat(providers): support for Azure immutability protection (#3412) 2023-12-01 22:07:07 -08:00
Mike McKay-Dirden
0d60d8e847 feat(providers): Add ExtendBlobRetention support for Azure (#3405) 2023-11-29 21:26:18 -08:00
Mike McKay-Dirden
d4a380f7c1 feat(repository): Add Azure PIT support (#3407) 2023-11-28 14:52:49 -08:00
Aaron Alpar
fd55f5498d chore(general): correct spelling 2023-11-28 20:42:25 +00:00
Mike McKay-Dirden
174f6141e1 feat(repository): Add support for Azure DeleteBlob operations where immutability protection is on (#3394)
When immutability is enabled on an Azure Blob storage account and/or container, a blob
may be protected by a policy that causes the deletion of the blob to fail.
This causes various kopia operations to fail, including the deletion of session marker
blobs and the deletion of blobs as part of kopia "maintenance" operations.

This changes allows creating an Azure-blob-native deletion marker when the blob is
protected on containers where **version-level immutability** is enabled. This
approach will likely NOT work with the many other flavors of immutability supported
by Azure Blob. That is, the approach is ONLY expected to work with storage
containers with "version-level immutability" enabled.
2023-10-25 15:11:09 -07:00
Jarek Kowalski
14ab42a7b0 fix(repository): removed useless log (#3299) 2023-09-14 23:28:15 -07:00
Jarek Kowalski
aa064bb442 fix(providers): fixed list/get caching with rclone providers (#3284)
Added improved providervalidation logic which tests for read-after-write
property between connections. The new test was failing before the change
and is now passing for Google Drive, OneDrive and DropBox.
2023-09-09 13:07:53 -07:00
Le Tran
cde557b0bf feat(providers): allow other GCS OAuth2.0 credential types (#3064)
Change google client to accept more credentials type, including json config file for workload identity federation
Refactor tokenSourceFromCredentialsFile to remove duplicate code
Add unit tests

---------

Co-authored-by: Le Tran <le.tran@kasten.io>
Co-authored-by: Julio Lopez <1953782+julio-lopez@users.noreply.github.com>
2023-08-23 16:29:44 -07:00
ashmrtn
29320a7c33 refactor(providers): Create default provider that has common functions (#3241)
* Rename UnsupportedBlobRetention struct

Rename this struct to DefaultProviderImplementation in preparation for
adding other simple "default" functionality to it.

* Add other functions to default provider

Add other simple function implementations to the default provider so
that other providers can just embed this to get basic behavior.

* Cleanup existing users of default provider

* Add default provider to remaining storage types

Add the default provider to remaining storage providers and remove
functions that are now implemented by the default provider.
2023-08-21 15:27:15 -07:00
ashmrtn
08c58d53b6 feat(providers): Create IsReadOnly API for blob storage (#3230)
* Add new blob.Storage call to see if it's readonly

Return whether the storage is readonly so higher layers in the stack can
selectively disable some functionality if needed, like compaction.

Co-authored-by: Julio Lopez <1953782+julio-lopez@users.noreply.github.com>
2023-08-21 17:00:50 +00:00
Jarek Kowalski
7eca44993f feat(providers): improve performance of SFTP uploads (#3235)
This improves the performance of gather writes (p and q blobs) in
particular on high-latency links by reducing round-trips.

Tested by uploading Kopia working directory
(3 GB, files:32157 dirs:6051) to SFTP server on LAN (TrueNAS) over WiFi:

Before: 2m4s (~24 MB/s)
After: 1m13s (~41 MB/s)
2023-08-19 18:07:43 -07:00
ashmrtn
bb27e3147e test(repository): More precise check for retention in tests (#3220)
* Store and return retention info in test storage

Add a new interface and function that allows getting retention
information during testing. This allows for more exact comparisons about
retention duration and mode in tests.

* Fixup how blobtesting retention extension works

Use the clock instead of the object's mod time so that extensions are
from the "current time." This aligns with how the S3 blob storage
functions.

* Update retention tests to use more precise checks

Where possible, use the information returned by GetRetention in tests
that deal with retention information. This allows for more precise
comparions of retention duration and mode instead of indirectly testing
duration by advancing the clock and attempting to modify blobs.
2023-08-15 16:53:27 +00:00
Wenkai Yin(尹文开)
ad0b370c49 feat(providers): support for auth with Azure AD (#3131)
Add support for auth with Azure AD

Ref #2800

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
Co-authored-by: Julio Lopez <1953782+julio-lopez@users.noreply.github.com>
2023-08-14 21:05:34 -07:00
ashmrtn
2b73527b43 refactor(general): Cleaner error checking in retention tests (#3164)
* More robust error comparisons in retention tests

Update tests for retention to use `ErrorIs` checks instead of comparing
error messages.

* Use `require.NoError` in retention tests

Minor cleanup to reduce branches in code by using `require.NoError`
instead of if-blocks and `t.Fatal`.
2023-07-21 00:29:17 +00:00
Julio Lopez
f962d93159 refactor(providers): use minio SDK credentials package in S3 STS test (#3148)
* refactor: return credentials.Value in createMinioSessionToken helper
* refactor: use minio SDK credentials package in STS test
* go mod tidy -compat=1.20 => removes dependency on AWS SDK v1 packages
* cleanup: unalias use of minio credentials package
2023-07-16 09:51:40 -07:00
lyndon
187ddd3ee1 fix(repository): fix s3 list bucket permission error (#3072)
Removes check for bucket existence

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
2023-07-11 17:38:24 +00:00
Julio Lopez
537ab39236 chore(general): cleanup "stale" error naming (#3129)
Rename IsESTALE to IsStale to make it consistent with
the conventions in the Go ecosystem

Use errors.Is() instead of == comparison. It is more robust.
2023-07-06 10:59:58 -07:00
PhracturedBlue
42aad38540 feat(repository): Implement retention time extension on S3 buckets using Object Locks (#2179)
* Implement ability to extend retention time on S3 buckets using Object Locks
    * Move object-lock extension to maintenance.Params.
    * Use a default function for unsupported extensions instead of duplicating code
    * Fix potential lockup during object-lock extension
    * Fix race condition.  Add more code coverage
    * rebase to V3
* Add checks to prevent user from setting Retention Period  < Full Maintenance Interval

---------

Co-authored-by: Ashlie Martinez <ashmrtnz@alcion.ai>
2023-07-03 16:20:02 -07:00
Jarek Kowalski
cbc66f936d chore(ci): upgraded linter to 1.53.3 (#3079)
* chore(ci): upgraded linter to 1.53.3

This flagged a bunch of unused parameters, so the PR is larger than
usual, but 99% mechanical.

* separate lint CI task

* run Lint in separate CI
2023-06-18 13:26:01 -07:00
Vaibhav Kamra
3551f743d7 build(deps): upgrade Azure blob module to latest (#3056)
* Upgrade Azure client

* Remove unused lint directive
2023-06-05 07:32:25 -07:00
Jarek Kowalski
2568eebc6e chore(general): fixed remaining checklocks violations (#2939)
We can't enable checklocks on CI yet until
https://github.com/google/gvisor/pull/8807 is merged upstream.

This was tested with private build of checklocks with this patch
applied and the results were clean.
2023-04-13 20:11:36 -07:00