func()

in fast-build-update-tool/internal/tools/file_uploader.go [111:128]


func (f *FileUploader) copyFile(ctx context.Context, file, knownHostsFile string) error {
	f.logger.Debug("copying file to remote instance", "file", file)

	err := f.commandRunner(scpCommand,
		"-o",
		"UserKnownHostsFile="+knownHostsFile,
		"-P",
		fmt.Sprintf("%d", f.sshPort),
		"-i",
		f.privateKeyPath,
		file,
		fmt.Sprintf("%s@%s:%s", f.remoteUser, f.remoteIpAddress, string(f.remoteUploadDirectory)+filepath.Base(file)))
	if err != nil {
		return fmt.Errorf("error copying file to remote instance: %s %w", f.remoteIpAddress, err)
	}

	return nil
}