Bots on guard of SDLC
Alexey Tokar
VP of Engineering @ WorldAPP
2
3y 4y 5y 2y
Developer Developer & Founder Team Lead & Architect VP of Engineering
@ Various companies @ Startup @ Yandex @ WorldAPP
13 years in practical engineering
70 people in the department
10+ projects from initial commit to production
SDLC
3
Software
Development
Life Cycle
PHASE 2
Design
PHASE 1
Requirements
analysis
PHASE 3
Development
PHASE 5
Maintenance
PHASE 4
Testing
Complicated scenarios in living examples
4
Success scenario for a task:
● Open → In Progress
● In progress → For Review
○ Code review on Merge Request
○ Merged MR
○ Set branch name in the task
● For Review → Resolved
○ Does the fix contain SQL changes?
○ Comment which parts of the system
might be affected by the fix
● Resolved → In Testing
● In Testing → Tested
○ Set “fixed in” version
● Tested → Closed
Additional requirements
● have crosslinks between different tools
● include all actual changes into a release changelog
● follow the process for each change
● have one and only one task in “In Progress” state at any moment
5
Major obstacles in the process
● Every new employee must be properly educated
● It is boring to follow a process with lots of steps
● It is so easy to forget about some steps
● Using a ton of tools calls to a constant context switching
● Each step must be “supervised” to check its correctness
6
Manual process improvements
7
Move to automation
8
What already have been automated
9
MaintenanceDevelop Test
● Unit and Integration tests run on every commit to MR branches
● Static code analysis on each push
● Cross references between GitLab and Jira
● HipChat notifications about created Merge Requests
What already have been automated
10
MaintenanceDevelop Test
● UI and Performance tests run on every commit to a develop branch
● Deploy a successful build to the test environment
● Check against different types of supported DBMS
What already have been automated
11
MaintenanceDevelop Test
● Deploy a successful build to the production environment
● Grafana alerting to HipChat
Our new member - Overlord
12
Bot design 13
How does it work
dependencies {
compile 'io.evanwong.oss:hipchat-java',
'org.eclipse.jgit:org.eclipse.jgit',
'org.gitlab:java-gitlab-api',
'com.atlassian.jira:jira-rest-java-client-core',
'com.atlassian.jira:jira-rest-java-client-api',
'com.google.inject:guice',
'io.dropwizard:dropwizard-core',
'commons-io:commons-io'
}
14
How does it work. Entry points
WebHooks
ScheduledExecutorService
15
java.util.concurrent.
WebHooks 16
How does it work
@POST
@Path( "/gitlab/callback" )
public void gitLabCallback(
GitLabEvent event
) {
...
17
Purpose: respond on external events
WebHooks usages
18
Task updates according to the workflow
19
● Transitions task status
● Assigns proper person for the next step
● Marks if task has SQL changes
● Adds a label with branch merged into
Improve cross references between tools
20
● Notifies about missed ticket key in MR title
● Fills MR with information from Jira
● Fixes common mistakes in MR creation
Propose the best reviewers based on MR changeset
21
● Who previously has edited the touched code lines
● Who has coded more than others in the files
● Who is team lead / owner of the service / package
Check that MR has 2 upvotes before merging
22
● Check that rules are followed
● Notify TeamLead / Dev manager about any
violation
● Push an author to ask colleagues to look at his
masterpiece
Predict possible bugs in the changeset
23
● Searches for possible non static bugs
● Provides unobvious observations about devs
habits
● Calls to an attention on hotspots
“Bug prediction based on your code history”
A talk on JavaDay Ukraine 2017
ScheduledExecutor 24
How does it work.
1 ScheduledExecutorService scheduler;
2
3 scheduler = Executors.newScheduledThreadPool( 1 );
4
5 scheduler.scheduleAtFixedRate(
6 () -> yourRunnableAsATask,
7 initialDelay,
8 period,
9 TimeUnit.MINUTES
10 );
25
Purpose: call scheduled events
ScheduledExecutor usages
● Notifies author about old MR without any reactions
● Notifies assignee that MR can be merged
● Notifies if you have lots of “In Progress” tickets or don’t have them at all
● Provides a list of merged tasks in the particular branch
26
Gains 27
Efficiency
Engineers spend less time on bureaucracy and can put more effort on
getting closer to the goal.
28
BUREAUCRACY ⇨
⇦ EFFICIENCY
● less context switching
● less human errors during process following
Integrations
Improved cross references between tools. Makes clearer any introduced
change and speed up bug triangulation and resolution in future.
29
● where the change was introduced
● how other tasks impacts this one
● what else could be broken by the bug
Education
Education instead of punishment. As there is no human on the other side of the wall
it is much easier to ask help. It can explain how to follow the process 100500 times
per day for no cost.
30
Collaboration
Collaboration is very important between members of the technical team. Rather
than working in functional silos, modern methodologies promote frequent and face-
to-face communication between team members.
31
http://www.aiim.org/~/media/AIIM_Real_Images/600x400/Collaboration_lightbulb-illustration.jpg
Future improvements
● Gamification and employee engagement
● Bot queries instead of production requests, one-time scripts or “TestController”
mappings
● Production system statuses and operations with Hubot
● ...and any other automated routines
32
Questions?
Alexey@Tokar.net.ua
VP of Engineering @ WorldAPP
33

Bots on guard of sdlc

  • 1.
    Bots on guardof SDLC Alexey Tokar VP of Engineering @ WorldAPP
  • 2.
    2 3y 4y 5y2y Developer Developer & Founder Team Lead & Architect VP of Engineering @ Various companies @ Startup @ Yandex @ WorldAPP 13 years in practical engineering 70 people in the department 10+ projects from initial commit to production
  • 3.
    SDLC 3 Software Development Life Cycle PHASE 2 Design PHASE1 Requirements analysis PHASE 3 Development PHASE 5 Maintenance PHASE 4 Testing
  • 4.
    Complicated scenarios inliving examples 4 Success scenario for a task: ● Open → In Progress ● In progress → For Review ○ Code review on Merge Request ○ Merged MR ○ Set branch name in the task ● For Review → Resolved ○ Does the fix contain SQL changes? ○ Comment which parts of the system might be affected by the fix ● Resolved → In Testing ● In Testing → Tested ○ Set “fixed in” version ● Tested → Closed
  • 5.
    Additional requirements ● havecrosslinks between different tools ● include all actual changes into a release changelog ● follow the process for each change ● have one and only one task in “In Progress” state at any moment 5
  • 6.
    Major obstacles inthe process ● Every new employee must be properly educated ● It is boring to follow a process with lots of steps ● It is so easy to forget about some steps ● Using a ton of tools calls to a constant context switching ● Each step must be “supervised” to check its correctness 6
  • 7.
  • 8.
  • 9.
    What already havebeen automated 9 MaintenanceDevelop Test ● Unit and Integration tests run on every commit to MR branches ● Static code analysis on each push ● Cross references between GitLab and Jira ● HipChat notifications about created Merge Requests
  • 10.
    What already havebeen automated 10 MaintenanceDevelop Test ● UI and Performance tests run on every commit to a develop branch ● Deploy a successful build to the test environment ● Check against different types of supported DBMS
  • 11.
    What already havebeen automated 11 MaintenanceDevelop Test ● Deploy a successful build to the production environment ● Grafana alerting to HipChat
  • 12.
    Our new member- Overlord 12
  • 13.
  • 14.
    How does itwork dependencies { compile 'io.evanwong.oss:hipchat-java', 'org.eclipse.jgit:org.eclipse.jgit', 'org.gitlab:java-gitlab-api', 'com.atlassian.jira:jira-rest-java-client-core', 'com.atlassian.jira:jira-rest-java-client-api', 'com.google.inject:guice', 'io.dropwizard:dropwizard-core', 'commons-io:commons-io' } 14
  • 15.
    How does itwork. Entry points WebHooks ScheduledExecutorService 15 java.util.concurrent.
  • 16.
  • 17.
    How does itwork @POST @Path( "/gitlab/callback" ) public void gitLabCallback( GitLabEvent event ) { ... 17 Purpose: respond on external events
  • 18.
  • 19.
    Task updates accordingto the workflow 19 ● Transitions task status ● Assigns proper person for the next step ● Marks if task has SQL changes ● Adds a label with branch merged into
  • 20.
    Improve cross referencesbetween tools 20 ● Notifies about missed ticket key in MR title ● Fills MR with information from Jira ● Fixes common mistakes in MR creation
  • 21.
    Propose the bestreviewers based on MR changeset 21 ● Who previously has edited the touched code lines ● Who has coded more than others in the files ● Who is team lead / owner of the service / package
  • 22.
    Check that MRhas 2 upvotes before merging 22 ● Check that rules are followed ● Notify TeamLead / Dev manager about any violation ● Push an author to ask colleagues to look at his masterpiece
  • 23.
    Predict possible bugsin the changeset 23 ● Searches for possible non static bugs ● Provides unobvious observations about devs habits ● Calls to an attention on hotspots “Bug prediction based on your code history” A talk on JavaDay Ukraine 2017
  • 24.
  • 25.
    How does itwork. 1 ScheduledExecutorService scheduler; 2 3 scheduler = Executors.newScheduledThreadPool( 1 ); 4 5 scheduler.scheduleAtFixedRate( 6 () -> yourRunnableAsATask, 7 initialDelay, 8 period, 9 TimeUnit.MINUTES 10 ); 25 Purpose: call scheduled events
  • 26.
    ScheduledExecutor usages ● Notifiesauthor about old MR without any reactions ● Notifies assignee that MR can be merged ● Notifies if you have lots of “In Progress” tickets or don’t have them at all ● Provides a list of merged tasks in the particular branch 26
  • 27.
  • 28.
    Efficiency Engineers spend lesstime on bureaucracy and can put more effort on getting closer to the goal. 28 BUREAUCRACY ⇨ ⇦ EFFICIENCY ● less context switching ● less human errors during process following
  • 29.
    Integrations Improved cross referencesbetween tools. Makes clearer any introduced change and speed up bug triangulation and resolution in future. 29 ● where the change was introduced ● how other tasks impacts this one ● what else could be broken by the bug
  • 30.
    Education Education instead ofpunishment. As there is no human on the other side of the wall it is much easier to ask help. It can explain how to follow the process 100500 times per day for no cost. 30
  • 31.
    Collaboration Collaboration is veryimportant between members of the technical team. Rather than working in functional silos, modern methodologies promote frequent and face- to-face communication between team members. 31 http://www.aiim.org/~/media/AIIM_Real_Images/600x400/Collaboration_lightbulb-illustration.jpg
  • 32.
    Future improvements ● Gamificationand employee engagement ● Bot queries instead of production requests, one-time scripts or “TestController” mappings ● Production system statuses and operations with Hubot ● ...and any other automated routines 32
  • 33.

Editor's Notes

  • #2 One of the most boring thing in software development in large companies is following a bureaucracy. Tons of developers were melted down by that ruthless machine with its not always obvious rules. That's why we decided to delegate all the boring work to machines instead of humans and the talk will cover the achieved results.
  • #8 Once a week you can bring processed tasks to the actual state manually
  • #15 (chat bot under the hood. java tools and libraries)
  • #16 Точки входа - вебхуки и планировщик Application design Webhooks from gitlab ScheduledExecutorService
  • #29 Улучшилась видимость и понятность процессов, так как бот пытается объяснять что не так и дает ссылки на документации
  • #33 hubot integrations description