Project

General

Profile

Development process » History » Version 7

Tom Clegg, 07/06/2022 03:04 PM

1 1 Peter Amstutz
h1. Summary of Development Process
2
3
{{toc}}
4
5
h1. Revision control
6
7
h2. Branches
8
9
* All development should be done in a branch.  The only exception to this should be trivial bug fixes.  What is trivial enough to not need review is the judgement of the developer, but when in doubt, ask for a review.
10
* Each story should be done in its own branch.
11
* Branch names are "####-story-summary" where #### is the redmine issue number followed by 3 or 4 words that summarize the story.
12
* Make your local branches track the main repository (@git push -u@)
13
* Commit regularly, and push your branch to the @git.arvados.org@ at the end of each day.
14
* Don't push uninvited changes to other developer's branches.
15
** To contribute to another developer's branch, check with them first, or create your own branch ("####-story-summary-ABC" where ABC are your initials) and ask the other developer to merge your branch.
16
17
h3. Merging
18
19 6 Ward Vandewege
Branches should not be merged to main until they are ready (see [[Summary of Development Process#Ready to merge|Ready to merge]] below).
20 1 Peter Amstutz
21
# @git remote -v@
22 6 Ward Vandewege
** Make sure your @origin@ is git.arvados.org, not github. *Don't push directly to the github main* branch -- let git.arvados.org decide whether it's OK to push to github.
23
# @git checkout main@
24 1 Peter Amstutz
# @git pull --ff-only@
25 6 Ward Vandewege
#* This ensures your main is up to date. Otherwise "git push" below might fail, and you'll be backtracking.
26 1 Peter Amstutz
# @git merge --no-ff branchname@
27
#* *The @--no-ff@ part is important!* It ensures there is actually a commit representing this merge. This is your opportunity to record the name of your branch being merged, and the relevant story number. Without it, the git history looks like we all just mysteriously started developing at the tip of your (now unnamed) feature branch.
28
#* In your merge commit message, *include the relevant story/issue number* (either "@refs #1234@" or "@closes #1234@").
29 4 Nico César
#* In your merge commit message, *include Arvados-DCO-1.1-Signed-off-by line* (i.e. Arvados-DCO-1.1-Signed-off-by: Jane Doe <jane@example.com>)
30 1 Peter Amstutz
# @git push@
31 3 Peter Amstutz
# Look for Jenkins' build results at https://ci.arvados.org .
32 1 Peter Amstutz
33
h3. Rejected pushes
34
35 6 Ward Vandewege
We have a git hook in place that will reject pushes that do not follow these guidelines.  The goal of these policies is to ensure a clean linear history of changes to main with consistent cross referencing with issue numbers.  These policies apply to the commits listed on "git rev-list --first-parent" when pushing to main, and not to commits on any other branches.
36 1 Peter Amstutz
37
If you try to push a (set of) commit(s) that does not pass mustard, you will get a [POLICY] reject message on stdout, which will also list the offending commit. You can use
38
39
  git commit --amend
40
41
to update the commit message on your last commit, if that is the offending one, or else you can use 
42
43
  git rebase --interactive
44
45
to rebase and fix up a commit message on an earlier commit.
46
47 6 Ward Vandewege
h4. All merge commits to main must be from a feature branch into main
48 1 Peter Amstutz
49 6 Ward Vandewege
Merges that go the other way (from main to a feature branch) that get pushed to main as a result of a fast-forward push will be rejected.  In other words:  when merging to main, make sure to use --no-ff.
50 1 Peter Amstutz
51 6 Ward Vandewege
h4. Merges between local and remote main branches will be rejected
52 1 Peter Amstutz
53 6 Ward Vandewege
Merges between local and remote main branches (generally merges created by "git pull") will be rejected, in order to maintain a linear main history.  If this happens, you'll need to reset main to the remote head and then remerge or rebase.
54 1 Peter Amstutz
55
h4. Proper merge message format
56
57 6 Ward Vandewege
All merge commits to main must include the text "Merge branch 'featurebranch'" or they will be rejected.
58 1 Peter Amstutz
59 6 Ward Vandewege
h4. All commits to main include an issue number or explicitly say no issue #
60 1 Peter Amstutz
61 6 Ward Vandewege
All commits to main (both merges and single parent commits) must
62 1 Peter Amstutz
include the text "refs #", "closes #" or "no issue #" or they will be
63
rejected.
64
65
h4. Avoid broken commit messages
66
67
Your commit message matches
68
69
  /Please enter a commit message to explain why this merge is necessary/
70
71
h2. Commit logs
72
73 5 Ward Vandewege
See https://dev.arvados.org/projects/arvados/wiki/Coding_Standards
74 1 Peter Amstutz
75
h2. Code review process
76
77
Code review has high priority! Branches shouldn't sit around for days waiting for review/merge.
78
79
When your branch is ready for review:
80
# Create/update a review task on the story so it looks like this:
81
#* subject = "review {branch name}"
82
#* state = in progress
83
#* assignee is not null
84
# Ping your reviewer (during daily standup, via e-mail and/or via chat).
85
86
Doing a review:
87
# We will discuss/assign the review requests at daily stand-up.
88
# When you start the review, assign the review task to yourself and move the review task to "in progress" to make sure other people don't duplicate your effort.
89 6 Ward Vandewege
# The recommended process for reviewing diffs for a branch is @git diff main...branchname@.  The reviewer must make sure that their repository is up to date (or use @git diff origin/main...origin/branchname@). Note the 3 dots (not two)
90 7 Tom Clegg
# After doing a review, write up comments ("fix these problems" or "ready to merge") to the story page, make a note of the git commit revision that was reviewed, assign the review task back to the original developer, and notify the original developer on gitter (or by some other means).
91
#* In comments, preface each point with "low:", "medium:", or "high:"
92
#* low: nitpick not necessarily worth changing here if you don't feel like it, but I'm mentioning it to help improve habits
93
#* medium: suggestion/idea that you should at least acknowledge/respond to, even if we don't end up resolving it here
94
#* high: we should make sure we both agree on how this is resolved before merging
95 1 Peter Amstutz
# The original developer should address any outstanding problems/comments in the code, then write a brief response indicating which points were dealt with or intentionally rejected/not addressed.
96
# If the response involves more commits, do that, then goto "branch is ready for review". This process iterates until the branch is deemed ready to merge.
97
# Once the branch is merged, move the "review" task to "resolved".
98
99
To list unmerged branches:
100 6 Ward Vandewege
* Yours: @git branch --no-merged main@
101
* Everyone: @git branch -a --no-merged main@
102 1 Peter Amstutz
103
h2. Ready to merge
104
105
When merging, both the developer and the reviewer should be convinced that:
106 6 Ward Vandewege
* Current/recent main is merged. (Otherwise, you can't predict what merge will do.)
107 1 Peter Amstutz
* The branch is pushed to git.arvados.org
108
* The code is suitably robust.
109
* The code is suitably readable.
110
* The code is suitably scalable. For example, client code is not allowed to print or sort unbounded lists. If the code handles a list of items, consider what happens when the list is 10x as large as you expect. What about 100x? A million times?
111
* The code accomplishes what the story specified. If not, explain why (e.g., the branch is only part of the story, a better solution was found, etc.) in the issue comments
112
* New API names (methods, attributes, error codes) and behaviors are well chosen. It sucks to change them later, and have to choose between compatibility and greatness.
113
* Tests that used to pass still pass. (Be extremely careful when altering old tests to make them pass. Do not change existing tests to test new code. Add assertions and write new tests. If you change or remove an existing test, you are breaking behavior that someone already decided was worth testing!)
114
* Recent clients/SDKs work against the new API server. (Things rarely turn out well when we rely on all clients being updated at once in lockstep with the API server. Our test suite doesn't check this for us yet, so for now we have to pay attention.)
115
* New/fixed behavior is tested. (Although sometimes we decide not to block on inadequate testing infrastructure... that sucks!)
116
* New/changed behavior is documented. Search the doc site for relevant keywords to help you find the right sections.
117
* Whitespace errors are not committed. (Tab characters, spaces at EOL, etc.)
118
* Git commit messages are descriptive (see [[arvados:Coding Standards]]). If they aren't, this is your last chance to rebase/reword.
119
120
h2. Handling pull requests from github
121
122
_This is only for contributions by *external contributors*, i.e., people who don't have permission to write directly to arvados.org repositories._
123
124 6 Ward Vandewege
First make sure your main is up to date.
125 1 Peter Amstutz
126 6 Ward Vandewege
    git checkout main; git pull --ff-only
127 1 Peter Amstutz
128
*Option 1:* On the pull request page on github, click the "You can also merge branches on the command line" link to get instructions.
129
130
* Don't forget to run tests.
131
132
*Option 2:* (a bit shorter)
133
134 6 Ward Vandewege
Say we have "chapmanb  wants to merge 1 commit into arvados:main from chapmanb:branchname"
135 1 Peter Amstutz
* @git fetch https://github.com/chapmanb/arvados.git branchname:chapmanb-branchname@
136
* @git merge --no-ff chapmanb-branchname@
137
* Use the commit message: @Merge branch 'branchname' from github.com/chapmanb. No issue #@
138
(or @refs #1234@ if there is an issue#)
139 6 Ward Vandewege
* Confirm diff: @git diff origin/main main@
140 1 Peter Amstutz
* Run tests
141
* @git push@
142
143
h1. Non-fast-forward push
144
145
Please don't get into a situation where this is needed.
146
147 6 Ward Vandewege
# On dev box: @git push -f git@github.com:arvados/arvados proper_head_commit:main proper_head_commit:staging@
148
# On dev box: @git push -f git@git.arvados.org:arvados.git proper_head_commit:main@
149
# As gitsync@dev.arvados.org: @cd /scm/arvados; git fetch origin; git checkout main; git reset --hard origin/main@
150 1 Peter Amstutz
151
(At least that's what TC did on 2016-03-10. We'll see how it goes.)
152
153
h1. Working with external upstream projects
154
155
Development process summary (1-6 should follow the guidelines above)
156
157
# Each feature is developed in a git branch named @<issue_number>-<summary>@, for example @12521-web-app-config@
158
# Each feature has a "Review" task.  You can see the features and review tasks on the task board.
159
# When the feature branch is ready for review, update the title of the Review task to say "Review <branchname>" and move it from the *New* column the to *In Progress* column
160
# The reviewer responds on the issue page with questions or comments
161
# When the branch is ready to merge, the reviewer will add a comment "Looks Good To Me" (LGTM) on the issue page
162
# Merge the feature into into the Arvados main branch
163
# Push the feature branch to github and make a pull request (PR) of the branch against the external project upstream
164
# Handle code review comments/change requests from the external project team
165 6 Ward Vandewege
# Once the external project merges the PR, merge external project upstream main back into the feature branch
166 1 Peter Amstutz
# Determine if external project upstream brings any unrelated changes that breaks things for us
167
# If necessary, make fixes, make a new PR, repeat until stable
168 6 Ward Vandewege
# Merge the feature branch (now up-to-date with external project upstream) into Arvados main
169 1 Peter Amstutz
170
This process is intended to let us work independently of how quickly the external project team merges our PRs, while still maximizing the chance that they will be able to accept our PRs by limiting the scope to one feature at a time.
171
172 6 Ward Vandewege
This assumes using git merge commits and avoiding rebases, so we can easily perform merges back and forth between the three branches (Arvados main, feature, external project main).
173 1 Peter Amstutz
174
175
h1. Scrum
176
177
h2. References
178
179
These books give us a reference point and vocabulary. 
180
181
* _Essential Scrum: A Practical Guide to the Most Popular Agile Process_ by Kenneth Rubin
182
* _User Stories Applied: For Agile Software Development_ by Mike Cohen
183
184
h2. Roles
185
186
187
h3. Product Owner
188
189
* Decide what goes on the backlog
190
* Decide backlog priorities
191
* Work with stakeholders to understand their requirements and priorities
192
* Encode stakeholder requirements/expectations as user stories
193
* Lead sprint planning meetings 
194
* Lead release planning meetings 
195
* Lead product planning meetings 
196
* Lead Sprint Kick-off Meetings
197
* Lead Sprint Review Meetings
198
* Decide on overall release schedule 
199
200
h3. Scrum Master
201
202
* Lead Daily Scrum Meeting
203
* Help to eliminate road blocks 
204
* Lead Sprint Retrospective Meetings
205
* Organize Sprint Schedule 
206
* Help team organize and stay on track with Scrum process
207
* Teach new engineers how Scrum works
208
209
h3. Top stakeholders
210
211
* Conduct market research 
212
* Synthesize market research into user stories 
213
* Work with Product Owner to prioritize stories
214
* Define overall business goals for product 
215
* Work with Product Owner to define overall release cycle 
216
* Organize User Input and dialog with users for engineering team 
217
* Contribute to backlog grooming 
218
* Bring voice of customer into planning process 
219
* Define user personas 
220
* Coordinate user communication 
221
* Develop technical marketing and sales materials 
222
* Assist sales team in presenting product value proposition
223
* Train sales in technical aspects of the product
224
225
h2. Definition of Done
226
227
An issue is resolved when:
228
229
* Code is written
230
* Existing code is refactored if appropriate
231
* Documentation is written/updated
232
* Acceptance tests are satisfied
233 6 Ward Vandewege
* Code is merged in main
234 1 Peter Amstutz
* All Jenkins jobs pass (test, build packages, deploy to dev clusters)
235
* Feature works on applicable dev clusters
236
237
h2. Standard Schedule
238
239
Sprints are two weeks long. They start and end on Wednesdays.
240
241
h3. Key meetings
242
243 2 Peter Amstutz
Every day:
244 1 Peter Amstutz
245
Daily Scrum (15 Minutes)
246
Who: Development team, product owner. Silent observers welcome.
247
* What did you do yesterday?
248
* What will you do today?
249
* What obstacles are in your way?
250
251
h4. Sprint review & kickoff (every 2 weeks on Wednesday):
252
253
Sprint Review (30 minutes)
254
Who: Development team, product owner, stakeholders.
255
* Demo of each feature built and relationship to stories
256
* Product owner explains which backlog items are done
257
* Development team demonstrates the work done, and answers questions about the sprint increment
258
* Product owner discusses the backlog as it stands. Revise expected completion dates based on recent progress (if needed)
259
* Review current product status in context of business goals
260
261
Sprint Retrospective (30 minutes)
262
Who: Development team, product owner.
263
* Review what processes worked well, and what didn't, in the sprint just finished
264
* Propose and agree to changes to improve future sprints
265
* Assign action items (meetings/tasks) to implement agreed-upon process improvements
266
267
Sprint Kick Off (1 hour)
268
Who: Development team, product owner.
269
* Add latest bugs or dependencies to sprint
270
* Create tasks for each story
271
* Assign a developer to each task
272
* Assign an on-call engineer for that sprint who will triage customer support requests
273
* Check that commitment level is realistic
274
275
h4. Planning (alternate Wednesdays mid-sprint)
276
277 2 Peter Amstutz
Roadmap review (1 hour)
278 1 Peter Amstutz
Who: Development team, product owner, stakeholders.
279 2 Peter Amstutz
* Report high level status of epics
280
* Prioritize epics
281
* Define new epics
282 1 Peter Amstutz
283 2 Peter Amstutz
Sprint Planning (1-2 hours)
284 1 Peter Amstutz
Who: Development team, product owner.
285 2 Peter Amstutz
* Discuss and get engineering team consensus on feature design & implementation strategy for tasks on current and upcoming epics