Slide 1

Slide 1 text

Git & GitLab & ίʔυϨϏϡʔͬͯʁ @blue_1617

Slide 2

Slide 2 text

ࢲ͸୭ʁ blue (@blue_1617) https://blue0513.github.io/show_room/ 2 Rails, JavaScript, Scala etc ΤϜεϦʔ: Ϋϥ΢υిࢠΧϧςνʔϜॴଐ ͨ·ʹ C# ͱ͔ DevOps ΋΍ΔΑ GitHubͱ͔ ‣ slackdeck-proto : Slack ͷ TweetDeck ෩ Viewer ‣ minideck : TweetDeck ͷ͍͍ײ͡ͷ Viewer ‣ phantom-inline-comment: Emacs ͷ package ‣ point-history: Emacs ͷ package ‣ instant-maximized-window: Emacs ͷ package

Slide 3

Slide 3 text

͜ͷࢿྉ͸ʁ 3 Git ΍ GitLabɺίʔυϨϏϡʔͷʮ֓೦ʯ Λ཈͑Δ͜ͱ͕໨త ʢৄࡉͳίϚϯυͷୟ͖ํͳͲ͸આ໌͠ͳ͍ʣ ‣ Git ͬͯԿ͕خ͍͠ͷʁ ‣ GitLab ͰԿ͕Ͱ͖Δͷʁ ‣ ίʔυϨϏϡʔͬͯԿΛ͢Δͷʁ

Slide 4

Slide 4 text

લఏ৚݅ 4 υϯυϯ࣭໰ͪ͠Ό͍ͬͯͩ͘͞ʂ ‣ Ұํతͳߨٛ͡Όͳ͍Ͱ͢ ؒҧͬͯͨΒڭ͍͑ͯͩ͘͞ʂ ‣ blue ΋·ͩۦ͚ग़͠ͷΤϯδχΞͰ͢ ଞͷҙݟ΋͍ͬͺ͍͋Δͱࢥ͍·͢ ‣ ઈରతͳՁ஋ج४Ͱ͸ͳ͍Ͱ͢ ΤϯδχΞ͸ֶͼଓ͚Δ࢟੎͕ඞཁͩͱࢥ͍·͢ ‣ ͜ͷษڧձΛ੒௕ͷ͖͔͚ͬʹ͍ͯͩ͘͠͞

Slide 5

Slide 5 text

Git ͬͯͳʹ͕خ͍͠ͷʁ

Slide 6

Slide 6 text

ͦ΋ͦ΋ Git ͬͯԿ͕Ͱ͖Δͷʁ 6 Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency https://git-scm.com/

Slide 7

Slide 7 text

ͦ΋ͦ΋ Git ͬͯԿ͕Ͱ͖Δͷʁ 7 Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency https://git-scm.com/ Branching & Merging Data Assurance Staging Area

Slide 8

Slide 8 text

Branching & Merging 8 ෳ਺ͷ Branch Λ·͕ͨͬͯ։ൃͰ͖Δ ʢBranch: ֤ʑಠཱͨ͠ workspaceʣ ‣ Master branch ‣ Develop branch ‣ Topic branch ຊ൪؀ڥʹσϓϩΠ͢Δ/ͨ͠ branch Topic branch Λ·ͱΊͨ౷߹ branch ݕূ؀ڥͳͲʹ͋͛ͯ QA ͞ΕΔ ػೳ։ൃͷ branch ػೳ͝ͱʹ࡞ΒΕΔͨΊɺ࠷΋਺͕ଟ͍ https://git-scm.com/about/branching-and-merging

Slide 9

Slide 9 text

Branching & Merging 9 ෳ਺ͷ Branch Λ·͕ͨͬͯ։ൃͰ͖Δ ʢBranch: ֤ʑಠཱͨ͠ workspaceʣ ‣ Master branch ‣ Develop branch ‣ Topic branch ຊ൪؀ڥʹσϓϩΠ͢Δ/ͨ͠ branch Topic branch Λ·ͱΊͨ౷߹ branch ݕূ؀ڥͳͲʹ͋͛ͯ QA ͞ΕΔ ػೳ։ൃͷ branch ػೳ͝ͱʹ࡞ΒΕΔͨΊɺ࠷΋਺͕ଟ͍ Topic into Develop Develop into Master https://git-scm.com/about/branching-and-merging

