Skip to content

Commit b732c7d

Browse files
niladrihKiran Mova
authored andcommitted
Changes based on comments
Signed-off-by: Niladri Halder <[email protected]>
1 parent 278116b commit b732c7d

File tree

1 file changed

+196
-0
lines changed

1 file changed

+196
-0
lines changed

docs/developer.md

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
# Development Workflow
2+
3+
## Table of contents
4+
5+
- [Prerequisites](#prerequisites)
6+
- [Initial Setup](#initial-setup)
7+
- [Development](#development)
8+
- [Dependencies](#dependencies)
9+
- [Submitting Your Changes](#submitting-your-changes)
10+
11+
## Prerequisites
12+
13+
* You have Go 1.14.7+ installed on your local host/development machine.
14+
* You have Docker installed on your local host/development machine. Docker is required for building dynamic-localpv-provisioner container images and to push them into a Kubernetes cluster for testing.
15+
16+
## Initial Setup
17+
18+
### Fork in the cloud
19+
20+
1. Visit https://github.com/openebs/dynamic-localpv-provisioner.
21+
2. Click `Fork` button (top right) to establish a cloud-based fork.
22+
23+
### Clone fork to local host
24+
25+
Place 'openebs/dynamic-localpv-provisioner' code in any directory the following cloning procedure.
26+
Create your clone:
27+
28+
```sh
29+
30+
mkdir path/to/directory/openebs
31+
cd openebs
32+
33+
# Note: Here $user is your GitHub profile name
34+
git clone https://github.com/$user/dynamic-localpv-provisioner.git
35+
36+
# Configure remote upstream
37+
cd path/to/directory/openebs/dynamic-localpv-provisioner
38+
git remote add upstream https://github.com/openebs/dynamic-localpv-provisioner.git
39+
40+
# Never push to upstream develop
41+
git remote set-url --push upstream no_push
42+
43+
# Confirm that your remotes make sense
44+
git remote -v
45+
```
46+
47+
## Development
48+
49+
### Always sync your local repository
50+
51+
Open a terminal on your local host. Change directory to the dynamic-localpv-provisioner-fork root.
52+
53+
```sh
54+
55+
$ cd path/to/directory/openebs/dynamic-localpv-provisioner.git
56+
```
57+
58+
Checkout the develop branch.
59+
60+
```sh
61+
$ git checkout develop
62+
Switched to branch 'develop'
63+
Your branch is up-to-date with 'origin/develop'.
64+
```
65+
66+
Recall that origin/develop is a branch on your remote GitHub repository.
67+
Make sure you have the upstream remote openebs/dynamic-localpv-provisioner by listing them.
68+
69+
```sh
70+
$ git remote -v
71+
origin https://github.com/$user/dynamic-localpv-provisioner.git (fetch)
72+
origin https://github.com/$user/dynamic-localpv-provisioner.git (push)
73+
upstream https://github.com/openebs/dynamic-localpv-provisioner.git (fetch)
74+
upstream no_push (push)
75+
```
76+
77+
If the upstream is missing, add it by using below command.
78+
79+
```sh
80+
$ git remote add upstream https://github.com/openebs/dynamic-localpv-provisioner.git
81+
```
82+
83+
Fetch all the changes from the upstream develop branch.
84+
85+
```sh
86+
$ git fetch upstream develop
87+
remote: Counting objects: 141, done.
88+
remote: Compressing objects: 100% (29/29), done.
89+
remote: Total 141 (delta 52), reused 46 (delta 46), pack-reused 66
90+
Receiving objects: 100% (141/141), 112.43 KiB | 0 bytes/s, done.
91+
Resolving deltas: 100% (79/79), done.
92+
From github.com:openebs/dynamic-localpv-provisioner
93+
* branch develop -> FETCH_HEAD
94+
```
95+
96+
Rebase your local develop with the upstream/develop.
97+
98+
```sh
99+
$ git rebase upstream/develop
100+
First, rewinding head to replay your work on top of it...
101+
Fast-forwarded develop to upstream/develop.
102+
```
103+
104+
This command applies all the commits from the upstream develop to your local develop.
105+
106+
Check the status of your local branch.
107+
108+
```sh
109+
$ git status
110+
On branch develop
111+
Your branch is ahead of 'origin/develop' by 38 commits.
112+
(use "git push" to publish your local commits)
113+
nothing to commit, working directory clean
114+
```
115+
116+
Your local repository now has all the changes from the upstream remote. You need to push the changes to your own remote fork which is origin develop.
117+
118+
Push the rebased develop to origin develop.
119+
120+
```sh
121+
$ git push origin develop
122+
Username for 'https://github.com': $user
123+
Password for 'https://[email protected]':
124+
Counting objects: 223, done.
125+
Compressing objects: 100% (38/38), done.
126+
Writing objects: 100% (69/69), 8.76 KiB | 0 bytes/s, done.
127+
Total 69 (delta 53), reused 47 (delta 31)
128+
To https://github.com/$user/dynamic-localpv-provisioner.git
129+
8e107a9..5035fa1 develop -> develop
130+
```
131+
132+
### Create a new feature branch to work on your issue
133+
134+
Your branch name should have the format XX-descriptive where XX is the issue number you are working on followed by some descriptive text. For example:
135+
136+
```sh
137+
$ git checkout -b 1234-fix-developer-docs
138+
Switched to a new branch '1234-fix-developer-docs'
139+
```
140+
141+
### Make your changes and build them
142+
143+
To build the provisioner for development:
144+
145+
```sh
146+
147+
cd path/to/directory/openebs/dynamic-localpv-provisioner
148+
make provisioner-localpv
149+
```
150+
151+
and to build and test image:
152+
153+
```sh
154+
155+
cd path/to/directory/openebs/dynamic-localpv-provisioner
156+
make provisioner-localpv-image
157+
```
158+
159+
### Test your changes
160+
161+
```sh
162+
cd path/to/directory/openebs/dynamic-localpv-provisioner
163+
164+
# Run every unit test
165+
make test
166+
```
167+
168+
### Keep your branch in sync
169+
170+
[Rebasing](https://git-scm.com/docs/git-rebase) is very important to keep your branch in sync with the changes being made by others and to avoid huge merge conflicts while raising your Pull Requests. You will always have to rebase before raising the PR.
171+
172+
```sh
173+
# While on your myfeature branch (see above)
174+
git fetch upstream
175+
git rebase upstream/develop
176+
```
177+
178+
While you rebase your changes, you must resolve any conflicts that might arise and build and test your changes using the above steps.
179+
180+
### Dependencies
181+
182+
#### Go modules
183+
184+
This repo uses [Go Modules](https://github.com/golang/go/wiki/Modules). Go Modules is enabled by default in Go 1.13.
185+
186+
## Submitting your Changes
187+
188+
### Create a pull request
189+
190+
Before you raise the Pull Requests, ensure you have reviewed the checklist in the [CONTRIBUTING GUIDE](../CONTRIBUTING.md):
191+
192+
- Ensure that you have re-based your changes with the upstream using the steps above.
193+
- Ensure that you have added the required unit tests for the bug fixes or new feature that you have introduced.
194+
- Ensure your commits history is clean with proper header and descriptions.
195+
196+
Go to the [openebs/dynamic-localpv-provisioner github](https://github.com/openebs/dynamic-localpv-provisioner) and follow the Open Pull Request link to raise your PR from your development branch.

0 commit comments

Comments
 (0)