Skip to content

Commit

Permalink
Revert "remove lifecycle symlink test, update formatting"
Browse files Browse the repository at this point in the history
This reverts commit 5b67313.

Signed-off-by: Javier Romero <rjavier@vmware.com>

Revert "failing on 'should add lifecycle symlink' assertion"

This reverts commit bd59022.

Signed-off-by: Javier Romero <rjavier@vmware.com>
  • Loading branch information
jromero committed Aug 19, 2020
1 parent ecf5e71 commit 523c509
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
23 changes: 17 additions & 6 deletions internal/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ const (

cnbDir = "/cnb"

orderPath = "/cnb/order.toml"
stackPath = "/cnb/stack.toml"
platformDir = "/platform"
lifecycleDir = "/cnb/lifecycle"
workspaceDir = "/workspace"
layersDir = "/layers"
orderPath = "/cnb/order.toml"
stackPath = "/cnb/stack.toml"
platformDir = "/platform"
lifecycleDir = "/cnb/lifecycle"
compatLifecycleDir = "/lifecycle"
workspaceDir = "/workspace"
layersDir = "/layers"

metadataLabel = "io.buildpacks.builder.metadata"
stackLabel = "io.buildpacks.stack.id"
Expand Down Expand Up @@ -581,6 +582,16 @@ func (b *Builder) lifecycleLayer(dest string) (string, error) {
return "", errors.Wrap(err, "embedding lifecycle tar")
}

if err := lw.WriteHeader(&tar.Header{
Name: compatLifecycleDir,
Linkname: lifecycleDir,
Typeflag: tar.TypeSymlink,
Mode: 0644,
ModTime: archive.NormalizedDateTime,
}); err != nil {
return "", errors.Wrapf(err, "creating %s symlink", style.Symbol(compatLifecycleDir))
}

return fh.Name(), nil
}

Expand Down
8 changes: 8 additions & 0 deletions internal/builder/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,14 @@ func testBuilder(t *testing.T, when spec.G, it spec.S) {
h.HasFileMode(0755),
h.HasModTime(archive.NormalizedDateTime),
)

it("should add lifecycle symlink", func() {
h.AssertOnTarEntry(t, layerTar, "/lifecycle",
h.SymlinksTo("/cnb/lifecycle"),
h.HasFileMode(0644),
h.HasModTime(archive.NormalizedDateTime),
)
})
})

it("sets the lifecycle version on the metadata", func() {
Expand Down

0 comments on commit 523c509

Please sign in to comment.