Skip to content

Commit 64ac098

Browse files
authored
fix: restorer command has no -daemon args in Platform API version 0.11 (#2393)
1 parent 0e081c6 commit 64ac098

6 files changed

Lines changed: 14 additions & 11 deletions

File tree

cnb-builder-shim/cmd/lifecycle-driver/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ func getBuilderSteps(ctx context.Context) []phase.Step {
205205
}
206206
if *cacheImage != "" {
207207
steps = append(steps, phase.MakeRestorerStep(ctx, *lifecycleDir, *cacheImage, *groupPath, *layersDir,
208-
*logLevel, *useDaemon, *uid, *gid))
208+
*logLevel, *uid, *gid))
209209
}
210210
steps = append(steps,
211211
phase.MakeBuilderStep(ctx, *lifecycleDir, *appDir, *groupPath, *planPath, *layersDir,

cnb-builder-shim/pkg/lifecycle/phase/analyzer.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ func MakeAnalyzerStep(
3434
uid, gid uint32,
3535
) Step {
3636
var opts []CmdOptsProvider
37+
38+
// see analyzer command args: https://github.com/buildpacks/spec/blob/platform/v0.11/platform.md#analyzer
3739
args := []string{
3840
"-analyzed", analyzedPath,
3941
"-layers", layersDir,
@@ -54,5 +56,4 @@ func MakeAnalyzerStep(
5456
args = append(args, outputImage)
5557
cmd := exec.CommandContext(ctx, filepath.Join(lifecycleDir, "analyzer"), args...)
5658
return makeStep("Analyze", "Analyzing optimization plan...", cmd, opts...)
57-
5859
}

cnb-builder-shim/pkg/lifecycle/phase/builder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func MakeBuilderStep(
3131
lifecycleDir, appDir, groupPath, planPath, layersDir, logLevel string,
3232
uid, gid uint32,
3333
) Step {
34+
// see builder command args: https://github.com/buildpacks/spec/blob/platform/v0.11/platform.md#builder
3435
args := []string{
3536
"-app", appDir,
3637
"-group", groupPath,

cnb-builder-shim/pkg/lifecycle/phase/detector.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func MakeDetectorStep(
3131
ctx context.Context,
3232
lifecycleDir, appDir, orderPath, groupPath, planPath, layersDir, logLevel string, uid, gid uint32,
3333
) Step {
34+
// see detector command args: https://github.com/buildpacks/spec/blob/platform/v0.11/platform.md#detector
3435
args := []string{
3536
"-app", appDir,
3637
"-order", orderPath,

cnb-builder-shim/pkg/lifecycle/phase/exporter.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ import (
3030
func MakeExporterStep(ctx context.Context,
3131
lifecycleDir, outputImage, appDir, analyzedPath, cacheImage, groupPath, layersDir, logLevel string,
3232
useDaemon bool,
33-
uid, gid uint32) Step {
33+
uid, gid uint32,
34+
) Step {
3435
var opts []CmdOptsProvider
36+
37+
// see exporter command args: https://github.com/buildpacks/spec/blob/platform/v0.11/platform.md#exporter
3538
args := []string{
3639
"-app", appDir,
3740
"-analyzed", analyzedPath,
@@ -44,7 +47,6 @@ func MakeExporterStep(ctx context.Context,
4447
// export cache when cacheImage is set
4548
if cacheImage != "" {
4649
args = append(args, "-cache-image", cacheImage)
47-
4850
}
4951
if useDaemon {
5052
args = append(args, "-daemon")

cnb-builder-shim/pkg/lifecycle/phase/restorer.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ import (
3030
func MakeRestorerStep(
3131
ctx context.Context,
3232
lifecycleDir, cacheImage, groupPath, layersDir, logLevel string,
33-
useDaemon bool,
3433
uid, gid uint32,
3534
) Step {
3635
var opts []CmdOptsProvider
36+
37+
// see restorer command args: https://github.com/buildpacks/spec/blob/platform/v0.11/platform.md#restorer
3738
args := []string{
3839
"-cache-image", cacheImage,
3940
"-group", groupPath,
@@ -42,12 +43,9 @@ func MakeRestorerStep(
4243
"-uid", fmt.Sprintf("%d", uid),
4344
"-gid", fmt.Sprintf("%d", gid),
4445
}
45-
if useDaemon {
46-
args = append(args, "-daemon")
47-
opts = append(opts, WithRoot())
48-
} else {
49-
opts = append(opts, WithUser(uid, gid))
50-
}
46+
47+
opts = append(opts, WithUser(uid, gid))
48+
5149
cmd := exec.CommandContext(ctx, filepath.Join(lifecycleDir, "restorer"), args...)
5250
return makeStep("Restore", "Restoring layers from the cache...", cmd, opts...)
5351
}

0 commit comments

Comments
 (0)