Webinar - Continuous Integration with GitLab
-
Upload
olindata -
Category
Technology
-
view
658 -
download
3
Transcript of Webinar - Continuous Integration with GitLab
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Continuous Integration with Gitlab
Presented by: Andrew Farley [email protected]
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
Slide
DevOps, Done Right
• Senior DevOps Engineer and Consultant for OlinData
• Specializing in high-scalability engineering on the cloud
• Is an AWS Certified Solutions Architect
• Author and co-author of over 30 iPhone apps and games
• Passionate about open-source and knowledge-sharing
Who am I?
2
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Slide
• What is Continuous Integration (CI)?
• Why CI?
• Introduction to Gitlab
• Some ways to use CI
• Your first build with GitLab
• Demo
• Questions?
Overview
3
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Slide
• Continuous Integration, or CI, is the practice of “integrating” regularly to prevent merge and code quality problems from occurring to help identify problems early during development
• Not required but highly desirable with multiple developers
• “Integration” means more than simply able to merge the code
• It can include but is not limited to…
• Lint (syntax) checks
• Ensuring the code compiles/builds (for compiled languages)
• Enforcing code quality requirements
• Running automated unit tests
• Enforcing minimum performance requirements
• Generating automated documentation
• Performing continuous delivery
• Triggering activities after success or failure such as automated deployments
What is Continuous Integration?
4
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Slide
• In practice, CI-related tasks are initiated off after pushing code to a remote source control server, such as…
• GitHub (https://github.com)
• GitLab (https://gitlab.com)
• BitBucket (https://bitbucket.org)
• SourceForge (https://sourceforge.net)
• There are various managed / SaaS CI providers that integrate with a number of the above services including…
• CircleCI (https://circleci.com)
• TravisCI (https://travis-ci.org)
• And there are managed solutions to do the same if you have legal or security reasons to not be able to ship your code to a SaaS provider
• Jenkins (https://jenkins.io/)
• Hudson (http://hudson-ci.org)
Continuous Integration continued…
5
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Slide
What is GitLab?
6
https://gitlab.comNOTE: OlinData and the presenter are not a client or partner of GitLab Inc., merely a fellow consumer and active user of their platform
• GitLab is an open-source managed Source Code Management (SCM) Repository
• GitLab is a cloud-hosted or managed alternative to GitHub, though typically hosted on your own server.
• Their feature-sets are comparable, especially with Enterprise GitLab.
• Ideal for customers with legal reasons to keep their code off SaaS and cloud-based SCM solutions like GitHub.
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Slide
Typical CI Workflow
7
Multiple Developers/Teams Push Code
SCM System Receives Code, Initiates CI
CI Builds Project (if necessary)
Automated Tests OccurReport (failed) Results to team via Email or other integrations (eg: Slack)
If necessary, fix failing builds
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Slide
Gradual CI Adoption
8
Bug Reported
Developers Fix Bug + Test Case
Continuous Integration
• Without CI currently on your system, you can gradually begin to add CI even while in a maintenance mode.
• Every time you fix a bug, write a test to ensure that bug does not occur again.
• Example: Users can sign up for a website with a space in front of their email address or name, which then leads to confusion when they can not login to a system.
• #1: Fix the bug (however you might fix it, either by stripping the newlines, or by rejecting the user input)
• #2: Write a test case using the right tool (in this case, possibly Selenium) to verify that the input fields and form only accept the valid input.
• With this in place as your system continues to evolve and change you can be sure new code any current or future developer writes will not cause that same bug to emerge again.
Deploy
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Slide
• Instead of wasting tons of time performing QA at or after deploying new code, you can make QA part of the development process.
• Enforcing code-style guidelines makes it easier for developers to work together and take over for one-another, and makes it easier for new developers.
• Allows your developers to find problems early during their development, making debugging and deployment much easier.
Why CI?
9
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Slide
Continuous Integration Uses
10
• Ensuring that code compiles and executes properly
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Slide
Continuous Integration Uses
11
• Ensuring the code follows your code style or compliance rules
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Slide
Continuous Integration Uses
12
• Code passes a series of unit tests and ensuring minimum performance
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Slide
• Assuming you have gitlab setup, you still need to setup a “runner” to be able to execute your builds.
• Runner can be on the Gitlab server or on a throwaway server on a cloud-provider
• You’ll want to follow the install instructions from https://gitlab.com/gitlab-org/gitlab-ci-multi-runner
• You’ll also need your token runner token from: https://YOURGITLABURL/admin/runners
Prepare For Your First Build
13
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Slide
• All you need to do now, assuming your project is already in gitlab, is add a “.gitlab-ci.yml” file.
• For more about this file, please refer to the official documentation: http://doc.gitlab.com/ee/ci/yaml/README.html
Your First Build
14
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Slide
Demo
15
https://github.com/olindata/sample-gitlabci-ruby-project or
https://github.com/olindata/sample-gitlabci-cpp-projectDemo Projects
Continuous Integration with Gitlab Presented By: Farley
ol indata.com April 5, 2016
DevOps, Done Right
Thanks!Questions?
Ask them now, or… http://olindata.com
All trademarks, service marks, trade names, trade dress, product names and logos appearing on this presentation are the property of their respective owners. All rights reserved.