webhintio / hint

πŸ’‘ A hinting engine for the web
https://webhint.io/
Apache License 2.0
3.6k stars 648 forks source link

Research CI Improvements [3] #1621

Closed antross closed 5 years ago

antross commented 5 years ago

Travis has been really slow and we've had trouble getting Windows to work. Need some investigation to determine if we can improve the speed and reliability of our existing pipeline or if we should consider migrating to an alternative CI solution.


Current status

The webhint project is using Travis CI as its CI system. It's used in all the project that require a build step: hint, webhint.io, and online service.

The project that has the most complex configuration is hint. We are testing for Linux and Mac and for 3 different node versions:

Travis offers 5 workers that are shared across the whole organization. To speed up the CI process, we split hint's build into multiple chunks that run the tests for the things that have been modified. While this has the benefit of having faster build times for a given PR (running all the tests on Travis was getting close to 1h for a given OS and node target), the problem is that we run less simultaneous branches builds. In fact, right now a build in hint spawns 12 jobs. A temporary workaround would be to disable builds for a specific target (probably node 10). This will improve a bit the build times but it's more of a band-aid than a long term solution.

While there aren't that many changes on any given day, sometimes greenkeeper can generate a few branches and PRs making the queue extremely long and slowing progress. It will be nice to de-prioritize commits from specific authors or keywords (ala [skip ci]).

In the past we were using also AppVeyor but we stopped because results were unreliable. Travis recently added support for Windows builds but couldn't make it work without any changes.

Other issues we have are reliability running the tests. Sometimes there are workers that fail and running the job again is enough to pass the build. It will be nice to have an auto-retry option.

Also, right now we are having more and more targets: npm, VS Code, browsers, etc. It will be nice to auto-publish when possible, even have a developer version (@next) that automatically gets promoted periodically.

In summary, this is what we want to solve:

Possible solutions

Continue with Travis

The main advantage of Travis is that it's already working. There are a few things we should do:

The main cons are:

AppVeyor

AppVeyor supports Linux builds but not macOS. Also we disable it because of reliability problems when running the tests. On top of that, they take quite some time to update their VMs to support newer versions of node.

I don't think it's a viable option.

Azure Pipelines

Azure Pipelines is a new CI/CD system by Microsoft. It supports Linus, macOS and Windows and it's free for OSS projects with 10 free parallel jobs. We can also pay for more parallel jobs ($40/mo).

Pros:

Cons:

Jenkins

Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software.

Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with a Java Runtime Environment (JRE) installed.

This means it can run on Windows, macOS, and Linux. We can also scale by adding more workers but the biggest con is that we have to maintain the whole infrastructure, update versions, deal with security issues, authentication, etc.

You can use pipelines, written using Groovy syntax, to define the different build and release steps. There is a new UI called Blue Ocean which is a lot better than what was available a few years back.

Pros:

Cons:

Summary

The following is a table with the summary of the above. The one that looks more promising for now is Azure Pipelines so I'll continue investigating it a bit more unless someone else has another idea.

Travis AppVeyor Jenkins Azure Pipelines
multiOS βœ… (beta) ❌ (mac) βœ… βœ…
Free βœ… βœ… ❌ (infra) βœ…
# workers 5/org 1 β™Ύ (VMs) 10/project(?) + $40/mo per extra
Plugins ❌ ❌ βœ… βœ…
Language yaml yaml Groovy yaml + templates
Managed βœ… βœ… ❌ βœ…
Queue priority ❌ ❌ βœ… (plugin) ❌
Services integration Manual Manual Via plugins Via plugins
molant commented 5 years ago

@webhintio/core I'll be updating the first comment with the research I do, feel free to let me know if I miss any requirements.

molant commented 5 years ago

Things to test in Azure Pipelines:

@webhintio/core something else I should

kaylangan commented 5 years ago

I'm a Program Manager on Azure Pipelines. To answer a few of your questions:

You need to use yml to configure it (although that's more of a personal issue...), but you can use templates to split them.

We do have a visual designer, but we do strongly encourage using yml.

Maintainers with access to the dashboard might need an account different than a GitHub one. Need to double check on this.

At the moment, yes, you will need a different account. We are currently working on integrating with GitHub identities and that's coming soon.

Find how to add secrets

Check out the docs here.

molant commented 5 years ago

Hi @kaylangan, thanks for your answers!

I have a couple issues so far with Pipelines that I hope you can help me with:

  1. Is there a way to restart an agent that has failed? Similar to what Travis allows you? I asked this on Twitter yesterday
  2. Is there an easy way to find the name of the built-in and marketplace tasks? I started with a yml file but find out I needed to install a yarn task to make sure all the agents were using the same version and the only way I find out was to start creating a new pipeline using the editor and then switching to yml to copy paste 😞
kaylangan commented 5 years ago
  1. Is there a way to restart an agent that has failed? Similar to what Travis allows you? I asked this on Twitter yesterday

On the Checks tab, you can click "Re-run": image

  1. Is there an easy way to find the name of the built-in and marketplace tasks? I started with a yml file but find out I needed to install a yarn task to make sure all the agents were using the same version and the only way I find out was to start creating a new pipeline using the editor and then switching to yml to copy paste 😞

For the tasks, you can find the tasks repo here. In the task.json file, you can find the name of the task. For example, for the UsePythonVersion task: https://github.com/Microsoft/azure-pipelines-tasks/blob/master/Tasks/UsePythonVersionV0/task.json#L3.

molant commented 5 years ago

I think I have everything I need for this research. Azure Pipelines looks pretty solid and a good option for us and now is more of a question of tweaking and polishing. I'll keep working on my fork until I have something ready to get merge into the main repo and open individual task for each thing.