On our CI and Builds

On our CI and Builds

Presentation to internal Engineering team on exactly how our builds and CI work.

224884ff0b79e700e516e24fbcae6423?s=128

Nathan Kleyn

March 03, 2015
Tweet

Transcript

  1. On our CI and BUILDS HOW THEY WORK

  2. Or: How shit gets built and deployed.

  3. Builds involve:

  4. GitHub ∙ CircleCI Ruby ∙ Thor Docker

  5. And copious amounts of:

  6. Swearing ∙ Fear Punching ∙ Hate Quiet Weeping

  7. None
  8. On the PROCESS OF BUILDING A COMMIT

  9. The steps to build:

  10. 1. Make a commit.

  11. 2. Push to GitHub.

  12. 3. CircleCI is notified.

  13. 4. The build begins.

  14. 5. The Docker build begins.

  15. 6. The sanity build begins. (if master)

  16. 7. Deployment can begin.

  17. On the PUSHING OF A COMMIT

  18. GitHub receives your commit and dispatches a notification to CircleCI.

  19. Cheers bro. Welcome blud. all of teh infos

  20. CircleCI receives a payload of information telling it what commit

    this was.
  21. CircleCI starts a container up for the build.

  22. Boom bitches.

  23. It then looks for our circle.yml file.

  24. Each step of this file is executed.

  25. These steps execute a bunch of shell scripts in /circle.

  26. These steps... ∙ Configure versions of software to use (Ruby,

    Java, Kafka, HBase, etc). ∙ Restore the cache. ∙ Checkout the repository. ∙ Build all the projects. ∙ Test all the projects. ∙ Save all the artifacts to CircleCI.
  27. We have three different kinds of builds:

  28. Standard ∙ Docker Sanity

  29. We tell it what scripts to use by passing a

    MODE env var.
  30. Demo: The CircleCI build scripts.

  31. On the DOCKER BUILDS OUR CODE IN CONTAINERS

  32. Quick Docker refresher:

  33. Docker is built on the idea of containers.

  34. Many container!

  35. You build images. You deploy containers.

  36. How it happens:

  37. A second parameterised build is started for Docker.

  38. These builds have whatever info they need passed as parameters.

  39. It builds, tags and pushes the Docker images.

  40. The building happens on a separate machine.

  41. The pushed images are stored in the Docker registry.

  42. When we deploy, we pull down these images and run

    them (making containers!)
  43. On BUILD SCRIPTS USING AND ABUSING THOR

  44. Thor is a task framework.

  45. I’m actually really sensitive and kind.

  46. All of the things we do on CircleCI are Thor

    tasks.
  47. The Thor task sources are in /build-scripts/thor.

  48. Each task is namespaced. thor foo:bar

  49. You can get help for a task by running thor

    help task.
  50. All Thor tasks are just Ruby files. Thor is just

    a nice DSL.
  51. Demo: The Thor build scripts.

  52. On COMMON PROBLEMS SOLVING COMMON ISSUES

  53. Q: Gradle tasks hanging locally.

  54. A: Start the Nexus server.

  55. Q: Deployments fail as unable to pull from repository.

  56. A: Start the Docker registry.

  57. Q: Docker build fails with “no space left on device”.

  58. A: Restart the Docker server, if it still fails call

    for help.
  59. Q: “Expected ID but got nil”.

  60. A: (Sadly) Just retry the build. This is a Docker/library

    bug that happens randomly.
  61. Q: The tests are failing.

  62. A: Your tests are shit. Fix your tests.

  63. On BEING A BUILD EXPERT BECOME A ZOMG HACKER

  64. Demo: How to find the build to deploy.

  65. Demo: How to see what SHA is being built for

    Docker.
  66. Fin. I’m gonna eat your hairy legs.