-
Notifications
You must be signed in to change notification settings - Fork 119
Add support for overriding github owned storage multipart upload chunk size via environment variable #1403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…t variable Allows users to set an env variable GITHUB_OWNED_STORAGE_MULTIPART_BYTES with the number of bytes (min 5 Mib) for max number of bytes senter for each part in a multipart upload. By allowing the users to use a smaller size than the default, allows the upload to work in cases a user has a proxy that mishandles or blocks big uploads or for very slow connections. If not defined uses the default 100 Mib value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for configuring the multipart upload chunk size for GitHub owned storage through an environment variable. The feature allows users to override the default 100 MiB chunk size with a custom value (minimum 5 MiB) by setting the GITHUB_OWNED_STORAGE_MULTIPART_BYTES
environment variable.
- Added environment variable configuration for multipart upload chunk size with validation
- Implemented comprehensive test coverage for various edge cases and validation scenarios
- Updated release notes to document the new feature for users
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
RELEASENOTES.md | Added user-facing documentation for the new environment variable feature |
src/Octoshift/Services/ArchiveUploader.cs | Implemented environment variable reading, validation, and chunk size configuration with minimum size enforcement |
src/OctoshiftCLI.Tests/Octoshift/Services/ArchiveUploadersTests.cs | Added comprehensive unit tests for all validation scenarios and implemented proper test cleanup |
Comments suppressed due to low confidence (2)
src/OctoshiftCLI.Tests/Octoshift/Services/ArchiveUploadersTests.cs:62
- Accessing the private field
_streamSizeLimit
directly in tests breaks encapsulation. Consider adding a public property or internal getter to expose this value for testing purposes.
archiveUploader._streamSizeLimit.Should().Be(customSize);
RELEASENOTES.md:1
- There are spelling and grammatical errors: 'a environment' should be 'an environment', 'you a proxy' should be 'you have a proxy', and 'Mib' should be 'MiB' for consistency with the code comments.
- Allow overriding the multipart upload chunk size when using GitHub owned storage. Set the value of the chunk (min 5Mib) in bytes in a environment variable called GITHUB_OWNED_STORAGE_MULTIPART_BYTES (default value 100Mib). Only set this if you a proxy that doesn't allow the default size upload or if you are on a very slow connection.
Unit Test Results 1 files 1 suites 21s ⏱️ Results for commit 688d690. ♻️ This comment has been updated with latest results. |
ArchiveUploader no longer reads the env variable directly. This eliminates the race condition in the tests
This feature allows users to configure the multipart upload chunk size by setting the
GITHUB_OWNED_STORAGE_MULTIPART_BYTES
environment variable.Configuration:
Use cases:
Checklist:
ThirdPartyNotices.txt
(if applicable)closes #1402
Feature Enhancements:
GITHUB_OWNED_STORAGE_MULTIPART_BYTES
environment variable, with a minimum of 5 MiB and a default of 100 MiB. This improves upload reliability in constrained network environments. (RELEASENOTES.md
,src/Octoshift/Services/ArchiveUploader.cs
,src/Octoshift/Services/EnvironmentVariableProvider.cs
) [1] [2] [3]Code Refactoring:
Updated the
ArchiveUploader
constructor to accept anEnvironmentVariableProvider
instance, enabling dynamic configuration of chunk sizes based on environment variables. (src/Octoshift/Services/ArchiveUploader.cs
)Modified
GithubApiFactory
methods (Create
,CreateClientNoSsl
, andCreate
for target GitHub API) to passEnvironmentVariableProvider
toArchiveUploader
. (src/Octoshift/Factories/GithubApiFactory.cs
) [1] [2] [3]Test Updates:
Added extensive unit tests in
ArchiveUploaderTests
to validate behavior when the environment variable is set, not set, invalid, below minimum, zero, or negative. These tests ensure the default values and warnings are correctly applied. (src/OctoshiftCLI.Tests/Octoshift/Services/ArchiveUploadersTests.cs
) [1] [2]Updated integration tests for
BbsToGithub
andGhesToGithub
to includeEnvironmentVariableProvider
in theArchiveUploader
setup. (src/OctoshiftCLI.IntegrationTests/BbsToGithub.cs
,src/OctoshiftCLI.IntegrationTests/GhesToGithub.cs
) [1] [2]