PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 1ms app.codeStats 0ms

/source/posts/2016-03-29-gitlab-runner-1-1-released.html.md

https://gitlab.com/gshaheen/www-gitlab-com
Markdown | 231 lines | 179 code | 52 blank | 0 comment | 0 complexity | 2e89310300e834c10df95477daec0673 MD5 | raw file
  1. ---
  2. layout: post
  3. title: "GitLab Runner 1.1 with Autoscaling"
  4. date: 2016-03-29 14:00
  5. categories:
  6. author: Kamil Trzciński
  7. author_twitter: ayufanpl
  8. image_title: '/images/unsplash/high-road.jpg'
  9. ---
  10. Over the last year, GitLab Runner has become a significant part of the GitLab
  11. family. We are happy to announce that GitLab Runner 1.1 is released today; a
  12. release that brings major improvements over its predecessor. There is one
  13. feature though that we are excited about and is the cornerstone of this release.
  14. Without further ado, we present you GitLab Runner 1.1 and its brand-new, shiny
  15. feature: Autoscaling!
  16. <!-- more -->
  17. ## About GitLab Runner
  18. GitLab has [built-in continuous integration][doc-ci] to allow you to run a
  19. number of tasks as you prepare to deploy your software. Typical tasks
  20. might be to build a software package or to run tests as specified in a
  21. YAML file. These tasks need to run by something, and in GitLab this something
  22. is called a [Runner][doc-runners]; an application that processes builds.
  23. GitLab Runner 1.1 is the biggest release yet. Autoscaling provides the ability
  24. to utilize resources in a more elastic and dynamic way. Along with autoscaling
  25. come some other significant features as well. Among them is support for a
  26. distributed cache server, and user requested features like passing artifacts
  27. between stages and the ability to specify the archive names are now available.
  28. Let's explore these features one by one.
  29. ## The Challenge of Scaling
  30. Other continuous integration platforms have a similar functionality.
  31. For example, Runners are called "Agents" in Atlassian's Bamboo (which integrates
  32. with Bitbucket.) Some services, like Bamboo, charge individually for using these
  33. virtual machines and if you need a number of them it can get quite expensive,
  34. quite quickly. If you have only one available Agent or Runner, you could be
  35. slowing down your work.
  36. We don't charge anything for connecting Runners in GitLab, it’s all built-in.
  37. However, the challenge up until now has been the scaling of these Runners. With
  38. GitLab, Runners can be specified per project, but this means you have to create
  39. a Runner per project, and that doesn't scale well.
  40. An alternative up until now was to create a number of [shared Runners] which
  41. can be used across your entire GitLab instance.
  42. However, what happens when you need more Runners than there are available?
  43. You end up having to queue your tasks, and that will eventually slow things down.
  44. Hence the need for autoscaling.
  45. ## Autoscaling increases developer happiness
  46. We decided to build autoscaling with the help of [Docker Machine][docker-machine].
  47. Docker Machine allows you to provision and manage multiple remote Docker hosts
  48. and supports a vast number of [virtualization and cloud providers][docker-machine-driver],
  49. and this is what autoscaling currently works only with.
  50. Because the Runners will autoscale, your infrastructure contains only as
  51. many build instances as necessary at anytime. If you configure the Runner to
  52. only use autoscale, the system on which the Runner is installed acts as a
  53. bastion for all the machines it creates.
  54. Autoscaling allows you to increase developer happiness. Everyone hates to wait
  55. for their builds to be picked up, just because all Runners are currently in use.
  56. The autoscaling feature promotes heavy parallelization of your tests, something
  57. that is made easy by defining multiple [jobs] in your `.gitlab-ci.yml` file.
  58. While cutting down the waiting time to a minimum makes your developers happy,
  59. this is not the only benefit of autoscaling. In the long run, autoscaling
  60. reduces your infrastructure costs:
  61. - autoscaling follows your team's work hours,
  62. - you pay for what you used, even when scaling to hundreds of machines,
  63. - you can use larger machines for the same cost, thus having your builds run
  64. faster,
  65. - the machines are self-managed, everything is handled by docker-machine, making
  66. your Administrators happy too,
  67. - your responsibility is to only manage GitLab and one GitLab Runner instance.
  68. Below, you can see a real-life example of the Runner's autoscale feature, tested
  69. on GitLab.com for the [GitLab Community Edition][ce] project:
  70. ![Real life example of autoscaling](/images/runner_1_1/auto-scaling-gitlab-com.png)
  71. Each machine on the chart is an independent cloud instance, running build jobs
  72. inside Docker containers. Our builds are run on DigitalOcean 4GB machines, with
  73. CoreOS and the latest Docker Engine installed.
  74. [DigitalOcean] proved to be one of the best choices for us, mostly because of
  75. the fast spin-up time (around 50 seconds) and their very fast SSDs, which are
  76. ideal for testing purposes. Currently, our GitLab Runner processes up to 160
  77. builds at a time.
  78. If you are eager to test this yourself, read more on [configuring the new
  79. autoscaling feature][doc-autoscale].
  80. ## Distributed cache server
  81. In GitLab Runner 0.7.0 we introduced support for [caching]. This release brings
  82. improvements to this feature too, which is especially useful with autoscaling.
  83. GitLab Runner 1.1 allows you to use an external server to store all your caches.
  84. The server needs to expose an S3-compatible API, and while you can use for
  85. example Amazon S3, there are also a number of other servers that you can run
  86. on-premises just for the purpose of caching.
  87. Read more [about the distributed cache server][doc-cache] and learn how to set
  88. up and configure your own.
  89. ## Artifacts improvements
  90. We listen closely to our community to extend GitLab Runner with user requests.
  91. One of the often-requested features was related to passing artifacts between
  92. builds.
  93. GitLab offers some awesome capabilities to define multiple [jobs] and group
  94. them in different [stages]. The jobs are always independent, and can be run on
  95. different Runners.
  96. Up until now, you had to use an external method if you wanted to pass the files
  97. from one job to another. With GitLab Runner 1.1 this happens automatically.
  98. Going one step further, GitLab 8.6 allows you to fine-tune _what_ should be
  99. passed. This is now handled by defining [dependencies]:
  100. ```yaml
  101. build:osx:
  102. stage: build
  103. artifacts: ...
  104. test:osx:
  105. stage: test
  106. dependencies:
  107. - build:osx
  108. ```
  109. The second most-requested feature was the ability to change the name of the
  110. uploaded artifacts archive. With GitLab Runner 1.1, this is now possible with
  111. this simple syntax:
  112. ```yaml
  113. build_linux:
  114. artifacts:
  115. name: "build_linux_$CI_BUILD_REF_NAME"
  116. ```
  117. Read more [about naming artifacts][artifacts-name].
  118. ## Improved documentation
  119. With GitLab Runner 1.1 we've also released improved documentation, explaining
  120. all executors and commands. The documentation also describes what features are
  121. supported by different configurations.
  122. Read the [revised documentation][doc-improved].
  123. ## Using Runner on OSX
  124. We also upgraded GitLab Runner 1.1 to be compatible with El Capitan and Xcode 7.3.
  125. You should read the revised [installation guide for OSX][osx-install]
  126. and FAQ section describing the [needed preparation steps][osx-faq].
  127. ## Changelog
  128. So far we described the biggest features, but these are not all the changes
  129. introduced with GitLab Runner 1.1. We know that even the smallest change can
  130. make a difference in your workflow, so here is the complete list:
  131. ```
  132. - Use Go 1.5
  133. - Add docker-machine based autoscaling for docker executor
  134. - Add support for external cache server
  135. - Add support for `sh`, allowing to run builds on images without the `bash`
  136. - Add support for passing the artifacts between stages
  137. - Add `docker-pull-policy`, it removes the `docker-image-ttl`
  138. - Add `docker-network-mode`
  139. - Add `git` to gitlab-runner:alpine
  140. - Add support for `CapAdd`, `CapDrop` and `Devices` by docker executor
  141. - Add support for passing the name of artifacts archive (`artifacts:name`)
  142. - Refactor: The build trace is now implemented by `network` module
  143. - Refactor: Remove CGO dependency on Windows
  144. - Fix: Create alternative aliases for docker services (uses `-`)
  145. - Fix: VirtualBox port race condition
  146. - Fix: Create cache for all builds, including tags
  147. - Fix: Make the shell executor more verbose when the process cannot be started
  148. - Fix: Pass gitlab-ci.yml variables to build container created by docker executor
  149. - Fix: Don't restore cache if not defined in gitlab-ci.yml
  150. - Fix: always use `json-file` when starting docker containers
  151. ```
  152. You can see why we think version 1.1 is fantastic.
  153. Go get it, test it and share your feedback with us!
  154. You can meet with the CI team in our upcoming webcast.
  155. ## Live webcast: GitLab CI
  156. Sign up for our webcast on April 14th, which includes an overview and tutorial
  157. about using GitLab CI. Meet people from the GitLab CI team and get your questions
  158. answered live!
  159. - Date: Thursday, April 14, 2016
  160. - Time: 5pm (17:00) UTC; 12pm EST; 9am PST
  161. - [Register here](http://page.gitlab.com/apr-2016-gitlab-intro-ci-webcast.html)
  162. Can't make it? Register anyway, and we'll send you a link to watch it later!
  163. [docker-machine]: https://docs.docker.com/machine/
  164. [docker-machine-driver]: https://docs.docker.com/machine/drivers/
  165. [ce]: https://gitlab.com/gitlab-org/gitlab-ce
  166. [doc-runners]: http://doc.gitlab.com/ce/ci/runners/README.html
  167. [doc-ci]: /gitlab-ci
  168. [doc-autoscale]: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/configuration/autoscale.md
  169. [doc-improved]: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/README.md
  170. [doc-cache]: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/configuration/autoscale.md#distributed-runners-caching
  171. [shared runners]: http://doc.gitlab.com/ce/ci/runners/README.html
  172. [stages]: http://doc.gitlab.com/ce/ci/yaml/README.html#stages
  173. [digitalocean]: https://www.digitalocean.com/
  174. [caching]: http://doc.gitlab.com/ce/ci/yaml/README.html#cache
  175. [jobs]: http://doc.gitlab.com/ce/ci/yaml/README.html#jobs
  176. [dependencies]: http://doc.gitlab.com/ce/ci/yaml/README.html#dependencies
  177. [artifacts-name]: http://doc.gitlab.com/ce/ci/yaml/README.html#artifactsname
  178. [osx-install]: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/install/osx.md#install-on-osx
  179. [osx-faq]: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/faq/README.md#12-failed-to-authorize-rights-0x1-with-status-60007