Skip to content

Commit

Permalink
fix(configloader): finalize handling must be optional
Browse files Browse the repository at this point in the history
  • Loading branch information
foosinn committed Nov 3, 2023
1 parent fcd98ea commit 3d7f78d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions plugin/configloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (dcc *DroneConfigCombiner) ConfigNames(without KeyOnlyMap) []string {
}

// Combine concats all appended configs in to a single string
func (dcc *DroneConfigCombiner) Combine() string {
func (dcc *DroneConfigCombiner) Combine(mondifyFinalizeConfig bool) string {
combined := ""
finalize := ""

Expand All @@ -58,7 +58,7 @@ func (dcc *DroneConfigCombiner) Combine() string {
for _, ldc := range dcc.LoadedConfigs {
data := ldc.Content

if ldc.Name == "finalize" {
if ldc.Name == "finalize" && mondifyFinalizeConfig {
names := dcc.ConfigNames(KeyOnlyMap{"finalize": nil})

var mdc map[string]interface{}
Expand All @@ -80,10 +80,10 @@ func (dcc *DroneConfigCombiner) Combine() string {
}

// skip finalize as it needs to be added at the end
if ldc.Name != "finalize" {
combined += data
} else {
if ldc.Name == "finalize" && mondifyFinalizeConfig {
finalize = data
} else {
combined += data
}
}

Expand Down
2 changes: 1 addition & 1 deletion plugin/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (p *Plugin) getConfigData(ctx context.Context, req *request) (string, error
}

// combine
configData := dcc.Combine()
configData := dcc.Combine(p.finalize)

return configData, nil
}
Expand Down

0 comments on commit 3d7f78d

Please sign in to comment.