How to Choose the Best CI Tool: Drone VS. Jenkins

introduce


Jenkins has been the industry standard CI tool for many years . It packs a lot of features and has nearly 1000 plugins in its ecosystem, which can be daunting for those who value simplicity. Jenkins has been around since before containers, but it's still a good fit for container environments. But it has to be said that Jenkins did not give any special attention to containers in the past, and it was not very committed to making containers better, but now the emergence and development of Blue Ocean and pipelines have greatly changed this situation .

 

Drone is a popular open source CI tool. It is actually native Docker, and all processes are carried out inside the container. This makes Drone ideal for platforms like Kubernetes , where launching containers is simple.

 

The Rancher container management platform provides excellent support for both Drone and Jenkins, and users can easily and quickly create Kubernetes clusters through an automated process. I deployed a K8s 1.8 cluster on GCE with Rancher 1.6 and it was amazing how easy the process was.

 

This article will deploy Drone on Kubernetes (Rancher) and will compare Drone with Jenkins from the following three aspects:

 

1. Platform installation and management

2. Plugin Ecosystem

3. Pipeline details

 

Finally, I'll do an overall comparison of Jenkins and Drone. In fact, usually, such comparisons do not have a clear winner. Because while the two have some similarities in nature, different tools still have different core focuses.

 

Preliminary preparation

 

Before we start, we need to complete some setup work, including setting up Drone as an authorized Oauth2 application with a Github account. For this part of the work, you can refer to Drone's official technical documentation.

 

When setting up the Drone, I had a problem: the relationship between the Drone and the source control repositories was a passive one. This means that Drone is notified of events by establishing a network connection with Github. The default behavior is based on the push and PR merge events. For Github to properly notify Drone, the server must be open to the world . Of course, the situation could be different if there were other in-house supply chain management software, but this does not apply in the case of the example in this article. For this, I set up my Rancher server on GCE so that it is accessible from Github.com.

 

Like other Kubernetes applications, installing Drone from a container requires going through a series of deployment files. I tweaked those deployment files found in the repo. In the configuration mapping specification file, we need to modify several values. That said, we need to set specific, Github-related values ​​for our account. We'll get the client secret from the setup step and put the secret into this file along with the username of the authorized user. With the Drone's keyfile, we can put the Github password in place.

 

Jenkins interacts with source code in a very different way than Drone. In Jenkins, each job can define its relationship to source control independently of the other. This allows users to extract source code from a variety of different repositories including Github, Gitlab, svn, and more . As of now, Drone only supports git-based development projects.

 

In the meantime, don't forget the Kubernetes cluster! Rancher makes it easy to start and manage Kubernetes clusters. This article uses the latest stable version of Rancher 1.6. However, the information and steps to install Rancher 2.0 are the same as Rancher 1.6 , so if you want to try out a newer Rancher it's not a bad idea.

 

Task 1 - Installation and Administration


