Skip to content

Commit 652215b

Browse files
devops-github-rudderstackachettyiitrkoladilipatzoum
authored
chore: sync release v1.58.3 to main branch (#6345)
# Description Syncing patch release v1.58.3 to main branch **↓↓ Please review and edit commit overrides before merging ↓↓** BEGIN_COMMIT_OVERRIDE fix(batchrouter): support configurable column ordering in CSVs in sftp (#6342) END_COMMIT_OVERRIDE --------- Co-authored-by: Akash Chetty <[email protected]> Co-authored-by: Dilip Kola <[email protected]> Co-authored-by: Aris Tzoumas <[email protected]>
1 parent a76a509 commit 652215b

File tree

6 files changed

+487
-43
lines changed

6 files changed

+487
-43
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [1.58.3](https://github.com/rudderlabs/rudder-server/compare/v1.58.2...v1.58.3) (2025-09-15)
4+
5+
6+
### Bug Fixes
7+
8+
* **batchrouter:** support configurable column ordering in CSVs in sftp ([#6342](https://github.com/rudderlabs/rudder-server/issues/6342)) ([1c0cf56](https://github.com/rudderlabs/rudder-server/commit/1c0cf56395a071b588c8d67400acff4bd6eb05fa))
9+
310
## [1.58.2](https://github.com/rudderlabs/rudder-server/compare/v1.58.1...v1.58.2) (2025-09-11)
411

512

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ require (
220220
github.com/go-playground/validator/v10 v10.23.0 // indirect
221221
github.com/go-sql-driver/mysql v1.8.1 // indirect
222222
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
223-
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
223+
github.com/go-viper/mapstructure/v2 v2.4.0
224224
github.com/goccy/go-json v0.10.5 // indirect
225225
github.com/goccy/go-reflect v1.2.0 // indirect
226226
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect

router/batchrouter/asyncdestinationmanager/sftp/manager.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"os"
66
"time"
77

8+
"github.com/go-viper/mapstructure/v2"
89
"github.com/tidwall/gjson"
910

1011
"github.com/rudderlabs/rudder-go-kit/logger"
@@ -58,7 +59,7 @@ func (d *defaultManager) Upload(asyncDestStruct *common.AsyncDestinationStruct)
5859
fileFormat := result.Get("fileFormat").String()
5960

6061
// Generate temporary file based on the destination's file format
61-
jsonOrCSVFilePath, err := generateFile(textFilePath, fileFormat)
62+
jsonOrCSVFilePath, err := generateFile(textFilePath, fileFormat, d.config.SortColumnNames)
6263
if err != nil {
6364
return generateErrorOutput(fmt.Sprintf("error generating temporary file: %v", err.Error()), asyncDestStruct.ImportingJobIDs, destinationID)
6465
}
@@ -98,16 +99,21 @@ func (d *defaultManager) Upload(asyncDestStruct *common.AsyncDestinationStruct)
9899
}
99100
}
100101

101-
func newDefaultManager(logger logger.Logger, statsFactory stats.Stats, fileManager sftp.FileManager) *defaultManager {
102+
func newDefaultManager(logger logger.Logger, statsFactory stats.Stats, fileManager sftp.FileManager, config destConfig) *defaultManager {
102103
return &defaultManager{
103104
FileManager: fileManager,
104105
logger: logger.Child("SFTP").Child("Manager"),
105106
statsFactory: statsFactory,
107+
config: config,
106108
}
107109
}
108110

109111
func newInternalManager(logger logger.Logger, statsFactory stats.Stats, destination *backendconfig.DestinationT) (common.AsyncUploadAndTransformManager, error) {
110-
sshConfig, err := createSSHConfig(destination)
112+
var config destConfig
113+
if err := mapstructure.Decode(destination.Config, &config); err != nil {
114+
return nil, fmt.Errorf("unmarshalling destination config: %w", err)
115+
}
116+
sshConfig, err := createSSHConfig(config)
111117
if err != nil {
112118
return nil, fmt.Errorf("creating SSH config: %w", err)
113119
}
@@ -117,7 +123,8 @@ func newInternalManager(logger logger.Logger, statsFactory stats.Stats, destinat
117123
return nil, fmt.Errorf("creating file manager: %w", err)
118124
}
119125

120-
return newDefaultManager(logger, statsFactory, fileManager), nil
126+
manager := newDefaultManager(logger, statsFactory, fileManager, config)
127+
return manager, nil
121128
}
122129

123130
func NewManager(logger logger.Logger, statsFactory stats.Stats, destination *backendconfig.DestinationT) (common.AsyncDestinationManager, error) {

0 commit comments

Comments
 (0)