Створення білда для проекту є дуже інтенсивним і складним процесом. Доповідь присвячена різним інструментам та технікам, які допоможуть прискорити цей процес та сконцентруватись на результаті.
34. GitHub API for lazy builders
sudo jo state=pending target_url=http://URL/job/PR_BUILDER_TESTS/$
{BUILD_NUMBER}/console description="Tests run has been started."
context="CIBox tests" > pending.json
curl -u [bot_name]:[token] https://api.github.com/repos/[org]/
[repo]/statuses/${PR_SHA1} --request POST --data @pending.json
Pending status
35.
36. GitHub API for lazy builders
# Run tests.
cd /var/www/build${PARENT_BUILD_NUMBER}
ansible-playbook tests.yml -i 'localhost,' --connection=local
# Set status and post comment to GitHub.
cd ${WORKSPACE}
sudo jo body="Behat test results file URL: http://URL/build$
{PARENT_BUILD_NUMBER}/build_reports/behat_report.html" >
comment.json
curl -u [bot_name]:[bot_token] https://api.github.com/repos/[org]/
[repo]/issues/${PR_ID}/comments --request POST --data @comment.json
sudo jo state=success target_url=http://URL/job/PR_BUILDER_TESTS/$
{BUILD_NUMBER}/console description="Tests run has been finished."
context="CIBox tests" > success.json
curl -u [bot_name]:[bot_token] https://api.github.com/repos/[org]/
[repo]/statuses/${PR_SHA1} --request POST --data @success.json
Tests + success status
38. GitHub API for lazy builders
cd ${WORKSPACE}
sudo jo state=failure target_url=http://URL/job/PR_BUILDER_TESTS/$
{BUILD_NUMBER}/console description="Tests run has been failed."
context="CIBox tests" > failed.json
curl -u [bot_name]:[bot_token] https://api.github.com/repos/[org]/
[repo]/statuses/${PR_SHA1} --request POST --data @failed.json
Failed status
39.
40.
41. Build hierarchy
Primary Build
Slave 1 Slave 2 Sniffers Tests
Comment + status
on GitHub
Comment +
status
on GitHub
Comment +
status
on GitHub
Comment +
status
on GitHub
Comment +
status
on GitHub
44. Optimize SQL import
SQL import is the most intensive operation
• Warm up databases for build?
• Bandwidth speed for downloading dumps
locally?
• Maintenance?
46. Create Docker Image
1. Run local Docker
repository(per project)
2. Pull base image cibox/mysql
3. Import database from
production dump
4. Create/Update image after
import
5. Push to local Docker
repository(per project)
47. Build pipeline
1.Pull changes from Docker Hub + Custom
Repository
2.Run Docker container
3.Specify in settings container’s IP
4.Container will be killed via cleaner
48. Benefits
1. Seconds to spin up container
2. Non-blocking operations for concurrent builds
3. Pull only changes(commits) to local environment
4. Update Docker Image daily
53. Why it faster now?
• ~2 seconds to spin up container
• ~2 seconds to clear Drupal 8 cache
• Non-Blocking operation in filesystem
• Isolated MySQL
• Run fast tests on build
• Run full tests on demo/dev site
55. Numbers
• Primary build
• ~15 mins -> ~3 mins
• Overall time
• ~3 mins before testing of main product
• ~6-8 mins before testing of secondary products
• ~6-8 mins before sniffers & test results
62. – Chang Xiao, FFW
“I swear to god our vagrant is
like the nerdiest thing ever.”
“It should be like making a
ANSCII sandwich, brewing some
tea, waiting for your local
environment to be fully baked.”