Skip to content

Commit ecc7178

Browse files
authored
Merge pull request #38 from fluxcd/api-kg
Make the api package a dedicated module
2 parents ae8533d + 1e6843d commit ecc7178

File tree

5 files changed

+470
-5
lines changed

5 files changed

+470
-5
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ FROM golang:1.14-alpine as builder
22

33
WORKDIR /workspace
44

5+
# copy api submodule
6+
COPY api/ api/
7+
58
# copy modules manifests
69
COPY go.mod go.mod
710
COPY go.sum go.sum
@@ -11,7 +14,6 @@ RUN go mod download
1114

1215
# copy source code
1316
COPY main.go main.go
14-
COPY api/ api/
1517
COPY controllers/ controllers/
1618
COPY internal/ internal/
1719

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ all: manager
1414

1515
# Run tests
1616
test: generate fmt vet manifests api-docs
17-
go test ./... -coverprofile cover.out
17+
find . -maxdepth 2 -type f -name 'go.mod' -execdir go test ./... -coverprofile cover.out \;
1818

1919
# Build manager binary
2020
manager: generate fmt vet
@@ -53,19 +53,20 @@ dev-cleanup: manifests
5353

5454
# Generate manifests e.g. CRD, RBAC etc.
5555
manifests: controller-gen
56-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role paths="./..." output:crd:artifacts:config=config/crd/bases
56+
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role paths="./..." output:crd:artifacts:config="config/crd/bases"
57+
cd api; $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role paths="./..." output:crd:artifacts:config="../config/crd/bases"
5758

5859
# Generate API reference documentation
5960
api-docs: gen-crd-api-reference-docs
6061
$(API_REF_GEN) -api-dir=./api/v1alpha1 -config=./hack/api-docs/config.json -template-dir=./hack/api-docs/template -out-file=./docs/api/notification.md
6162

6263
# Run go fmt against code
6364
fmt:
64-
go fmt ./...
65+
find . -maxdepth 2 -type f -name 'go.mod' -execdir go fmt ./... \;
6566

6667
# Run go vet against code
6768
vet:
68-
go vet ./...
69+
find . -maxdepth 2 -type f -name 'go.mod' -execdir go vet ./... \;
6970

7071
# Generate code
7172
generate: controller-gen

api/go.mod

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module github.com/fluxcd/notification-controller/api
2+
3+
go 1.14
4+
5+
require (
6+
k8s.io/api v0.18.8
7+
k8s.io/apimachinery v0.18.8
8+
sigs.k8s.io/controller-runtime v0.6.2
9+
)

0 commit comments

Comments
 (0)