Skip to content

Commit 5d4a320

Browse files
authored
Adding support for packaging multi-arch extension based on the OS architecture (#373)
* adding support for packaging multi-arch extensions * setting default value on result while testing extension
1 parent 2330b88 commit 5d4a320

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

packagers/jam.go

+11-20
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,18 @@ func (j Jam) Execute(buildpackDir, output, version string, offline bool) error {
5959

6060
extensionTomlPath := filepath.Join(buildpackDir, "extension.toml")
6161

62-
buildpackOrExtensionToml := "buildpack.toml"
63-
command := "--buildpack"
62+
var buildpackType string
6463

6564
if fileExists, err := fs.Exists(extensionTomlPath); fileExists && err == nil {
66-
buildpackOrExtensionToml = "extension.toml"
67-
command = "--extension"
65+
buildpackType = "extension"
66+
} else {
67+
buildpackType = "buildpack"
6868
}
6969

7070
args := []string{
7171
"pack",
72-
command, filepath.Join(buildpackDir, buildpackOrExtensionToml),
72+
fmt.Sprintf("--%s", buildpackType),
73+
filepath.Join(buildpackDir, fmt.Sprintf("%s.toml", buildpackType)),
7374
"--output", buildpackTarballPath,
7475
"--version", version,
7576
}
@@ -106,21 +107,11 @@ func (j Jam) Execute(buildpackDir, output, version string, offline bool) error {
106107

107108
}
108109

109-
if ( command == "--buildpack") {
110-
args = []string{
111-
"buildpack", "package",
112-
output,
113-
"--format", "file",
114-
"--target", fmt.Sprintf("linux/%s", runtime.GOARCH),
115-
}
116-
} else {
117-
// pack extension does not yet support multi-arch
118-
// update to inclue --target once it does
119-
args = []string{
120-
"extension", "package",
121-
output,
122-
"--format", "file",
123-
}
110+
args = []string{
111+
buildpackType, "package",
112+
output,
113+
"--format", "file",
114+
"--target", fmt.Sprintf("linux/%s", runtime.GOARCH),
124115
}
125116

126117
err = j.pack.Execute(pexec.Execution{

packagers/jam_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ func testJam(t *testing.T, context spec.G, it spec.S) {
112112
"extension", "package",
113113
"some-output",
114114
"--format", "file",
115+
"--target", "linux/amd64",
115116
}))
116117
})
117118
})

0 commit comments

Comments
 (0)