MCPcopy Index your code
hub / github.com/cloudfoundry/cli / MakeBuildpackArchive

Function MakeBuildpackArchive

integration/helpers/buildpack.go:16–38  ·  view source on GitHub ↗

MakeBuildpackArchive makes a simple buildpack zip for a given stack.

(stackName string)

Source from the content-addressed store, hash-verified

14
15// MakeBuildpackArchive makes a simple buildpack zip for a given stack.
16func MakeBuildpackArchive(stackName string) string {
17 archiveFile, err := os.CreateTemp("", "buildpack-archive-file-")
18 Expect(err).ToNot(HaveOccurred())
19 err = archiveFile.Close()
20 Expect(err).ToNot(HaveOccurred())
21 err = os.RemoveAll(archiveFile.Name())
22 Expect(err).ToNot(HaveOccurred())
23
24 archiveName := archiveFile.Name() + ".zip"
25
26 dir, err := os.MkdirTemp("", "buildpack-dir-")
27 Expect(err).ToNot(HaveOccurred())
28 defer os.RemoveAll(dir)
29
30 manifest := filepath.Join(dir, "manifest.yml")
31 err = os.WriteFile(manifest, []byte(fmt.Sprintf("stack: %s", stackName)), 0666)
32 Expect(err).ToNot(HaveOccurred())
33
34 err = Zipit(dir, archiveName, "")
35 Expect(err).ToNot(HaveOccurred())
36
37 return archiveName
38}
39
40// BuildpackWithStack makes a simple buildpack for the given stack (using
41// MakeBuildpackArchive) and yields it to the given function, removing the zip

Callers 2

BuildpackWithStackFunction · 0.85

Calls 3

NameMethod · 0.80
ZipitFunction · 0.70
CloseMethod · 0.65

Tested by

no test coverage detected