Update Early, Update Often

771951f55ed37335f238e1a80dfda9cd?s=47 Juanito Fatas
December 12, 2015

Update Early, Update Often

Keeping your codebase updated is great. Most of the RubyGem authors only interested in bugs from recent versions, newer gems normally come with security fixes, performance improvements. A rails major version upgrade is easier with codebase of newer gems.

This talk is about a good engineering practice, frequent update. Why frequent update and how to do it. How I ended up built a service called deppbot, and some interesting stories from building deppbot.

771951f55ed37335f238e1a80dfda9cd?s=128

Juanito Fatas

December 12, 2015
Tweet

Transcript

  1. Update Early Update Often #RubyKaigi 2015

  2. Jolly Good Code Juanito Fatas from Taiwan ءٝؖه٦ٕ⠓爡

  3. WHY!
 FREQUENT UPDATE WHY?

  4. MAKE FUTURE UPGRADE EASIER

  5. REDUCE TECHNICAL DEBT

  6. MAINTAINER LOVE NEW BUGS

  7. DEVELOPERS DISLIKE LEGACY

  8. PERFORMANCE IMPROVEMENTS

  9. SECURITY VULNERABILITY

  10. LEARN FROM GEM UPDATES

  11. SHIP LATEST SOFTWARE https://jollygoodcode.github.io/2015/09/03/the-birth-of-deppbot.html

  12. HOWTO bundle-update(1) Quick Demo

  13. $ git checkout master

  14. $ git pull

  15. $ git checkout -b bundle-update-2015-12-12

  16. $ bundle updaet

  17. Could not find command "updaet"

  18. None
  19. $ bundle update

  20. $ git add Gemfile.lock

  21. $ git comit -m "Bundle Update 2015-12-12"

  22. git: 'comit' is not a git command. See 'git --help'.

    Did you mean this? commit
  23. None
  24. $ git commit -m "Bundle Update 2015-12-12"

  25. $ git pull-request -m "Bundle Update 2015-12-12" git pull-request command

    is from github.com/github/hub
  26. ~ 10 minutes

  27. 7200 per hour Juanito Fatas

  28. 7200*10/60 ~= 1200 ¥

  29. 3.times a month, 1200*3 = 3600¥

  30. 3600 ¥ 蔦拉麵 900¥ ⭐

  31. Automation

  32. May I use tachikoma.io?

  33. Sure What is it?

  34. A service which runs bundle update automatically.

  35. Sounds good. Can try, can try.

  36. But... It only costs a little, $49/month.

  37. Hmm...
 Can’t you write a simple script that does that?

  38. Sure I can!

  39. today = Time.current.strftime("%F") new_branch = "bundle-update-#{today}" `git checkout master` `git

    pull` `git checkout -b #{new_branch}` `bundle update` `git push origin #{new_branch}` `git pull-request -m "Bundle Update #{today}" script 'depbot'
  40. Works except I need to run 'depbot' from time to

    time
  41. Then I am busy

  42. No bundle updates

  43. Could you make a cronjob that runs every day?

  44. How about make it a service?

  45. Sure, do it.

  46. From Script to Rails app

  47. GitHub Org. API deppbot will send a Pull Request like

    a human
  48. None
  49. Process

  50. git clone  works for project hosts on bitbucket, submodules

    too
  51. bundle update  Updates Gemfile.lock and install gems

  52. TravisCI? Not all kinds of gems can be installed on

    a single VPS
  53. bundle lock --update  Updates Gemfile.lock without installing This command

    re-introduced in bundler v1.10 #3439
  54. diff -u  "BUNDLED WITH" will be preserved

  55. Delete Repo on VPS  immediately when we got the

    diff
  56. Cook Pull Request  gem links, compare views, changelogs, time

    savings
  57. Pull Request &YBN QMF

  58. nokogiri  Query RubyGems.org API Gem authors, please fill in

    your metadata
  59. 1.6.6.4…1.6.7  Parse diff and link_to repository compare view for

    code review Gem authors, please push your tags when release a gem
  60. CHANGELOG  Query GitHub API, jollygoodcode/whatsnew Don’t let your friends

    dump git logs into CHANGELOGs
  61. Time Savings  Sum every Pull Request processed time

  62. Conclusion

  63. Update Early

  64. Update Often

  65. "Continuous Updates"

  66. https://www.deppbot.com 1108 Pull Requests Sent 94 hours Engineering Time Saved

  67. WHAT’S NEXT?

  68. "Automated Security Updates" Powered by Bundler Audit

  69. hor hor hor Christmas '

  70. Any Questions Any Suggestions )

  71. Please come talk to me or

  72. I have stickers

  73. ָ֮֯הֲ