Skip to content

Commit

Permalink
Add make targets for local builds (aws-controllers-k8s#297)
Browse files Browse the repository at this point in the history
Description of changes:
Adds a `go.local.mod`, and make targets using the new file, to more easily reference the local runtime package. Developers are now able to run `make local-build-ack-generate` to build and test changes to `code-generator` when updating `runtime`. 

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
RedbackThomson authored Mar 7, 2022
1 parent ade2429 commit a0a7fbd
Show file tree
Hide file tree
Showing 3 changed files with 1,363 additions and 5 deletions.
22 changes: 17 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,23 @@ GO_LDFLAGS=-ldflags "-X $(IMPORT_PATH)/pkg/version.Version=$(VERSION) \

# We need to use the codegen tag when building and testing because the
# aws-sdk-go/private/model/api package is gated behind a build tag "codegen"...
GO_TAGS=-tags codegen
GO_CMD_FLAGS=-tags codegen
GO_CMD_LOCAL_FLAGS=-modfile=go.local.mod $(GO_CMD_FLAGS)

.PHONY: all build-ack-generate build-controller test \
build-controller-image local-build-controller-image
.PHONY: all local-build-ack-generate build-ack-generate local-build-controller \
build-controller test local-test build-controller-image \
local-build-controller-image

all: test

build-ack-generate: ## Build ack-generate binary
@echo -n "building ack-generate ... "
@go build ${GO_TAGS} ${GO_LDFLAGS} -o bin/ack-generate cmd/ack-generate/main.go
@go build ${GO_CMD_FLAGS} ${GO_LDFLAGS} -o bin/ack-generate cmd/ack-generate/main.go
@echo "ok."

local-build-ack-generate: ## Build ack-generate binary using the local go.mod
@echo -n "building ack-generate ... "
@go build ${GO_CMD_LOCAL_FLAGS} ${GO_LDFLAGS} -o bin/ack-generate cmd/ack-generate/main.go
@echo "ok."

build-controller: build-ack-generate ## Generate controller code for SERVICE
Expand All @@ -35,6 +42,8 @@ build-controller: build-ack-generate ## Generate controller code for SERVICE
@echo "==== building $(AWS_SERVICE)-controller release artifacts ===="
@./scripts/build-controller-release.sh $(AWS_SERVICE)

local-build-controller: local-build-ack-generate build-controller ## Generate controller code for SERVICE using the local go.mod

build-controller-image: export LOCAL_MODULES = false
build-controller-image: ## Build container image for SERVICE
@./scripts/build-controller-image.sh $(AWS_SERVICE)
Expand All @@ -47,7 +56,10 @@ check-versions: ## Checks the code-generator version matches the runtime depende
@./scripts/check-versions.sh $(VERSION)

test: ## Run code tests
go test ${GO_TAGS} ./...
go test ${GO_CMD_FLAGS} ./...

local-test: ## Run code tests using the local go.mod
go test ${GO_CMD_LOCAL_FLAGS} ./...

help: ## Show this help.
@grep -F -h "##" $(MAKEFILE_LIST) | grep -F -v grep | sed -e 's/\\$$//' \
Expand Down
92 changes: 92 additions & 0 deletions go.local.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
module github.com/aws-controllers-k8s/code-generator

go 1.17

replace github.com/aws-controllers-k8s/runtime => ../runtime

require (
github.com/aws-controllers-k8s/runtime v0.16.4
github.com/aws/aws-sdk-go v1.42.0
github.com/dlclark/regexp2 v1.4.0
// pin to v0.1.1 due to release problem with v0.1.2
github.com/gertd/go-pluralize v0.1.1
github.com/ghodss/yaml v1.0.0
github.com/go-logr/logr v1.2.0
github.com/iancoleman/strcase v0.1.3
github.com/operator-framework/api v0.6.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.2.1
github.com/stretchr/testify v1.7.0
golang.org/x/mod v0.4.2
gopkg.in/src-d/go-git.v4 v4.13.1
k8s.io/apimachinery v0.23.0
sigs.k8s.io/controller-runtime v0.11.0
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-logr/zapr v1.2.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jaypipes/envutil v1.0.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.11.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.28.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/sergi/go-diff v1.0.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/src-d/gcfg v1.4.0 // indirect
github.com/xanzy/ssh-agent v0.2.1 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.1 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/net v0.0.0-20210825183410-e898025ed96a // indirect
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8 // indirect
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/api v0.23.0 // indirect
k8s.io/apiextensions-apiserver v0.23.0 // indirect
k8s.io/client-go v0.23.0 // indirect
k8s.io/component-base v0.23.0 // indirect
k8s.io/klog/v2 v2.30.0 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit a0a7fbd

Please sign in to comment.