Launching Drone on Kubernetes and Rancher is as easy as copy-paste. Use the default K8s dashboard startup file, upload it sequentially from the namespace and the configuration file, and the Drone can start running. [You can find some of the deployment files I used here: https://github.com/appleboy/drone-on-kubernetes/tree/master/gke]. I pulled the image from the repository and edited it locally. This repo is owned by Drone contributors and includes instructions on how to start GCE as well as AWS. The only thing we need here is the yaml file for Kubernetes. To reproduce, just edit the ConfigMap file with your specific values. An example of one of my files is as follows: 

1.jpg


Jenkins can also be started this way, since it can be deployed in a Docker container, you can build a similar deployment file and start it on Kubernetes. As shown below, the file is taken from the GCE example repo of the Jenkins CI server.

2.jpg

Starting Jenkins is also simple. Given the ease of use of Docker and Rancher, all you need to do to start Jenkins is to paste a set of deployment files into the dashboard . My preferred method is to use the Kubernetes dashboard for all management. Jenkins files can be uploaded one by one to get the server up and running.

 

Drone Server is managed through configuration files that are set during the startup phase. It must be connected to Github, which means that to access the library, an OAuth2 token needs to be added, and (in this example) a username and password. If you want to make changes later, you need to grant access to the organization through Github, or restart the server with new credentials. Doing so will inevitably impact development efforts, as it means that Drone cannot handle multiple sources. And as we mentioned earlier, Jenkins is better in this regard, it allows any number of source repos, with the caveat that only one source can be used per job .

 

Task 2 - Plugins


Drone插件的配置和管理非常简单。事实上,要成功启动一个Drone的插件,你需要做的事情并不多。与Jenkins相比,Drone的生态系统要小得多,但几乎所有可用的主要工具在Drone中都有插件可用。大多数主要的云提供商都有插件,并且与流行的源代码控制repo相集成。如前所述,可以将Drone容器视作“头等公民”,这意味着每个插件和执行的任务都是一个容器。

 

Jenkins是毫无争议的插件之王。大多数情况下,没有什么任务是Jenkins的插件完成不了的。Jenkins插件的可选择范围非常广,可供使用的插件约有1000个,但有时难就难要在从一系列看上去相似的插件中确定哪个才是最佳选择。

 

Drone有用于构建push和镜像的docker插件,也有用于部署集群的AWS和K8s插件等各种插件。由于Drone平台推出的时间短,它的插件比Jenkins少得多。然而,这并不影响它们的有效性和易用性。drone.yml文件中的一个简单节无需其他输入就能自动下载、配置和运行选定的插件。此外,由于Drone与容器的关系,每个插件都保存在一个镜像中,不需要再添加额外项进行管理。如果插件创建者完成了他们的工作, 所有的内容都将包含在该容器中,用户再无需管理任何依赖关系。

 

当我为简单节点应用程序构建drone.yml文件时,添加Docker插件非常简单,只需要几行代码,镜像就构建好了,并将其push到我选择的Dockerhub repo上。在下一节中,您可以看到标有docker的部分。本节是配置和运行插件以构建和推动Docker镜像所需的全部内容。

 

任务3


最终任务是任何CI系统的基础。Drone和Jenkins都旨在构建应用程序。最初,Jenkins是针对java应用程序构建的,但多年来,该范围已经扩展到任何可以编译和执行的代码。Jenkins甚至在新的管道和cron-job方面都游刃有余。然而,尽管它非常适合容器生态系统,但仍旧不是原生容器。

3.jpg

相比之下,这是同一应用的Jenkinsfile。

4.jpg

虽然这个例子解释起来很冗长,但是您可以看到,构建Docker镜像可能比Drone更复杂,而且还不包括Jenkins和Docker之间的交互。因为Jenkins不是原生Docker,所以必须提前配置代理以实现与Docker守护进程正确交互。 这可能会令人不解,但正是Drone的发展方向。Drone已经在Docker上运行了,它的任务也在同一Docker上运行。

 

结论


Drone是一款很棒的CI软件,并且正在成为时下流行的选择,如果您想要一个简单且能快速启动和运行的原生容器CI解决方案,Drone非常值得一试。虽然它仍处于预发布状态,很多工程师已经愿意并且在开始生产中尝试Drone了。在我看来,它占用内存小,使用简单,很适合在快速启动和运行方面有需求的小团队。

 

尽管Drone发展很快,但要撼动Jenkins在CI社区的根深蒂固的霸主地位仍需很多努力。Jenkins在适应市场方面一直非常成功,尤其是现在Blue Ocean和容器Pipeline为其CI界的领导性地位更加提供了强有力的支持。Jenkins可以适用于各种规模的团队并表现出色。由于其既往表现和众多整合因素,较大规模的组织更喜欢Jenkins。不论对开源社区,还是通过CloudBees提供企业级支持,Jenkins都能提供不同的支持选项。但与所有工具一样,Drone和Jenkins在CI生态系统中都有一席之地。





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324977072&siteId=291194637