Skip to content

Commit

Permalink
Create tempdir if not using the default
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Mikusa <[email protected]>
  • Loading branch information
Daniel Mikusa committed Apr 14, 2022
1 parent 3885ddb commit e1c1626
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drafts/drafts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit e1c1626

Please sign in to comment.