Skip to content

Commit 9a75db4

Browse files
committed
Fix release task extraction from Heroku buildpack
1 parent 12d8c01 commit 9a75db4

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [2.1.0] - 2025-02-10
9+
10+
### Fixed
11+
12+
* Release tasks work with latest metadata from Heroku Buildpacks

builder/build/metadatatoml.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (m *BuildpackMetadataToml) UpdateAppPackToml(a *AppPackToml) {
3232
a.Services = make(map[string]AppPackTomlService)
3333
for _, process := range m.Processes {
3434
if process.Type == "release" {
35-
a.Deploy.ReleaseCommand = commandSliceToString(process.Command)
35+
a.Deploy.ReleaseCommand = commandSliceToString(append(process.Command, process.Args...))
3636
continue
3737
}
3838
if process.BuildpackID == "heroku/ruby" && (process.Type == "rake" || process.Type == "console") {

builder/build/metadatatoml_test.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,26 @@ func TestBuildpackMetadataTomlToApppackServices(t *testing.T) {
88
m := BuildpackMetadataToml{
99
Processes: []BuildpackMetadataTomlProcess{
1010
{
11-
Command: []string{"echo", "ruby web"},
11+
Command: []string{"bash", "-c"},
12+
Args: []string{"echo \"ruby web\""},
1213
Type: "web",
1314
BuildpackID: "heroku/ruby",
1415
},
1516
{
16-
Command: []string{"echo", "release"},
17+
Command: []string{"bash", "-c"},
18+
Args: []string{"echo release"},
1719
Type: "release",
1820
BuildpackID: "heroku/ruby",
1921
},
2022
{
21-
Command: []string{"echo 'ruby worker'"},
23+
Command: []string{"bash", "-c"},
24+
Args: []string{"echo 'ruby worker'"},
2225
Type: "worker",
2326
BuildpackID: "heroku/ruby",
2427
},
2528
{
26-
Command: []string{"echo", "rake"},
29+
Command: []string{"bash", "-c"},
30+
Args: []string{"echo rake"},
2731
Type: "rake",
2832
BuildpackID: "heroku/ruby",
2933
},
@@ -34,15 +38,15 @@ func TestBuildpackMetadataTomlToApppackServices(t *testing.T) {
3438
if len(a.Services) != 2 {
3539
t.Errorf("expected 2 services, got %d", len(a.Services))
3640
}
37-
expected := "echo 'ruby web'"
41+
expected := "bash -c 'echo \"ruby web\"'"
3842
if a.Services["web"].Command != expected {
3943
t.Errorf("expected %s, got %s", expected, a.Services["web"].Command)
4044
}
41-
expected = "echo 'ruby worker'"
45+
expected = "bash -c 'echo '\"'\"'ruby worker'\"'\"''"
4246
if a.Services["worker"].Command != expected {
4347
t.Errorf("expected %s, got %s", expected, a.Services["worker"].Command)
4448
}
45-
expected = "echo release"
49+
expected = "bash -c 'echo release'"
4650
if a.Deploy.ReleaseCommand != expected {
4751
t.Errorf("expected %s, got %s", expected, a.Deploy.ReleaseCommand)
4852
}

0 commit comments

Comments
 (0)