Skip to content

Commit 0479540

Browse files
authored
chore: use workspaces to make api changes easier (#635)
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
1 parent 2c39428 commit 0479540

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

.github/workflows/pr-checks.yml

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ jobs:
4444
- name: Checkout repository
4545
uses: actions/checkout@v4
4646

47+
- name: Workspace Init
48+
run: make workspace-init
49+
4750
- name: Unit Test
4851
run: make unit-test
4952

.github/workflows/release-please.yml

+1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ jobs:
122122
with:
123123
go-version: ${{ env.DEFAULT_GO_VERSION }}
124124
- run: |
125+
make workspace-init
125126
go mod tidy
126127
make controller-gen
127128
IMG=ghcr.io/open-feature/open-feature-operator:${{ needs.release-please.outputs.release_tag_name }} make helm-package

Dockerfile

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ WORKDIR /workspace
55
# Copy the Go Modules manifests
66
COPY go.mod go.mod
77
COPY go.sum go.sum
8-
# cache deps before building and copying source so that we don't need to re-download as much
9-
# and so that source changes don't invalidate our downloaded layer
10-
RUN go mod download
118

129
# Copy the go source
1310
COPY main.go main.go
@@ -16,6 +13,10 @@ COPY webhooks/ webhooks/
1613
COPY controllers/ controllers/
1714
COPY common/ common/
1815

16+
# cache deps before building and copying source so that we don't need to re-download as much
17+
# and so that source changes don't invalidate our downloaded layer
18+
RUN go work init . ./apis && go mod download
19+
1920
ARG TARGETOS
2021
ARG TARGETARCH
2122

Makefile

+12
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ CHART_VERSION=v0.5.4# x-release-please-version
1111
ENVTEST_K8S_VERSION = 1.26.1
1212
WAIT_TIMEOUT_SECONDS?=60
1313

14+
ALL_GO_MOD_DIRS := $(shell find . -type f -name 'go.mod' -exec dirname {} \; | sort)
15+
1416
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
1517
ifeq (,$(shell go env GOBIN))
1618
GOBIN=$(shell go env GOPATH)/bin
@@ -256,3 +258,13 @@ install-mockgen:
256258
go install github.com/golang/mock/mockgen@v1.6.0
257259
mockgen: install-mockgen
258260
mockgen -source=controllers/common/flagd-injector.go -destination=controllers/common/mock/flagd-injector.go -package=commonmock
261+
262+
workspace-init: workspace-clean
263+
go work init
264+
$(foreach module, $(ALL_GO_MOD_DIRS), go work use $(module);)
265+
266+
workspace-update:
267+
$(foreach module, $(ALL_GO_MOD_DIRS), go work use $(module);)
268+
269+
workspace-clean:
270+
rm -rf go.work

0 commit comments

Comments
 (0)