diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-05-30 15:33:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-30 07:33:50 +0000 |
commit | fb7b743bd0f305a6462896398bcba2a74c6e391e (patch) | |
tree | ab821590da64878c10c369fea6c6ca9221d04085 /cmd | |
parent | 015efcd8bfd451ef593192eb43cfcfb7001f7861 (diff) | |
download | gitea-fb7b743bd0f305a6462896398bcba2a74c6e391e.tar.gz gitea-fb7b743bd0f305a6462896398bcba2a74c6e391e.zip |
Azure blob storage support (#30995)
This PR implemented object storages(LFS/Packages/Attachments and etc.)
for Azure Blob Storage. It depends on azure official golang SDK and can
support both the azure blob storage cloud service and azurite mock
server.
Replace #25458
Fix #22527
- [x] CI Tests
- [x] integration test, MSSQL integration tests will now based on
azureblob
- [x] unit test
- [x] CLI Migrate Storage
- [x] Documentation for configuration added
------
TODO (other PRs):
- [ ] Improve performance of `blob download`.
---------
Co-authored-by: yp05327 <576951401@qq.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/migrate_storage.go | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/cmd/migrate_storage.go b/cmd/migrate_storage.go index 7d1ef052ff..1720b6fb53 100644 --- a/cmd/migrate_storage.go +++ b/cmd/migrate_storage.go @@ -40,7 +40,7 @@ var CmdMigrateStorage = &cli.Command{ Name: "storage", Aliases: []string{"s"}, Value: "", - Usage: "New storage type: local (default) or minio", + Usage: "New storage type: local (default), minio or azureblob", }, &cli.StringFlag{ Name: "path", @@ -48,6 +48,7 @@ var CmdMigrateStorage = &cli.Command{ Value: "", Usage: "New storage placement if store is local (leave blank for default)", }, + // Minio Storage special configurations &cli.StringFlag{ Name: "minio-endpoint", Value: "", @@ -96,6 +97,32 @@ var CmdMigrateStorage = &cli.Command{ Value: "", Usage: "Minio bucket lookup type", }, + // Azure Blob Storage special configurations + &cli.StringFlag{ + Name: "azureblob-endpoint", + Value: "", + Usage: "Azure Blob storage endpoint", + }, + &cli.StringFlag{ + Name: "azureblob-account-name", + Value: "", + Usage: "Azure Blob storage account name", + }, + &cli.StringFlag{ + Name: "azureblob-account-key", + Value: "", + Usage: "Azure Blob storage account key", + }, + &cli.StringFlag{ + Name: "azureblob-container", + Value: "", + Usage: "Azure Blob storage container", + }, + &cli.StringFlag{ + Name: "azureblob-base-path", + Value: "", + Usage: "Azure Blob storage base path", + }, }, } @@ -228,6 +255,18 @@ func runMigrateStorage(ctx *cli.Context) error { BucketLookUpType: ctx.String("minio-bucket-lookup-type"), }, }) + case string(setting.AzureBlobStorageType): + dstStorage, err = storage.NewAzureBlobStorage( + stdCtx, + &setting.Storage{ + AzureBlobConfig: setting.AzureBlobStorageConfig{ + Endpoint: ctx.String("azureblob-endpoint"), + AccountName: ctx.String("azureblob-account-name"), + AccountKey: ctx.String("azureblob-account-key"), + Container: ctx.String("azureblob-container"), + BasePath: ctx.String("azureblob-base-path"), + }, + }) default: return fmt.Errorf("unsupported storage type: %s", ctx.String("storage")) } |