Skip to content
Open
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
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/new-issue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: New Issue
description: Create a new issue
body:
- type: textarea
id: issue
attributes:
label: Issue
description: Please enter an explicit description of your issue
validations:
required: true

- type: textarea
id: crdifyVersion
attributes:
label: crdify version
value: |
```console
$ crdify version
# Run `crdify version` and paste output here
```
validations:
required: true
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#### What this PR does:

Describe your pull request here

#### Which issue this PR is related to:

Fixes #<issue-number>
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ SHELL := /usr/bin/env bash -o pipefail
# Tool definitions
GOLANGCI_LINT := go tool -modfile tools/go.mod github.com/golangci/golangci-lint/v2/cmd/golangci-lint

# Current commit hash for `version` output
COMMIT_HASH := $(shell git rev-parse --short HEAD 2>/dev/null || echo "commit_hash_not_found")

.PHONY: lint
lint: golangci-lint

Expand All @@ -19,7 +22,7 @@ unit:

.PHONY: build
build:
go build -o bin/crdify main.go
go build -ldflags "-X 'sigs.k8s.io/crdify/cli.BuildHash=$(COMMIT_HASH)'" -o bin/crdify main.go

.PHONY: fmt
fmt:
Expand Down
5 changes: 4 additions & 1 deletion cli/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
"github.com/spf13/cobra"
)

var BuildHash = "0000000"

// NewVersionCommand returns a new cobra.Command
// for printing the current version of crd-diff.
func NewVersionCommand() *cobra.Command {
Expand All @@ -37,7 +39,8 @@ func NewVersionCommand() *cobra.Command {

settingNameStyle := lipgloss.NewStyle().Bold(true)
if bi, ok := debug.ReadBuildInfo(); ok {
out.WriteString(fmt.Sprintf("%s: %s\n\n", settingNameStyle.Render("version"), bi.Main.Version))
out.WriteString(fmt.Sprintf("%s: %s\n", settingNameStyle.Render("version"), bi.Main.Version))
out.WriteString(fmt.Sprintf("%s: %s\n\n", settingNameStyle.Render("hash"), BuildHash))
for _, setting := range bi.Settings {
name := settingNameStyle.Render(setting.Key)
out.WriteString(fmt.Sprintf("%s: %s\n", name, setting.Value))
Expand Down