Slide 10

Slide 10 text

Branching & Merging 10 ΋͠΋ Master branch ҰຊͰӡ༻͢Δͱʁ 1. Ͳͷ commit ·Ͱ͕ຊ൪؀ڥʹσϓϩΠ͞Ε͍ͯΔ͔ෆ໌ 2. ۓٸमਖ਼൛ΛϦϦʔε͢Δͱ͖ʹɺະ QA ͷ΋ͷ͕ࠞ͡Δ etc etc .... 3. ϨϏϡʔΛ͢Δͷ͕೉͍͠ ੡඼ͷΫΦϦςΟΛ୲อͰ͖ͳ͍ʂ

Slide 11

Slide 11 text

Staging Area 11 ‣ Working Directory ‣ Staging Area ‣ Repository มߋΛ֬ఆ͢Δલͷஈ֊͕ଘࡏ͢Δ (commit) ࡞ۀதͷۭؒ var temp = 'DEBUG' ͱ͔ͯ͠΋OK มߋ֬ఆલͷۭؒ มߋ͕ଥ౰ͳ΋ͷ͔ΛνΣοΫ͢Δ มߋ֬ఆޙͷۭؒ git add file git commit -m "msg" https://git-scm.com/about/staging-area

Slide 12

Slide 12 text

Staging Area 12 ‣ Working Directory ‣ Staging Area ‣ Repository มߋΛ֬ఆ͢Δલͷஈ֊͕ଘࡏ͢Δ (commit) ཤྺʹ࢒͢/࢒͞ͳ͍มߋΛબ୒Ͱ͖Δ https://git-scm.com/about/staging-area commit ͷཻ౓Λ؆୯ʹௐ੔Ͱ͖Δ

Slide 13

Slide 13 text

Data Assurance 13 commit ͨ͠಺༰ͦͷ΋ͷ͕อ࣋͞ΕΔ ޙʑมߋ͢Δ͜ͱ͕ʢࣄ্࣮ʣෆՄೳ 1. Project ಺༰Λ commit ͳ͠ʹมߋ͢Δ͜ͱ͕ෆՄ 2. ୭͕ clone ͯ͠΋ಉ݁͡ՌʹͳΔ 3. ྺ࢙Λ׬શʹอ࣋͢ΔʢVersion Controlʣ https://git-scm.com/about/info-assurance

Slide 14

Slide 14 text

Data Assurance 14 commit ͨ͠಺༰ͦͷ΋ͷ͕อ࣋͞ΕΔ ޙʑมߋ͢Δ͜ͱ͕ʢࣄ্࣮ʣෆՄೳ 1. Project ಺༰Λ commit ͳ͠ʹมߋ͢Δ͜ͱ͕ෆՄ 2. ୭͕ clone ͯ͠΋ಉ݁͡ՌʹͳΔ 3. ྺ࢙Λ׬શʹอ࣋͢ΔʢVersion Controlʣ ෳ਺ਓͰͷ։ൃ͕ඇৗʹ༰қ https://git-scm.com/about/info-assurance

Slide 15

Slide 15 text

Git ͬͯͳʹ͕خ͍͠ͷʁ 15 https://git-scm.com/about/ ‣ Branching & Merging ͷ࢓૊ΈͰɺฒߦͨ͠։ൃ͕༰қʹ ‣ Staging Area ʹΑͬͯɺมߋΛۛຯͰ͖Δ ‣ Data Assurance ͷੑ࣭Ͱɺෳ਺ਓ։ൃ͕༰қʹ

Slide 16

Slide 16 text

GitLab Ͱͳʹ͕Ͱ͖Δͷʁ

