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

fix: grep go client version from go.mod file #2

Merged
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
7 changes: 3 additions & 4 deletions hack/gen-crd-spec/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import (
"os/exec"
"strings"

"github.com/blang/semver"

"github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1"
unstructuredutil "github.com/argoproj/argo-rollouts/utils/unstructured"

"github.com/blang/semver"
"github.com/ghodss/yaml"
"github.com/go-openapi/spec"
extensionsobj "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
Expand Down Expand Up @@ -78,7 +77,7 @@ func setValidationOverride(un *unstructured.Unstructured, fieldOverride map[stri

func NewCustomResourceDefinition() []*extensionsobj.CustomResourceDefinition {
crdYamlBytes, err := exec.Command(
"dist/controller-gen",
"controller-gen",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverting accidental change. I changed the binary name to dist/controller-gen for debugging purposes.

"paths=./pkg/apis/rollouts/...",
"crd:trivialVersions=true",
// The only possible value is 'false' since 'apiextensions.k8s.io/v1'
Expand Down Expand Up @@ -291,7 +290,7 @@ func checkErr(err error) {
// loadK8SDefinitions loads K8S types API schema definitions
func loadK8SDefinitions() (spec.Definitions, error) {
// detects minor version of k8s client
k8sVersionCmd := exec.Command("sh", "-c", "go list -m all | grep k8s.io/client-go | awk '{print $2}'")
k8sVersionCmd := exec.Command("sh", "-c", "cat go.mod | grep \"k8s.io/client-go\" | head -n 1 | cut -d' ' -f2")
versionData, err := k8sVersionCmd.Output()
if err != nil {
return nil, fmt.Errorf("failed to determine k8s client version: %v", err)
Expand Down