Skip to content

Add CI check that generated files are up-to-date #246

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

Merged
merged 2 commits into from
Jan 15, 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
13 changes: 13 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ jobs:
echo "not well formatted sources are found"
exit 1
fi
-
name: Check manifests
run: |
git reset HEAD --hard
pip install yq
# Note: fmt is necessary after generate since generated sources will
# fail format check by default.
make generate fmt manifests
Copy link
Member

Choose a reason for hiding this comment

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

it fails with Error patching crds: yq is required

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah bummer. That's probably why we didn't include it it in the first place.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added pip install yq and it seems to work without problems

if [[ ! -z $(git status -s) ]]
then
echo "generated sources are not up to date"
exit 1
fi
-
name: Run Go Tests
run: |
Expand Down
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ PLATFORM := kubernetes
endif

# minikube handling
ifeq ($(shell $(K8S_CLI) config current-context),minikube)
ifeq ($(shell $(K8S_CLI) config current-context 2>&1),minikube)
export ROUTING_SUFFIX := $(shell minikube ip).nip.io
endif

Expand Down Expand Up @@ -340,6 +340,18 @@ KUSTOMIZE=$(shell which kustomize)
endif

_operator_sdk:
@{ \
if ! command -v operator-sdk &> /dev/null; then \
echo 'operator-sdk $(OPERATOR_SDK_VERSION) is expected to be used for this target but it is not installed' ;\
exit 1 ;\
else \
SDK_VER=$$(operator-sdk version | cut -d , -f 1 | cut -d : -f 2 | cut -d \" -f 2) && \
if [ "$${SDK_VER}" != $(OPERATOR_SDK_VERSION) ]; then \
echo "WARN: operator-sdk $(OPERATOR_SDK_VERSION) is expected to be used for this target but $${SDK_VER} found"
echo "WARN: Please use the recommended operator-sdk if you face any issue"
fi \
fi \
}
ifneq ($(shell operator-sdk version | cut -d , -f 1 | cut -d : -f 2 | cut -d \" -f 2),$(OPERATOR_SDK_VERSION))
@echo 'WARN: operator-sdk $(OPERATOR_SDK_VERSION) is expected to be used for this target but $(shell operator-sdk version | cut -d , -f 1 | cut -d : -f 2 | cut -d \" -f 2) found.'
@echo 'WARN: Please use the recommended operator-sdk if you face any issue.'
Expand Down
2 changes: 1 addition & 1 deletion controllers/workspace/devworkspace_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type DevWorkspaceReconciler struct {
/////// Required permissions for controller
// +kubebuilder:rbac:groups=apps;extensions,resources=deployments;replicasets,verbs=*
// +kubebuilder:rbac:groups="",resources=pods;serviceaccounts;secrets;configmaps;persistentvolumeclaims,verbs=*
// +kubebuilder:rbac:groups="",resources=namespaces,verbs=get
// +kubebuilder:rbac:groups="",resources=namespaces,verbs=get;list;watch
// +kubebuilder:rbac:groups="batch",resources=jobs,verbs=get;create;list;watch;update;patch;delete
// +kubebuilder:rbac:groups=admissionregistration.k8s.io,resources=mutatingwebhookconfigurations;validatingwebhookconfigurations,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=rbac.authorization.k8s.io,resources=roles;rolebindings;clusterroles;clusterrolebindings,verbs=get;list;watch;create;update
Expand Down