Skip to content

Commit 64907b6

Browse files
[feat] add version template for the modify config option (#120)
* add feat to introduce a version template for the modify config option * remove extra space from string
1 parent 49a63cd commit 64907b6

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

internal/program.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ func Program(args []string) error {
127127
}
128128
for _, modify := range c.Images.Modify {
129129
if modify.From != "" {
130-
131130
if strings.HasPrefix(r, modify.From) {
132131
delete(m, i)
133132

pkg/copa/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (o PatchOption) Run(ctx context.Context, reportFilePaths map[*registry.Imag
7070
CertPath: o.Buildkit.CertPath,
7171
KeyPath: o.Buildkit.KeyPath,
7272
}, outFilePaths[i]); err != nil {
73-
return fmt.Errorf("error patching image %s :: %w ", ref, err)
73+
return fmt.Errorf("error patching image %s :: %w", ref, err)
7474
}
7575

7676
_ = bar.Add(1)

pkg/helm/chartOption.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,11 @@ func (co ChartOption) Run(ctx context.Context, setters ...Option) (ChartData, er
288288
for _, mod := range c.Images.Modify {
289289
if mod.FromValuePath != "" {
290290
slog.Info("modifying chart value", slog.String("HelmValuesPath", mod.FromValuePath), slog.String("new", mod.To))
291-
err := replaceValue(strings.Split(mod.FromValuePath, "."), mod.To, chart.Values)
291+
292+
to := mod.To
293+
versionToken := "{.version}"
294+
to = strings.Replace(to, versionToken, c.Version, 1)
295+
err := replaceValue(strings.Split(mod.FromValuePath, "."), to, chart.Values)
292296
if err != nil {
293297
return err
294298
}

0 commit comments

Comments
 (0)