Skip to content

Commit 87b01ae

Browse files
doc(doc/dev/developer_guide): adding steps over how to test the changes made locally (#2650)
1 parent 8f13bfc commit 87b01ae

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

doc/dev/developer_guide.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This document explains how to setup your dev environment.
99
## Download Operator SDK
1010

1111
Go to the [Operator SDK repo][repo-sdk] and follow the [fork guide][fork-guide] to fork, clone, and setup the local operator-sdk repository.
12+
1213
## Build the Operator SDK CLI
1314

1415
Build the Operator SDK CLI `operator-sdk` binary:
@@ -17,6 +18,8 @@ Build the Operator SDK CLI `operator-sdk` binary:
1718
$ make install
1819
```
1920

21+
Then, now you are able to test and use the operator-sdk build using the source code.
22+
2023
## Testing
2124

2225
The SDK includes many tests that are run as part of CI.
@@ -36,6 +39,79 @@ $ make test
3639
For more information on running testing and correctly configuring your environment,
3740
refer to the [`Running the Tests Locally`][running-the-tests] document.
3841

42+
To run the lint checks done in the CI locally, run:
43+
44+
```sh
45+
$ make lint
46+
```
47+
48+
**NOTE** Note that for it is required to install `golangci-lint` locally. For more info see its [doc](https://github.com/golangci/golangci-lint#install)
49+
50+
## How to test the changes done for Ansible/Helm based-operator projects?
51+
52+
If the change performed is NOT in the scaffold files or sdk commands then, is required to build an new image with the changes done to test it locally. In this way, by using this dev image in an operator project locally we will be able to check the changes made for the Ansible/Helm based-operator.
53+
54+
### For Ansible
55+
56+
- Update the `ANSIBLE_BASE_IMAGE` var in the [Makefile][makefile] to generate an image for your repository (quay.io or docker.hub.io). See:
57+
58+
Replace:
59+
60+
```
61+
quay.io/operator-framework/ansible-operator
62+
```
63+
64+
With (eg):
65+
66+
```
67+
quay.io/my-repo-user/ansible-operator
68+
```
69+
70+
- Build the image locally by running `make image-build-ansible`
71+
- Push your new image. (E.g `docker push quay.io/my-repo-user/ansible-operator:dev`)
72+
73+
**NOTE** Ensure that you configured the repo, `quay.io/my-repo-user/ansible-operator`, to be public.
74+
75+
- Update the `Dockerfile` of your POC project to test your changes with the new image as follows.
76+
77+
```
78+
FROM quay.io/my-repo-user/ansible-operator:dev
79+
80+
COPY watches.yaml ${HOME}/watches.yaml
81+
COPY roles/ ${HOME}/roles/
82+
```
83+
84+
### For Helm
85+
86+
87+
- Update the `HELM_BASE_IMAGE` var in the [Makefile][makefile] to generate an image for your repository (quay.io or docker.hub.io). See:
88+
89+
Replace:
90+
91+
```
92+
quay.io/operator-framework/helm-operator
93+
```
94+
95+
With (eg):
96+
97+
```
98+
quay.io/my-repo-user/helm-operator
99+
```
100+
101+
- Build the image locally by running `make image-build-helm`
102+
- Push your new image. (E.g `docker push quay.io/my-repo-user/helm-operator:dev`)
103+
104+
**NOTE** Ensure that you configured the repo, `quay.io/my-repo-user/helm-operator`, to be public.
105+
106+
- Update the `Dockerfile` of your POC project to test your changes with the new image as follows.
107+
108+
```
109+
FROM quay.io/my-repo-user/helm-operator:dev
110+
111+
COPY watches.yaml ${HOME}/watches.yaml
112+
COPY helm-charts/ ${HOME}/helm-charts/
113+
```
114+
39115
See the project [README][sdk-readme] for more details.
40116

41117
[git-tool]:https://git-scm.com/downloads
@@ -46,3 +122,4 @@ See the project [README][sdk-readme] for more details.
46122
[kubectl-tool]:https://kubernetes.io/docs/tasks/tools/install-kubectl/
47123
[sdk-readme]:../../README.md
48124
[running-the-tests]: ./testing/running-the-tests.md
125+
[makefile]:../../Makefile

0 commit comments

Comments
 (0)