Apollo Chrome Extension

Every other Friday at Thrillist Media Group is "Hacker Friday" -- a day devoted to working on side projects for the company. Apollo is my first chrome extension; it deploys code to our staging servers with one click. I'm not done writing this yet :)





Features

Click to Deploy

Apollo's staging button reveals a dropdown of staging servers. Just click one to start deploying. In the background, Jenkins has kicked off a job and is deploying the code from pull request's branch onto your selected server.

done

Identify QAed Branches

Apollo's dropdown knows which branches in the list have been marked as QAed. It is usually safe to deploy to a staging server that is marked as QAed because testing should be complete.

autorenew

Progress Bar

Once a job has been kicked off, Jenkins comes back with an estimated time to completion. This estimated time is visualized as a progress bar at the top of the page - thanks nanobar.js!



Credits

Apollo depends on two major components to operate. Before I dive into details of Apollo, I feel compelled to give a couple of shout outs to those responsible for each dependent component.

DevOps

The DevOps team at Thrillist Media Group is led by Tim Mahoney. He set us up with our staging infrastructure as well as the Jenkins jobs that deploy code to the boxes. All Apollo has to do is POST a payload to a Jenkins endpoint. Jenkins then kicks off a job that runs ansible plays on our staging machines. Tim's heavy lifting paved the way for this chrome extension to come into being.

Whiteboard

Whiteboard is an in-house application that was created by our Lead Front End Developer Joe Higgins on a hacker Friday. The app is a real-time dashboard that lists the different branches running on each of our staging servers. Before this app, we used to write this information on a whiteboard near our desks, hence the name. This app has an API endpoint that Apollo uses to populate the dropdown of servers.



POSTing to Jenkins

After collecting the information about the code that the user wishes to deploy, Apollo bundles it into a payload and POSTs it to Jenkins.

            
              function jenkinsDeploy(launchData){
                var deployRequest = $.ajax({
                    type: 'POST',
                    url: window.launchURL+"/view/Deploy/job/Pinnacle%20Staging/buildWithParameters",
                    data: launchData,
                    success: function(res, status, xhr){
                        var queueItem = xhr.getResponseHeader("location").split("jenkins.thrillist.com/queue")[1];
                        pollQueue(queueItem);
                    },
                    error: function(msg){
                      console.log('error with jenkinsDeploy');
                      console.log(msg);
                    }
                });
              }