diff --git a/.github/workflows/bootstrap.yaml b/.github/workflows/bootstrap.yaml index 41d569a6..23942d47 100644 --- a/.github/workflows/bootstrap.yaml +++ b/.github/workflows/bootstrap.yaml @@ -30,7 +30,7 @@ jobs: uses: fluxcd/pkg//actions/kustomize@main - name: Build run: | - make build-manifests + make cmd/flux/manifests go build -o /tmp/flux ./cmd/flux - name: Set outputs id: vars diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8a911d12..0a920706 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -30,7 +30,7 @@ jobs: uses: fluxcd/pkg//actions/kustomize@main - name: Generate manifests run: | - make build-manifests + make cmd/flux/manifests ./manifests/scripts/bundle.sh ./output manifests.tar.gz kustomize build ./manifests/install > ./output/install.yaml - name: Run GoReleaser diff --git a/.github/workflows/scan.yaml b/.github/workflows/scan.yaml index b020c509..029a59a6 100644 --- a/.github/workflows/scan.yaml +++ b/.github/workflows/scan.yaml @@ -31,7 +31,7 @@ jobs: uses: fluxcd/pkg//actions/kustomize@main - name: Build manifests run: | - make build-manifests + make cmd/flux/manifests - name: Run Snyk to check for vulnerabilities uses: snyk/actions/golang@master continue-on-error: true diff --git a/Makefile b/Makefile index ed6333f3..b05f16c6 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ VERSION?=$(shell grep 'VERSION' cmd/flux/main.go | awk '{ print $$4 }' | tr -d '"') +EMBEDDED_MANIFESTS_TARGET=cmd/flux/manifests + +rwildcard=$(foreach d,$(wildcard $(addsuffix *,$(1))),$(call rwildcard,$(d)/,$(2)) $(filter $(subst *,%,$(2)),$(d))) all: test build @@ -11,13 +14,13 @@ fmt: vet: go vet ./... -test: build-manifests tidy fmt vet docs +test: $(EMBEDDED_MANIFESTS_TARGET) tidy fmt vet docs go test ./... -coverprofile cover.out -build-manifests: +$(EMBEDDED_MANIFESTS_TARGET): $(call rwildcard,manifests/,*.yaml *.json) ./manifests/scripts/bundle.sh -build: +build: $(EMBEDDED_MANIFESTS_TARGET) CGO_ENABLED=0 go build -o ./bin/flux ./cmd/flux install: @@ -25,7 +28,7 @@ install: .PHONY: docs docs: - rm docs/cmd/* + rm -rf docs/cmd/* mkdir -p ./docs/cmd && go run ./cmd/flux/ docgen install-dev: diff --git a/cmd/flux/embed.go b/cmd/flux/manifests.embed.go similarity index 100% rename from cmd/flux/embed.go rename to cmd/flux/manifests.embed.go