Skip to content

pkg/compose: implement Export using atomicwriter #12715

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

Merged
merged 1 commit into from
Apr 9, 2025

Conversation

thaJeztah
Copy link
Member

Replaces the use of cli/command.CopyToFile with an atomicwriter, as cli/command.CopyToFile will be deprecated in the next release.

What I did

Related issue

(not mandatory) A picture of a cute animal, if possible in relation to what you did

if s.dockerCli.Out().IsTerminal() {
return fmt.Errorf("output option is required when exporting to terminal")
}
} else if err := command.ValidateOutputPath(options.Output); err != nil {
Copy link
Member Author

Choose a reason for hiding this comment

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

FWIW; atomicwriter.New() also performs this validation, so we could have a look if we still need this check before we run that code 🤔

I should also have a look at; the copy commands;

compose/pkg/compose/cp.go

Lines 174 to 177 in a1f673d

// Validate the destination path
if err := command.ValidateOutputPathFileMode(dstStat.Mode); err != nil {
return fmt.Errorf(`destination "%s:%s" must be a directory or a regular file: %w`, containerID, dstPath, err)
}

compose/pkg/compose/cp.go

Lines 255 to 257 in a1f673d

if err := command.ValidateOutputPath(dstPath); err != nil {
return err
}

@thaJeztah thaJeztah closed this Apr 7, 2025
@thaJeztah thaJeztah reopened this Apr 7, 2025
Replaces the use of cli/command.CopyToFile with an atomicwriter,
as cli/command.CopyToFile will be deprecated in the next release.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah marked this pull request as ready for review April 8, 2025 14:31
@thaJeztah thaJeztah requested a review from a team as a code owner April 8, 2025 14:31
@thaJeztah thaJeztah requested review from ndeloof and glours April 8, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants