Challenge Overview
Series Explanation
Topcoder Mobile wants to improve their CICD pipeline process by adding an automated chrome devtools profiler execution. The goal is to capture all of the rich data and metrics that chrome devtools provides and generate a scorecard based on that data. With this scorecard added to the CICD pipeline, Topcoder Mobile will be able to identify things like bad code and memory leaks before the code gets merged into the main branch.
Input of this challenge
We have a Docker image with Jenkins for CICD piplines from a previous challenge: https://www.topcoder.com/challenges/30062499/?type=develop
The Docker image is attached in the forum.
Also included is a dockerfile with an example of installing the chrome browser. This may be helpful in setting up chrome on the Jenkins docker image.
We have a reference app and its Chrome profiler process from a previous challenge: https://www.topcoder.com/challenges/30062497/?type=develop
The referenced app is hosted in this git repo: https://github.com/topcoderinc/Headlessrefapp
Requirements of this challenge
The goal of this challenge is to update the existing Docker image to create a process on Jenkins to build & run the reference app and execute the profiling on the headless Chrome.
The process should contain the following steps:
(1) Build execution
-
Pull the latest code from the repository
-
Run the tests included (See readme.md on reference app repo)
-
Build the application
(2) Headless Chrome Profiler Execution
-
Starting code available for this on reference application under /chrome-profiler/profile_site.js (You may need to pull the code out from the reference app and setup separately on docker for use by Jenkins, the method for handling this is open to your preference)
-
Start headless chrome with debugging
-
Run the app in the headless chrome environment
-
Generate the profiling data for the app on the headless chrome browser (this should be more than just loading the initial app page - open ended, consider Pupeteer: https://github.com/GoogleChrome/puppeteer/)
-
Network Data including XHR, IMG, JS
-
Memory usage data
-
CPU usage data
-
-
Save each profiler output to the repository root appended with the datetime of the profiler run
Chrome Profiler Recording Tips
For examples of executing remote chrome interface you can see the documentation here: https://github.com/cyrus-and/chrome-remote-interface and here: https://github.com/paulirish/automated-chrome-profiling
Be sure to document any third party code setup and configuration.
When to trigger the build process
The client wants to see the build process automated, so the build process should be triggered when
-
A new `git push` on the repo - When a developer pushes new code to the repo, the process should be triggered automatically.
-
A new `git merge` on the repo - When a developer merges a pull request to the master branch, the process should be triggered automatically.
To verify your submission, you need to fork the given repo https://github.com/topcoderinc/Headlessrefapp, and set the Jenkins to watch your forked repo, then demonstrate the process triggering by pushing code or merging code to your forked repo.
You are not allowed to push or merge code to the given repo directly.
Tips & References:
If you are new to Jenkins, this is a good video to help you get started: https://www.youtube.com/watch?v=V568cAbz2ls
For automatically setup Jobs on Jenkins, you may need to use Jenkins Pipeline and write Jenkinfile. Here is a reference https://jenkins.io/doc/book/pipeline/ It’s optional to use Jenkinfile, as long as your submission meets the requirements.
Third party code must not have GPL or AGPL license. MIT and equivelent licenses are acceptable.
Final Submission Guidelines
- Updated Docker Image with the build process (A single zip file)
- Readme.md with all steps to setup the build process, including the headless chrome execution and running chrome profiler.
- Documentation needs to be comprehensive enough so someone who has never done this before is able to set it up on another application / jenkins environment.
- Video demonstrating the build process and profiler run (feel free to annotate with text)