Skip to content
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
14 changes: 9 additions & 5 deletions Dockerfile.local
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,22 @@ ENV VERSION_PKG=github.com/aws-controllers-k8s/$service_alias-controller/pkg/ver
# Copy the Go Modules manifests and LICENSE/ATTRIBUTION
COPY $service_alias-controller/LICENSE $work_dir/LICENSE
COPY $service_alias-controller/ATTRIBUTION.md $work_dir/ATTRIBUTION.md
# use local mod files
COPY $service_alias-controller/go.local.mod $work_dir/go.local.mod
COPY $service_alias-controller/go.local.sum $work_dir/go.local.sum
# Copy the go.mod and go.sum files for the service controller
COPY $service_alias-controller/go.mod $work_dir/go.mod
COPY $service_alias-controller/go.sum $work_dir/go.sum

# for local development, copy local runtime repo
# Copy local runtime code to the container
COPY runtime/pkg $work_dir/../runtime/pkg
COPY runtime/apis $work_dir/../runtime/apis
COPY runtime/go.mod $work_dir/../runtime/go.mod
COPY runtime/go.sum $work_dir/../runtime/go.sum

# Replace the runtime module with the local runtime code
RUN echo "replace github.com/aws-controllers-k8s/runtime => ../runtime" >> $work_dir/go.mod

# TODO: Add a mechanism to inject more replacements for the go.mod file.
# For now we don't have any real use case for this.

# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
WORKDIR $work_dir/../runtime
Expand All @@ -58,7 +63,6 @@ RUN GIT_VERSION=$service_controller_git_version && \
go build -ldflags="-X ${VERSION_PKG}.GitVersion=${GIT_VERSION} \
-X ${VERSION_PKG}.GitCommit=${GIT_COMMIT} \
-X ${VERSION_PKG}.BuildDate=${BUILD_DATE}" \
-modfile="${work_dir}/go.local.mod" \
-a -o $work_dir/bin/controller $work_dir/cmd/controller/main.go

FROM $base_image
Expand Down
15 changes: 2 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ 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_CMD_FLAGS=-tags codegen
GO_CMD_LOCAL_FLAGS=-modfile=go.local.mod $(GO_CMD_FLAGS)

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

all: test
Expand All @@ -30,20 +29,13 @@ build-ack-generate: ## Build ack-generate binary
@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
@./scripts/install-controller-gen.sh
@echo "==== building $(AWS_SERVICE)-controller ===="
@./scripts/build-controller.sh $(AWS_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 @@ -55,9 +47,6 @@ local-build-controller-image: ## Build container image for SERVICE allowing loca
test: ## Run code tests
go test ${GO_CMD_FLAGS} ./...

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

lint-shell: ## Run linters against all of the bash scripts
@find . -type f -name "*.sh" | xargs shellcheck -e SC1091

Expand Down
92 changes: 0 additions & 92 deletions go.local.mod

This file was deleted.

Loading