diff --git a/cli/Makefile b/cli/Makefile index a2f80523c7..75e0144569 100644 --- a/cli/Makefile +++ b/cli/Makefile @@ -13,5 +13,5 @@ build: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X 'github.com/defenseunicorns/zarf/cli/config.CLIVersion=$(CLI_VERSION)'" -o ../build/zarf main.go build-mac: mkdir -p ../build - GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o ../build/zarf-mac-apple main.go - GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o ../build/zarf-mac-intel main.go + GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w -X 'github.com/defenseunicorns/zarf/cli/config.CLIVersion=$(CLI_VERSION)'" -o ../build/zarf-mac-apple main.go + GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w -X 'github.com/defenseunicorns/zarf/cli/config.CLIVersion=$(CLI_VERSION)'" -o ../build/zarf-mac-intel main.go diff --git a/cli/config/config.go b/cli/config/config.go index b775c6c708..77485fc99e 100644 --- a/cli/config/config.go +++ b/cli/config/config.go @@ -49,6 +49,10 @@ func GetComponents() []ZarfComponent { return config.Components } +func GetBuildData() ZarfBuildData { + return config.Package +} + func GetValidPackageExtensions() [3]string { return [...]string{".tar.zst", ".tar", ".zip"} } diff --git a/cli/internal/packager/inspect.go b/cli/internal/packager/inspect.go index 7ca18dc082..1ba680a959 100644 --- a/cli/internal/packager/inspect.go +++ b/cli/internal/packager/inspect.go @@ -1,8 +1,10 @@ package packager import ( + "fmt" "io/ioutil" + "github.com/defenseunicorns/zarf/cli/config" "github.com/defenseunicorns/zarf/cli/internal/utils" "github.com/mholt/archiver/v3" "github.com/sirupsen/logrus" @@ -29,5 +31,9 @@ func Inspect(packageName string) { utils.ColorPrintYAML(text) + // Load the config to get the build version + config.Load(tempPath.base + "/zarf.yaml") + fmt.Printf("The package was built with Zarf CLI version %s\n", config.GetBuildData().Version) cleanup(tempPath) + }