@@ -73,11 +73,12 @@ Each commit message doesn't have to follow conventions as long as it is clear an
73
73
Note: Some of our tests performs integration testing by starting a local
74
74
control plane using
75
75
[ envtest] ( https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/envtest ) .
76
- If you only run test using the Makefile
77
- (` m̀ake test` ), no additional installation is required. But if you want to
76
+ If you only run test using the Magefile
77
+ (` mage test:unit ` ), no additional installation is required. But if you want to
78
78
run some of these integration tests using ` go test ` or from your IDE, you'll
79
79
have to
80
80
[ install kubebuiler-tools] ( https://book.kubebuilder.io/reference/envtest.html#installation ) .
81
+ [ install magefile] ( https://magefile.org ) or use ` go run mage.go <goal> `
81
82
82
83
## Build Binaries
83
84
@@ -88,21 +89,21 @@ have to
88
89
To build all Trivy-operator binary, run:
89
90
90
91
```
91
- make
92
+ mage build:all
92
93
```
93
94
94
95
This uses the ` go build ` command and builds binaries in the ` ./bin ` directory.
95
96
96
97
To build all Trivy-operator binary into Docker images, run:
97
98
98
99
```
99
- make docker- build
100
+ mage build:docker
100
101
```
101
102
102
103
To load Docker images into your KIND cluster, run:
103
104
104
105
```
105
- kind load docker-image aquasecurity/trivy-operator:dev
106
+ mage build:kindloadimages
106
107
```
107
108
108
109
## Testing
@@ -116,7 +117,7 @@ collaborators, more coarse grained integration tests might be required.
116
117
To run all tests with code coverage enabled, run:
117
118
118
119
```
119
- make test
120
+ mage test:unit
120
121
```
121
122
122
123
To open the test coverage report in your web browser, run:
@@ -130,7 +131,7 @@ go tool cover -html=coverage.txt
130
131
The operator envtest spin us partial k8s components (api-server, etcd) and test controllers for reousce, workload, ttl, rbac and more
131
132
132
133
```
133
- make envtest
134
+ mage test: envtest
134
135
```
135
136
136
137
### Run Integration Tests
@@ -155,7 +156,7 @@ To run the integration tests for Trivy-operator Operator and view the coverage r
155
156
OPERATOR_NAMESPACE=trivy-system \
156
157
OPERATOR_TARGET_NAMESPACES=default \
157
158
OPERATOR_LOG_DEV_MODE=true \
158
- make itests-trivy-operator
159
+ mage test:integration
159
160
go tool cover -html=itest/trivy-operator/coverage.txt
160
161
```
161
162
@@ -217,11 +218,11 @@ We currently generate:
217
218
- Mandatory DeepCopy functions for a Go struct representing a CRD
218
219
219
220
This means that you should not try to modify any of these files directly, but instead change
220
- the code and code markers. Our Makefile contains a target to ensure that all generated files
221
+ the code and code markers. Our MageFile contains a target to ensure that all generated files
221
222
are up-to-date: So after doing modifications in code, affecting CRDs/ClusterRole, you should
222
- run ` make generate- all` to regenerate everything.
223
+ run ` mage generate: all` to regenerate everything.
223
224
224
- Our CI will verify that all generated is up-to-date by running ` make verify-generated ` .
225
+ Our CI will verify that all generated is up-to-date by running ` mage generate: verify` .
225
226
226
227
Any change to the CRD structs, including nested structs, will probably modify the CRD.
227
228
This is also true for Go docs, as field/type doc becomes descriptions in CRDs.
@@ -248,7 +249,7 @@ basic development workflow. For other install modes see [Operator Multitenancy w
248
249
1 . Build the operator binary into the Docker image and load it from your host into KIND cluster nodes:
249
250
250
251
```
251
- make docker- build-trivy-operator && kind load docker-image aquasecurity/trivy-operator:dev
252
+ mage build:docker && kind load docker-image aquasecurity/trivy-operator:dev
252
253
```
253
254
254
255
2 . Create the ` trivy-operator ` Deployment in the ` trivy-system ` namespace to run the operator's container:
@@ -318,7 +319,7 @@ To avoid maintaining resources in multiple places, we have a created a script
318
319
to (re)generate the static resources from the Helm chart.
319
320
320
321
So if modifying the operator resources, please do so by modifying the Helm
321
- chart, then run ` make manifests` to ensure the static
322
+ chart, then run ` mage generate: manifests` to ensure the static
322
323
resources are up-to-date.
323
324
324
325
## Update helm docs
@@ -328,7 +329,7 @@ Since some prefer to not use Helm, we also provide helm config documentation to
328
329
install the operator.
329
330
330
331
So if modifying the operator helm params, please do so by modifying the Helm
331
- chart, then run ` make generate-helm- docs` to ensure the helm docs are up-to-date.
332
+ chart, then run ` mage generate: docs` to ensure the helm docs are up-to-date.
332
333
333
334
## Operator Lifecycle Manager (OLM)
334
335
0 commit comments