Check opt.NativeTooling before creating build directory (#23894)

#23893

Changes on top of the PR from the @ilpianista:
https://github.com/fleetdm/fleet/pull/23796
This commit is contained in:
Lucas Manuel Rodriguez
2024-11-18 11:32:55 -03:00
committed by GitHub
parent 4f3bf6439e
commit c080a3b0e1
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -0,0 +1 @@
* Fixed bug in `fleetdm/fleetctl` docker image where the `build` directory does not exist when generating deb/rpm packages.
+2 -2
View File
@@ -250,8 +250,8 @@ func buildNFPM(opt Options, pkger nfpm.Packager) (string, error) {
return "", fmt.Errorf("removing existing file: %w", err)
}
if _, err := os.Stat("build"); errors.Is(err, os.ErrNotExist) {
if err := secure.MkdirAll("build", 0700); err != nil {
if opt.NativeTooling {
if err := secure.MkdirAll(filepath.Dir(filename), 0o700); err != nil {
return "", fmt.Errorf("cannot create build dir: %w", err)
}
}