Skip to content

Commit 71e61dd

Browse files
authored
KUBESAW-273: Replace go-bindata with go:embed (codeready-toolchain#661)
* KUBESAW-201: Replace go-bindata with go:embed Signed-off-by: Feny Mehta <fbm3307@gmail.com> * some extra comitted files to be removed Signed-off-by: Feny Mehta <fbm3307@gmail.com> * CI happy Signed-off-by: Feny Mehta <fbm3307@gmail.com> * remove tools.go Signed-off-by: Feny Mehta <fbm3307@gmail.com> * review comments Signed-off-by: Feny Mehta <fbm3307@gmail.com> --------- Signed-off-by: Feny Mehta <fbm3307@gmail.com>
1 parent 762e05b commit 71e61dd

File tree

13 files changed

+18
-44
lines changed

13 files changed

+18
-44
lines changed

.github/workflows/ci-golang-sbom.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ jobs:
2222
with:
2323
go-version-file: go.mod
2424

25-
- name: Generate Assets
26-
run: |
27-
make generate-assets
28-
2925
- name: Lint
3026
uses: golangci/golangci-lint-action@v7
3127
with:

.github/workflows/govulncheck.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ jobs:
1818
with:
1919
go-version-file: go.mod
2020

21-
- name: Generate Assets
22-
run: |
23-
make generate-assets
24-
2521
- name: Run govulncheck
2622
uses: golang/govulncheck-action@v1
2723
with:

.github/workflows/test-with-coverage.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ jobs:
2626
uses: actions/setup-go@v5
2727
with:
2828
go-version-file: go.mod
29-
30-
- name: Generate Assets
31-
run: |
32-
make generate-assets
3329

3430
- name: Test
3531
run: |

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ out/
8383

8484
tmp/
8585

86-
# generated files
87-
*_assets.go
88-
8986
# generated by either kubebuilder or operator-sdk
9087
config/rbac/role.yaml
9188
bundle/

deploy/resources.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@ import "embed"
44

55
//go:embed templates/toolchaincluster/*
66
var ToolchainClusterTemplateFS embed.FS
7+
8+
//go:embed templates/autoscaler/*
9+
var AutoScalerFS embed.FS
10+
11+
//go:embed templates/webhook/*
12+
var WebhookFS embed.FS

deploy/autoscaler/member-operator-autoscaler.yaml renamed to deploy/templates/autoscaler/member-operator-autoscaler.yaml

File renamed without changes.
File renamed without changes.

make/get-tool.mk

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
# see go.mod
22
CONTROLLER_GEN_VERSION=v0.15.0
33
KUSTOMIZE_VERSION=v5.4.2
4-
GO_BINDATA_VERSION=v3.1.2
54

65
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
76
controller-gen: ## Download controller-gen locally if necessary.
87
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,${CONTROLLER_GEN_VERSION})
98

10-
GO_BINDATA = $(shell pwd)/bin/go-bindata
11-
go-bindata: ## Download go-bindata locally if necessary.
12-
$(call go-get-tool,$(GO_BINDATA),github.com/go-bindata/go-bindata/go-bindata,${GO_BINDATA_VERSION})
13-
149
KUSTOMIZE = $(shell pwd)/bin/kustomize
1510
kustomize: ## Download kustomize locally if necessary.
1611
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION))

make/go.mk

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ goarch ?= $(shell go env GOARCH)
99

1010
.PHONY: build
1111
## Build the operator
12-
build: generate-assets $(OUT_DIR)/operator
12+
build: $(OUT_DIR)/operator
1313

1414
$(OUT_DIR)/operator:
1515
$(Q)CGO_ENABLED=0 GOARCH=${goarch} GOOS=linux \
@@ -27,15 +27,6 @@ $(OUT_DIR)/operator:
2727
vendor:
2828
$(Q)go mod vendor
2929

30-
.PHONY: generate-assets
31-
generate-assets: go-bindata
32-
@echo "generating webhooks template data..."
33-
@rm ./pkg/webhook/deploy/webhooks/template_assets.go 2>/dev/null || true
34-
@$(GO_BINDATA) -pkg webhooks -o ./pkg/webhook/deploy/webhooks/template_assets.go -nocompress -prefix deploy/webhook deploy/webhook
35-
@echo "generating autoscaler buffer template data..."
36-
@rm ./pkg/autoscaler/template_assets.go 2>/dev/null || true
37-
@$(GO_BINDATA) -pkg autoscaler -o ./pkg/autoscaler/template_assets.go -nocompress -prefix deploy/autoscaler deploy/autoscaler
38-
3930
.PHONY: verify-dependencies
4031
## Runs commands to verify after the updated dependecies of toolchain-common/API(go mod replace), if the repo needs any changes to be made
4132
verify-dependencies: tidy vet build test lint-go-code
@@ -48,6 +39,9 @@ tidy:
4839
vet:
4940
go vet ./...
5041

42+
.PHONY: generate-assets
43+
generate-assets:
44+
5145
.PHONY: pre-verify
52-
pre-verify: generate-assets
46+
pre-verify:
5347
echo "Pre-requisite completed"

make/test.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
.PHONY: test
88
## runs the tests without coverage and excluding E2E tests
9-
test: generate-assets
9+
test:
1010
@echo "running the tests without coverage and excluding E2E tests..."
1111
$(Q)go test ${V_FLAG} -race $(shell go list ./... | grep -v /test/e2e) -failfast
1212

@@ -21,7 +21,7 @@ COV_DIR = $(OUT_DIR)/coverage
2121

2222
.PHONY: test-with-coverage
2323
## runs the tests with coverage
24-
test-with-coverage: generate-assets
24+
test-with-coverage:
2525
@echo "running the tests with coverage..."
2626
@-mkdir -p $(COV_DIR)
2727
@-rm $(COV_DIR)/coverage.txt

0 commit comments

Comments
 (0)