From 391da79abd7a7af1cfab04de35daba7cd58c4c80 Mon Sep 17 00:00:00 2001 From: Nikhita Raghunath Date: Sun, 16 Jun 2019 22:00:57 +0530 Subject: [PATCH] Fix scripts to not rely on codegen scripts being executable If someone doesn't have code-generator in their GOPATH, they'll need to run `go mod vendor` to populate the vendor directory with the code-generator repo (it is required by `hack/tools.go`). However, `go mod vendor` does not mark scripts as executable which leads to a `Permission denied` error while trying to run `update-codegen.sh` in staging repos. So fix scripts to not rely on codegen scripts being executable. --- .../examples/client-go/hack/update-codegen.sh | 2 +- .../src/k8s.io/apiextensions-apiserver/hack/update-codegen.sh | 2 +- staging/src/k8s.io/kube-aggregator/hack/update-codegen.sh | 4 ++-- staging/src/k8s.io/metrics/hack/update-codegen.sh | 4 ++-- staging/src/k8s.io/node-api/hack/update-codegen.sh | 2 +- staging/src/k8s.io/sample-controller/hack/update-codegen.sh | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/update-codegen.sh b/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/update-codegen.sh index 809ee02feef..0f7bfa52ad6 100755 --- a/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/update-codegen.sh +++ b/staging/src/k8s.io/apiextensions-apiserver/examples/client-go/hack/update-codegen.sh @@ -25,7 +25,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code- # --output-base because this script should also be able to run inside the vendor dir of # k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir # instead of the $GOPATH directly. For normal projects this can be dropped. -"${CODEGEN_PKG}/generate-groups.sh" all \ +bash "${CODEGEN_PKG}/generate-groups.sh" all \ k8s.io/apiextensions-apiserver/examples/client-go/pkg/client k8s.io/apiextensions-apiserver/examples/client-go/pkg/apis \ cr:v1 \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../../.." diff --git a/staging/src/k8s.io/apiextensions-apiserver/hack/update-codegen.sh b/staging/src/k8s.io/apiextensions-apiserver/hack/update-codegen.sh index d5b08c6c5da..59144886522 100755 --- a/staging/src/k8s.io/apiextensions-apiserver/hack/update-codegen.sh +++ b/staging/src/k8s.io/apiextensions-apiserver/hack/update-codegen.sh @@ -27,7 +27,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code- # instead of the $GOPATH directly. For normal projects this can be dropped. CLIENTSET_NAME_VERSIONED=clientset \ CLIENTSET_NAME_INTERNAL=internalclientset \ -"${CODEGEN_PKG}/generate-internal-groups.sh" all \ +bash "${CODEGEN_PKG}/generate-internal-groups.sh" all \ k8s.io/apiextensions-apiserver/pkg/client k8s.io/apiextensions-apiserver/pkg/apis k8s.io/apiextensions-apiserver/pkg/apis \ "apiextensions:v1beta1" \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ diff --git a/staging/src/k8s.io/kube-aggregator/hack/update-codegen.sh b/staging/src/k8s.io/kube-aggregator/hack/update-codegen.sh index d50f15cfdb3..4a553c65924 100755 --- a/staging/src/k8s.io/kube-aggregator/hack/update-codegen.sh +++ b/staging/src/k8s.io/kube-aggregator/hack/update-codegen.sh @@ -23,7 +23,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code- CLIENTSET_NAME_VERSIONED=clientset \ CLIENTSET_PKG_NAME=clientset_generated \ -"${CODEGEN_PKG}/generate-groups.sh" deepcopy,client,lister,informer \ +bash "${CODEGEN_PKG}/generate-groups.sh" deepcopy,client,lister,informer \ k8s.io/kube-aggregator/pkg/client k8s.io/kube-aggregator/pkg/apis \ "apiregistration:v1beta1,v1" \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ @@ -32,7 +32,7 @@ CLIENTSET_PKG_NAME=clientset_generated \ CLIENTSET_NAME_VERSIONED=clientset \ CLIENTSET_PKG_NAME=clientset_generated \ CLIENTSET_NAME_INTERNAL=internalclientset \ -"${CODEGEN_PKG}/generate-internal-groups.sh" deepcopy,client,lister,informer,conversion \ +bash "${CODEGEN_PKG}/generate-internal-groups.sh" deepcopy,client,lister,informer,conversion \ k8s.io/kube-aggregator/pkg/client k8s.io/kube-aggregator/pkg/apis k8s.io/kube-aggregator/pkg/apis \ "apiregistration:v1beta1,v1" \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ diff --git a/staging/src/k8s.io/metrics/hack/update-codegen.sh b/staging/src/k8s.io/metrics/hack/update-codegen.sh index 00995fa125b..4ac2ef726bc 100755 --- a/staging/src/k8s.io/metrics/hack/update-codegen.sh +++ b/staging/src/k8s.io/metrics/hack/update-codegen.sh @@ -28,12 +28,12 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code- # # we skip informers and listers for metrics, because we don't quite support the requisite operations yet # we skip generating the internal clientset as it's not really needed -"${CODEGEN_PKG}/generate-internal-groups.sh" deepcopy,conversion \ +bash "${CODEGEN_PKG}/generate-internal-groups.sh" deepcopy,conversion \ k8s.io/metrics/pkg/client k8s.io/metrics/pkg/apis k8s.io/metrics/pkg/apis \ "metrics:v1alpha1,v1beta1 custom_metrics:v1beta1 external_metrics:v1beta1" \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ --go-header-file "${SCRIPT_ROOT}/hack/boilerplate.go.txt" -"${CODEGEN_PKG}/generate-groups.sh" client \ +bash "${CODEGEN_PKG}/generate-groups.sh" client \ k8s.io/metrics/pkg/client k8s.io/metrics/pkg/apis \ "metrics:v1alpha1,v1beta1" \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ diff --git a/staging/src/k8s.io/node-api/hack/update-codegen.sh b/staging/src/k8s.io/node-api/hack/update-codegen.sh index 44c091269a6..fd30f467d7c 100755 --- a/staging/src/k8s.io/node-api/hack/update-codegen.sh +++ b/staging/src/k8s.io/node-api/hack/update-codegen.sh @@ -25,7 +25,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code- # --output-base because this script should also be able to run inside the vendor dir of # k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir # instead of the $GOPATH directly. For normal projects this can be dropped. -"${CODEGEN_PKG}/generate-groups.sh" "deepcopy,client,informer,lister" \ +bash "${CODEGEN_PKG}/generate-groups.sh" "deepcopy,client,informer,lister" \ k8s.io/node-api/pkg/client k8s.io/node-api/pkg/apis \ "node:v1alpha1" \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \ diff --git a/staging/src/k8s.io/sample-controller/hack/update-codegen.sh b/staging/src/k8s.io/sample-controller/hack/update-codegen.sh index 5562672b966..c5fb306cc12 100755 --- a/staging/src/k8s.io/sample-controller/hack/update-codegen.sh +++ b/staging/src/k8s.io/sample-controller/hack/update-codegen.sh @@ -25,7 +25,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code- # --output-base because this script should also be able to run inside the vendor dir of # k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir # instead of the $GOPATH directly. For normal projects this can be dropped. -"${CODEGEN_PKG}"/generate-groups.sh "deepcopy,client,informer,lister" \ +bash "${CODEGEN_PKG}"/generate-groups.sh "deepcopy,client,informer,lister" \ k8s.io/sample-controller/pkg/generated k8s.io/sample-controller/pkg/apis \ samplecontroller:v1alpha1 \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \