GitHub Enterprise and Automation with Codedeploy presented by Daniel Figucio, Director Solutions Engineering, GitHub, ASEAN & ANZ at AWS Summit Singapore 2017.
18. Howpeople build software!
!
• 300 files
• 100KB of diff text per file
• 1MB of diff text total
• 3,000 lines of diff text per file.
• 20,000 lines of diff text overall.
More files, more lines, more awesome
• 3,000 files
• 60,000,000 lines
• 3GB of diff text
• All files loaded progressively
21. Howpeople build software!
!
• Org/teams invite API Update
• Preview: PR Reviews API
• Preview: Updates to Organization membership
• Preview: Oauth authorizations grant API
• Preview: Update to Projects API to include org-wide projects
• Preview: Commit search API
• Audit outside collaborators for 2FA usage
• Traffic API is out of preview!
New API endpoints
2
26. Howpeople build software!
!
• Rate limits Off by default (no rate limits in GHE by default)
• Administrators can tune the numbers
• Enterprise support can help!
• Gitmon on by default for analytics but not limiting
Rate Limiting and Gitmon
2
27. Howpeople build software!
!
• HTTP and API requests from users and applications
• Pattern-based API rate limits
• ex: @monalisa asks for an issue’s comments 30 times per second
• Search rate limit
• Abuse rate limits for spammy behavior
What we can throttle •
32. Howpeople build software!
!
• Static website or a dynamic language web application
• Already have an application set up in CodeDeploy that’s successfully
deploying to a set of EC2 instances, with code stored in an S3 bucket.
Assumptions
44. Howpeople build software!
!
• Create an IAM User
• Add CodeDeploy API Access Policy to the IAM User with bare
minimum permissions to use the CodeDeploy API
Calling AWS CodeDeploy from GitHub
45. Howpeople build software!
!
MEDIA SLIDE(S)
• Two service hooks
• Hook 1: AWS CodeDeploy service hook that enables GitHub to call the
CodeDeploy API
• Create an IAM user with limited permissions
• Go to the IAM Users page in the AWS Management Console.
• Click Create New Users.
• Enter “GitHub” for the user name in the first row.
• Make sure that the option to generate an access key is checked
• Click Create.
• On the next page, click Show User Security Credentials to show the Access Key ID
and Secret Access Key
46. Howpeople build software!
!
• REMEMBER: Copy the Access ID and Secret Keys down and store them in a safe and
secure location – it is your last opportunity to download the Secret Key.
Calling AWS CodeDeploy from GitHub
47. Howpeople build software!
!
• Add the CodeDeploy Service to the GitHub Repository
Calling AWS CodeDeploy from GitHub
48. Howpeople build software!
!
MEDIA SLIDE(S)
• Click on the Settings tab.
• click the Webhooks & Services tab.
• click the Add Service drop-down, select AWS CodeDeploy.
• on the service hook page, enter the information needed to call CodeDeploy, including the
target AWS region, application name, target deployment group, and the access key ID
and secret access key from the IAM user created earlier.
• after entering this information, click Add Service.
• Hook 2: Automatic deployment hook (see below)
50. Howpeople build software!
!
• Create a GitHub personal access token for the Auto-Deployment service to trigger a
repository deployment
Automatically starting deployments from GitHub
51. Howpeople build software!
!
MEDIA SLIDE(S)
• create a GitHub personal access token for the Auto-Deployment service
to trigger a repository deployment.
• go to the Applications tab in the Personal Settings page for your GitHub
account.
• in the Personal Access Tokens section, click Generate New Token.
• enter “AutoDeploy” for the Token Description, uncheck all of the scope boxes,
and check only the repo_deployment scope.
• click Generate token.
• on the next page, copy the newly generated personal access token from the list,
and store it in a safe place with the AWS access keys from before - won’t be
able to access this token again.
52. Howpeople build software!
!
• Configure the GitHub Auto-Deployment service hook on GitHub.
Automatically starting deployments from GitHub
53. Howpeople build software!
!
MEDIA SLIDE(S)
• now configure the GitHub Auto-Deployment service hook on GitHub.
• from the home page for your GitHub repository, click on the Settings tab.
• on the Settings page, click the Webhooks & Services tab.
• services section, click the Add Service drop-down, and select GitHub Auto-
Deployment.
• on the service hook page, enter the information needed to call GitHub,
including the personal access token and target deployment group for
CodeDeploy.
• After entering this information, click Add Service.
54. Howpeople build software!
!
• Test Time
• Change the background colour
• Change some text
Automatically starting deployments from GitHub
55. Howpeople build software!
!
MEDIA SLIDE(S)
• test everything working together.
• from the home page of your GitHub repository, click the index.html in the file
list.
• on the file view page, click the pencil button on the toolbar above the file
content to switch into edit mode.
• change the web page content any way you like, such as by adding new text.
• click Commit changes. If prior configuration is set up correctly, a new
deployment should be started immediately.
57. Howpeople build software!
!
• Continuous Integration for building and testing
• Branching
• Pull requests
• Code Review
• Protected Branches
• Publish your application as Open Source!
• Collaborate with others.
• And much more…
Now what?
58. Howpeople build software!
!
• GitHub Auto-Deployment Blog
• http://www.atmos.org/github-services/auto-deployment
• CodeDeploy Developer Resources
• http://aws.amazon.com/codedeploy/developer-resources
Now what?