From e1c16269540f43846148402cf0f19f529ed90e63 Mon Sep 17 00:00:00 2001 From: Daniel Mikusa Date: Thu, 14 Apr 2022 14:31:13 -0400 Subject: [PATCH] Create tempdir if not using the default Signed-off-by: Daniel Mikusa --- drafts/drafts.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drafts/drafts.go b/drafts/drafts.go index f253e9f1..6ce74cb0 100644 --- a/drafts/drafts.go +++ b/drafts/drafts.go @@ -313,7 +313,14 @@ func (r RegistryBuildpackLoader) LoadBuildpacks(uris []string) ([]Buildpack, err } func (r RegistryBuildpackLoader) LoadBuildpack(uri string) (Buildpack, error) { - tarFile, err := ioutil.TempFile(os.Getenv("RUNNER_TEMP"), "tarfiles") + tmpdir := os.Getenv("RUNNER_TEMP") + if tmpdir != "" { + if err := os.MkdirAll(tmpdir, 0755); err != nil { + return Buildpack{}, fmt.Errorf("unable to create tempdir\n%w", err) + } + } + + tarFile, err := ioutil.TempFile(tmpdir, "tarfiles") if err != nil { return Buildpack{}, fmt.Errorf("unable to create tempfile\n%w", err) }