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.

Continuous Integration with Gitlab

164 views

Published on

With Gitlab CI, Docker Registry, Fabric

Published in: Software
  • Be the first to comment

  • Be the first to like this

Continuous Integration with Gitlab

  1. 1. About Continuous Integration
  2. 2. CI ? ! ? ? , !
  3. 3. (Continuous Integration) CI Test .
  4. 4. Testing
  5. 5. Unit testing Functional testing Integration testing ,
  6. 6. Test Tutorial class AppTest(unittest.TestCase): def setUp(self): self.app = app.test_client() self.access_token = self.token() def token(self, username, password): p = self.app.post('/signin', data=dict( id=username, pw=password ), follow_redirects=True) result = json.loads(p.data) self.assertEqual(result['e_msg'].get('status'), 200) return result['access_token']
  7. 7. Test Signin def test_signin(self): # Invalid Username p = self.app.post('/signin', data=dict( id=username + 'xxx', pw=password )) result = json.loads(p.data) self.assertEqual(result['e_msg'].get('message'), 'User not fo # Invalid Password p = self.app.post('/signin', data=dict( id=username, pw=password + 'x' )) result = json.loads(p.data) self.assertEqual(result['e_msg'].get('message'), 'User id or
  8. 8. Test Signup def test_signup(self): ## User Already Exists p = self.app.post('/signup', data=dict( id=username, pw=password )) result = json.loads(p.data) self.assertEqual(result['e_msg'].get('message'), 'User alread # Signup Successful p = self.app.post('/signup', data=dict( id=username + 'x', pw=password )) result = json.loads(p.data) self.assertEqual(result['e_msg'].get('status'), 200)
  9. 9. Pytest Plugin pytest‑pep8 : , PEP8 pytest‑cov : pytest‑xdist :
  10. 10. Test Command Backend API pytest ‑s backend/ Backend API user API pytest ‑s backend/users PEP8 pytest ‑‑pep8 ‑m pep8 PEP8 Backend API pytest ‑‑pep8 ‑s backend/
  11. 11. Deploy / Setup Automation
  12. 12. Deploy / Setup Automation 1000 ? ! http://www.fabfile.org/ Fabric ? ! $ fab create $ fab deploy $ fab build $ fab test
  13. 13. Gitlab CI Gitlab DigitalOcean CI !  Ubuntu-Ruby Docker Gitlab Registry Gitlab Docker Registry ! Docker Registry ? private docker image repository
  14. 14. Gitlab CI Docker Docker Runner .
  15. 15. CI process 1. User Gitlab Push , 2. Gitlab CI Gitlab Registry Docker image 3. Docker image centos‑python‑mysql 4. requirements.txt 5. 1 : Runner job 6. 2 : pytest (PEP8) 7. 3 : AWS EC2 deploy 8. Slack
  16. 16. , (Blue‑Green Deployment)

×