Skip to content

Support package refactor #1

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
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
38 changes: 38 additions & 0 deletions .github/workflows/verify_generated_files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Verify Generated Files and Import Organization
on:
push:
branches:
- '**'
paths:
- '**.go'
- '**go.mod'
- '**go.sum'
tags-ignore:
- 'v*'
pull_request:
paths:
- '**.go'
- '**go.mod'
- '**go.sum'
jobs:
verify-imports:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Go
uses: actions/setup-go@v3
with:
go-version: v1.19
- name: Verify that imports are organized
run: make verify-imports

verify-manifests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Go
uses: actions/setup-go@v3
with:
go-version: v1.19
- name: Verify that the latest WebhookConfigurations, ClusterRoles, and CustomResourceDefinitions have been generated
run: make manifests && git diff --exit-code
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*.dll
*.so
*.dylib
bin

# Test binary, built with `go test -c`
*.test
Expand Down
67 changes: 67 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# CODEFLARE_SDK_VERSION defines the default version of the CodeFlare SDK
CODEFLARE_SDK_VERSION ?= 0.9.0

# RAY_VERSION defines the default version of Ray (used for testing)
RAY_VERSION ?= 2.5.0

# RAY_IMAGE defines the default container image for Ray (used for testing)
RAY_IMAGE ?= rayproject/ray:$(RAY_VERSION)

##@ Development

DEFAULTS_TEST_FILE := support/defaults.go

.PHONY: defaults
defaults:
$(info Regenerating $(DEFAULTS_TEST_FILE))
@echo "package support" > $(DEFAULTS_TEST_FILE)
@echo "" >> $(DEFAULTS_TEST_FILE)
@echo "// ***********************" >> $(DEFAULTS_TEST_FILE)
@echo "// DO NOT EDIT THIS FILE" >> $(DEFAULTS_TEST_FILE)
@echo "// ***********************" >> $(DEFAULTS_TEST_FILE)
@echo "" >> $(DEFAULTS_TEST_FILE)
@echo "const (" >> $(DEFAULTS_TEST_FILE)
@echo " CodeFlareSDKVersion = \"$(CODEFLARE_SDK_VERSION)\"" >> $(DEFAULTS_TEST_FILE)
@echo " RayVersion = \"$(RAY_VERSION)\"" >> $(DEFAULTS_TEST_FILE)
@echo " RayImage = \"$(RAY_IMAGE)\"" >> $(DEFAULTS_TEST_FILE)
@echo "" >> $(DEFAULTS_TEST_FILE)
@echo ")" >> $(DEFAULTS_TEST_FILE)
@echo "" >> $(DEFAULTS_TEST_FILE)

gofmt -w $(DEFAULTS_TEST_FILE)

## Tool Binaries
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen

## Tool Versions
CONTROLLER_TOOLS_VERSION ?= v0.9.2


## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)

OPENSHIFT-GOIMPORTS ?= $(LOCALBIN)/openshift-goimports

.PHONY: openshift-goimports
openshift-goimports: $(OPENSHIFT-GOIMPORTS) ## Download openshift-goimports locally if necessary.
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should bring the corresponding GH actions workflows there too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

verify_generated_files workflow added.

$(OPENSHIFT-GOIMPORTS): $(LOCALBIN)
test -s $(LOCALBIN)/openshift-goimports || GOBIN=$(LOCALBIN) go install github.com/openshift-eng/openshift-goimports@latest

.PHONY: imports
imports: openshift-goimports ## Organize imports in go files using openshift-goimports. Example: make imports
$(OPENSHIFT-GOIMPORTS)

.PHONY: verify-imports
verify-imports: openshift-goimports ## Run import verifications.
./hack/verify-imports.sh $(OPENSHIFT-GOIMPORTS)

.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)

.PHONY: manifests
manifests: controller-gen ## Generate RBAC objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role webhook paths="./..."
69 changes: 69 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
module github.com/project-codeflare/codeflare-common

go 1.19

require (
github.com/onsi/gomega v1.28.0
github.com/openshift-online/ocm-sdk-go v0.1.373
github.com/openshift/api v0.0.0-20231012181603-8f468d7b55a8
github.com/openshift/client-go v0.0.0-20231005121823-e81400b97c46
github.com/project-codeflare/multi-cluster-app-dispatcher v1.36.0
github.com/ray-project/kuberay/ray-operator v0.0.0-20231013074931-1184bc872c08
k8s.io/api v0.28.2
k8s.io/apimachinery v0.28.2
k8s.io/client-go v0.28.2
)

require (
github.com/aymerick/douceur v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.4.1 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
github.com/microcosm-cc/bluemonday v1.0.18 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
k8s.io/utils v0.0.0-20230505201702-9f6742963106 // indirect
sigs.k8s.io/controller-runtime v0.11.1 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading