Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Git хуки на страже качества кода

441 views

Published on

Доклад Павла Матолыгина на конференции SQA Days-20. 24-26 ноября 2016. Минск
www.sqadays.com

Published in: Education
  • Be the first to comment

  • Be the first to like this

Git хуки на страже качества кода

  1. 1. Git хуки на страже качества кода Павел Матолыгин
  2. 2. Release Engineering - Deploy - Jira - Teamcity - Git - AIDA
  3. 3. GIT Gitosis vcs
  4. 4. 1.5kpush/day 15+langs 1.1M commits in all repos 3.3Glagrest repo size 350users 25GB all repos size 280 repos 520Kcommits in largest repo numbers
  5. 5. git flow - 9 release/week - 20 task/release
  6. 6. git log --graph
  7. 7. problem - WTF is in my git log?
  8. 8. commit & branch [JIRATASK-111]: Some comment [master]: [TASK-NUM]: Patch #111 comment [build]: Merge <branch> in <build_name> JIRATASK-111_Some_title branch commits
  9. 9. genius
  10. 10. git hooks - Script - Bash/Python/PHP/Ruby… - Invoked by git command
  11. 11. git hooks pre-commit prepare-commit-msg commit-msg post-commit pre-rebase post-checkout post-merge pre-push pre-receive post-receive update
  12. 12. git hooks pre-commit prepare-commit-msg commit-msg post-commit pre-rebase post-checkout post-merge pre-push pre-receive post-receive update rebase checkout merge push client commit
  13. 13. rebase checkout merge push client server commit git hooks pre-commit prepare-commit-msg commit-msg post-commit pre-rebase post-checkout post-merge pre-push pre-receive post-receive update
  14. 14. prepare-commit-msg - client-side - invoked by git commit - modify commit message
  15. 15. prepare-commit-msg
  16. 16. prepare-commit-msg
  17. 17. prepare-commit-msg
  18. 18. prepare-commit-msg
  19. 19. problem - WTF in my git log? - No control
  20. 20. pre-receive - server-side - invoked by git push - reject changes if fail
  21. 21. pre-receive <OLD_REVISION> SP <NEW_REVISION> SP <REFNAME> LF b6b36c6 85baa88 refs/heads/master input example
  22. 22. pre-receive ([A-Z]+-[0-9]+)_([a-zA-Z0-9]+[a-zA-Z0-9-_.]+) JIRATASK-111_Some_title branch [JIRATASK-111]: Some comment commits [([A-Z]+-[0-9]+)]
  23. 23. CheckMarkers InCommitsMessages
  24. 24. CheckMarkers InCommitsMessages
  25. 25. CheckMarkers InCommitsMessages
  26. 26. CheckBranchName
  27. 27. CheckBranchName
  28. 28. problem - WTF in my git log? - No control
  29. 29. git log --oneline
  30. 30. pre-receive CheckBranchName CheckMarkersInCommitsMessages
  31. 31. pre-receive CheckBranchName CheckMarkersInCommitsMessages CheckPushBuild
  32. 32. CheckPushBuild
  33. 33. CheckPushBuild
  34. 34. pre-receive CheckBranchName CheckMarkersInCommitsMessages CheckPushBuild CheckPushMaster CheckFileNameCase
  35. 35. CheckPushMaster
  36. 36. CheckFileNameCase
  37. 37. pre-receive CheckBranchName CheckMarkersInCommitsMessages CheckPushBuild CheckPushMaster CheckFileNameCase CheckBuildMerges
  38. 38. CheckBuildMerges
  39. 39. pre-receive CheckBranchName CheckMarkersInCommitsMessages CheckPushBuild CheckPushMaster CheckFileNameCase CheckBuildMerges CheckIssueStatus
  40. 40. CheckIssueStatus
  41. 41. pre-receive CheckBranchName CheckMarkersInCommitsMessages CheckPushBuild CheckPushMaster CheckFileNameCase CheckBuildMerges CheckIssueStatus CheckFileSize
  42. 42. CheckFileSize
  43. 43. pre-receive CheckPhpSyntax CheckCRLF CheckPhpCf CheckPhpDocBlock CheckPhpSessionFail CheckPhpUse CheckPhpTrait CheckPhpNs CheckPhpMdkIncludes CheckPhpAutoload
  44. 44. post-receive - server-side - after update ref - code already updated if fail
  45. 45. post-receive FillCommitsField
  46. 46. FillCommitsField
  47. 47. post-receive FillCommitsField FillDevelopersField
  48. 48. FillDevelopersField
  49. 49. post-receive FillCommitsField FillDevelopersField AddCommitsComments
  50. 50. AddCommitsComments
  51. 51. post-receive FillCommitsField FillDevelopersField AddCommitsComments LinkIssuesWithBuild
  52. 52. LinkIssuesWithBuild
  53. 53. post-receive FillCommitsField FillDevelopersField AddCommitsComments LinkIssuesWithBuild TriggerBuildMake
  54. 54. TriggerBuildMake
  55. 55. post-receive FillCommitsField FillDevelopersField AddCommitsComments LinkIssuesWithBuild TriggerBuildMake RunTests
  56. 56. RunTests
  57. 57. RE QA DEV writers
  58. 58. git push
  59. 59. summary - GIT hooks - built-in automation - Any* language - Client-side - your assistant - Pre-receive - your firewall - Post-receive - your automation
  60. 60. stay tuned pavel.matolygin@gmail.com tlgrm.me/defaultpage habrahabr.ru/company/badoo/ facebook.com/BadooMoscow/ tech.badoo.com Павел Матолыгин, Release Engineer Badoo

×