Add WithPermissions option to remotefs.Upload#316
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends remotefs.Upload with functional options so callers can override the remote file permissions used during upload, enabling uploads (e.g., k0s binary) to be marked executable regardless of local file mode.
Changes:
- Change
remotefs.Uploadto accept variadicUploadOptionarguments. - Add
WithPermissions(mode)option to override the file mode passed to remoteOpenFile. - Add unit tests covering default permission behavior, overridden permissions, and checksum mismatch handling.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
remotefs/upload.go |
Introduces UploadOption/WithPermissions and updates Upload to apply options before creating the remote file. |
remotefs/upload_test.go |
Adds tests validating default permission passthrough, permission override, and checksum mismatch error behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Upload now accepts variadic UploadOption arguments. WithPermissions(mode) overrides the file mode used when creating the remote file; without it the local file's mode is used (existing behaviour preserved). Needed for k0s binary upload which must land as executable (0o755) regardless of the local file's permissions. Part of the rigv2 last-mile effort. Breaking API is not a problem as rig v2 is not released or in use yet. Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
…test Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
cd0de67 to
c717188
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Upload now accepts variadic UploadOption arguments. WithPermissions(mode) overrides the file mode used when creating the remote file; without it the local file's mode is used (existing behaviour preserved).
Needed for k0s binary upload which must land as executable (0o755) regardless of the local file's permissions.
Part of the rigv2 last-mile effort. Breaking API is not a problem as rig v2 is not released or in use yet.