Slide 17

Slide 17 text

ͦ΋ͦ΋ GitLab ͬͯԿʁ 17 GitLab is a web-based DevOps lifecycle tool that provides a Git- repository manager providing wiki, issue-tracking and CI/CD https://en.wikipedia.org/wiki/GitLab pipeline features https://about.gitlab.com/stages-devops-lifecycle/continuous-integration/

Slide 18

Slide 18 text

ͦ΋ͦ΋ GitLab ͬͯԿʁ 18 GitLab is a web-based DevOps lifecycle tool that provides a Git- repository manager providing wiki, issue-tracking and CI/CD https://en.wikipedia.org/wiki/GitLab pipeline features https://about.gitlab.com/stages-devops-lifecycle/continuous-integration/ WIKI ISSUE MR

Slide 19

Slide 19 text

Merge Request (MR) 19 Merge requests allow you to visualize and collaborate on the proposed changes to source code that exist as commits on a given Git branch Title Description Target Branch https://about.gitlab.com/

Slide 20

Slide 20 text

Merge Request (MR) 20 Merge requests allow you to visualize and collaborate on the proposed changes to source code that exist as commits on a given Git branch Modified Sources https://about.gitlab.com/

Slide 21

Slide 21 text

MR ͕Ͱ͖Δͱɺͳʹ͕خ͍͠ͷʁ 21 1. มߋՕॴΛϨϏϡʔͰ͖Δʢޙड़ʣ 2. มߋͷཧ༝/಺༰/ཤྺΛυΩϡϝϯτͱͯ͠࢒ͤΔ ͜͜ͰAΛBͯ͠Δ ཧ༝͸ԿͰ͔͢ʁ B͠ͳ͍ͱC͢Δͱ͖ ෆ౎߹͕͋Δ͔ΒͰ͢

Slide 22

Slide 22 text

Continuous Integration/Deployment (CI/CD) 22 Continuous Integration works by pushing small code chunks to your application’s code base hosted in a Git repository, and, to every push, run a pipeline of scripts to build, test, and validate the code changes before merging them into the main branch. Continuous Delivery and Deployment consist of a step further CI, deploying your application to production at every push to the default branch of the repository. https://about.gitlab.com/

Slide 23

Slide 23 text

CI/CD ͕Ͱ͖Δͱɺͳʹ͕خ͍͠ͷʁ 23 build unit test E2E ςετ Lint ຊ൪ deploy ؀ڥม਺ͷॻ͖׵͑ ϦϦʔε build QA ؀ڥ΁ͷ deploy ssh unit test etc etc .... ‣ ͢΂ͯख࡞ۀͰ࣮ߦ͢Δඞཁ͕͋Δ ‣ खॱΛϛεΔͱαʔϏε͕ࢭ·Δ ‣ खݩͰ build ΍ ςετ ͢Δ͕͔͔࣌ؒΔ ‣ ਫ਼ਆ͕͢ΓݮΔ.....

Slide 24

Slide 24 text

24 ‣ build ΍ςετͯ͠Δؒʹ։ൃ͕Ͱ͖Δ ‣ Slack ͳͲͱ࿈ܞࣦͯ͠ഊͨ͠Β௨஌ͯ͘͠ΕΔ ‣ push ͢Δ͚ͩͰίϯϐϡʔλ͕શ෦΍ͬͯ͘ΕΔ ‣ ࣗಈԽ࠷ߴʂ CI/CD ͕Ͱ͖Δͱɺͳʹ͕خ͍͠ͷʁ push

Slide 25

Slide 25 text

ίʔυϨϏϡʔͬͯԿ͢Δͷʁ

Slide 26

Slide 26 text

26 ίʔυϨϏϡʔͬͯԿ͢Δͷʁ https://github.com/google/eng-practices/blob/master/review/index.md A code review is a process where someone other than the author(s) of a piece of code examines that code. At Google we use code review to maintain the quality of our code and products.

Slide 27

Slide 27 text

