Skip to content

Add WithPermissions option to remotefs.Upload#316

Merged
kke merged 2 commits into
mainfrom
upload-with-permissions
Apr 21, 2026
Merged

Add WithPermissions option to remotefs.Upload#316
kke merged 2 commits into
mainfrom
upload-with-permissions

Conversation

@kke
Copy link
Copy Markdown
Contributor

@kke kke commented Apr 21, 2026

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.

@kke kke added the enhancement New feature or request label Apr 21, 2026
@kke kke requested a review from Copilot April 21, 2026 13:10
Copy link
Copy Markdown

Copilot AI left a 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 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.Upload to accept variadic UploadOption arguments.
  • Add WithPermissions(mode) option to override the file mode passed to remote OpenFile.
  • 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.

Comment thread remotefs/upload_test.go Outdated
Comment thread remotefs/upload_test.go Outdated
Comment thread remotefs/upload.go Outdated
Comment thread remotefs/upload.go Outdated
kke added 2 commits April 21, 2026 16:26
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>
@kke kke force-pushed the upload-with-permissions branch from cd0de67 to c717188 Compare April 21, 2026 13:26
@kke kke requested a review from Copilot April 21, 2026 13:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@kke kke marked this pull request as ready for review April 21, 2026 13:35
@kke kke merged commit 2a919c5 into main Apr 21, 2026
15 checks passed
@kke kke deleted the upload-with-permissions branch April 21, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants