Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Zarf build version when inspecting packages #179

Merged
merged 2 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions cli/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
}
Expand Down
6 changes: 6 additions & 0 deletions cli/internal/packager/inspect.go
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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)

}