27 ίʔυϨϏϡʔͬͯԿ͢Δͷʁ A code review is a process where someone other than the author(s) of a piece of code examines that code. At Google we use code review to maintain the quality of our code and products. ‣ ૈ୳͠΍൷൑Λ͢ΔͷͰ͸ͳ͘ɺ ίʔυ΍ϓϩμΫτͷΫΦϦςΟΛ୲อ͢Δ৔

Slide 28

Slide 28 text

28 ίʔυϨϏϡʔͬͯԿ͢Δͷʁ A code review is a process where someone other than the author(s) of a piece of code examines that code. At Google we use code review to maintain the quality of our code and products. ‣ ૈ୳͠΍൷൑Λ͢ΔͷͰ͸ͳ͘ɺ ‣ ໾৬΍೥࣍ʹґΒͳ͍ϑϥοτͳ৔ ίʔυ΍ϓϩμΫτͷΫΦϦςΟΛ୲อ͢Δ৔

Slide 29

Slide 29 text

29 ίʔυϨϏϡʔͬͯԿ͢Δͷʁ A code review is a process where someone other than the author(s) of a piece of code examines that code. At Google we use code review to maintain the quality of our code and products. ‣ ૈ୳͠΍൷൑Λ͢ΔͷͰ͸ͳ͘ɺ ‣ ໾৬΍೥࣍ʹґΒͳ͍ϑϥοτͳ৔ ‣ ΤϯδχΞͨͪͷίϛϡχέʔγϣϯͷ৔ ίʔυ΍ϓϩμΫτͷΫΦϦςΟΛ୲อ͢Δ৔

Slide 30

Slide 30 text

30 ίʔυϨϏϡʔͬͯԿ͢Δͷʁ ‣ มߋͷҙਤΛਘͶΔ https://about.gitlab.com/ ͜͜ͰAΛBͯ͠Δ ཧ༝͸ԿͰ͔͢ʁ B͠ͳ͍ͱC͢Δͱ͖ ෆ౎߹͕͋Δ͔ΒͰ͢

Slide 31

Slide 31 text

31 ίʔυϨϏϡʔͬͯԿ͢Δͷʁ ‣ मਖ਼ͨ͠ํ͕͍͍఺ΛࢦఠΛ͢Δ https://about.gitlab.com/ Aʹ͠ͳ͍ͱBͷͱ͖ʹ ෆ౎߹ੜ͡·͢Ͷ ͔ͨ͠ʹ Aͷख๏ʹॻ͖׵͑·͢

Slide 32

Slide 32 text

32 ίʔυϨϏϡʔͬͯԿ͢Δͷʁ ‣ Nits: ඞਢ͡Όͳ͍͚Ͳɺ·͋ࢦఠ ‣ Ask: ७ਮʹ࣭໰ͳΜͰ͕͢ ‣ IMO: ࣗ෼ͷҙݟͰ͸ ‣ FYI: ຊےͱؔ܎ͳ͍͚Ͳɺ৘ใڞ༗͢Δͱ ‣ Must: मਖ਼͸ඞਢͰ͢Α ͨ·ʹ࢖͏ prefix ͨͪ ϨϏϡʔίϝϯτͷԹ౓ײΛ఻͑Δͷʹศར

Slide 33

Slide 33 text

·ͱΊ

Slide 34

Slide 34 text

34 ·ͱΊ ‣ GitLab ‣ Code Review ‣ Git ‣ ίʔυͷΫΦϦςΟΛ্͛ΒΕΔ ‣ υΩϡϝϯτΛ࢒ͤΔ ‣ ΤϯδχΞͷίϛϡχέʔγϣϯͷ৔Ͱ͋Δ ‣ Test ͳͲΛܧଓతʹ࣮ߦͰ͖Δ ‣ Deploy ΛࣗಈԽͰ͖Δ ‣ ։ൃΛߴ଎ԽͰ͖Δ ‣ ҆શʹ։ൃΛਐΊΒΕΔΑ͏ʹͳΔ