Challenge Overview

“Configuration as code” is a technique to store environmental variables, feature flags, and other configuration items in an SCM the same way the code is stored.   When the code is deployed,  the CI process generates the specific configuration for the proper environment from the config SCM.  Then the CD process deploys it to the appropriate hosts alongside the new code.   The significant advantage of this approach is that configuration changes are tracked over time which is critical to support.   

Our client desires to build a configuration tool that allows developers and DevOps a standard and hierarchical approach and intuitive  form like User Interface for managing and maintaining complex configuration environments.   This tool would be called by the DevOps pipeline to generate JSON configurations for deployment to environments.   Spring Cloud Config project will serve as inspiration for this project.  

In this project, we are building a yaml editor, which is hosted by a NodeJS server running in a docker container. When user requests the UI with an HTTP GET request from the browser the NodeJS server (HapiJS) delivers the index.html and all static assets for the Angular application.  Once the application is running in the browser, the user wants to use it to edit some config files for user's deployed application. For this the user will need to give a git repo url and login credentials. The app would then send a message back to the NodeJS server to perform a shallow clone (we do not need history here) from the git origin (much the same that Jenkins does when it builds your source code).
Once the repo is cloned the nodejs server can deliver a file list to the browser (only YAML files are delivered, the other files are ignored). The app can either select  a file to edit, create a new one, or remove a file. The server either reads (or creates a new file) and sends the content to the browser. And we only need to work with files in the root directory of git repo, no need to support folder for now.  The app should not work on the master branch of the git repo, it should work on a default 'admin' branch. 

The app then parses the content and allows the user to edit/create properties within the default block, or select properties in the default block to copy to an environment for edit/override, or select an environment from a list of defined environments to add to this config file.

This challenge is responsible for implementing the REST APIs defined in the provided architecture.  And you should test it against the bitbucket.org. 
Note that for the "PUT 
/repos/{repoName}/files/{filepath}" and "GET /repos/{repoName}/files/{filepath}" endpoints, instead of receiving and returning a YAML file directly, a JSON file is received and returned. 
You will need to make necessary conversions ( the comments are stored in a special $comment property, and if a simple property has comment, its value will be stored in a special $value property).  

{
    "default": {
        "$comment": "all known properties are defined in the default block. \n The most common values are assigned in the default block",
        "myProp": {
            "$comment": "my property",
            "$value": "value 1"
        },
        "appVer": "0.1.5",
        "token": {
            "expiration": 10000,
            "expired": false
        },
        "host": {
            "$comment": "The url domain for the deployed environment",
            "$value": "www.mobilex.com"
        },
        "dataService": {
            "$comment": "url to access JSON Web API",
            "$value": "pd01.mobilex.com/data"
        }
    }, 

    "environments": {
        "$comment": "specific environments can override the default values 1 property at a time",
        "local": {
            "host": "localhost"
        },
        "dev": {
            "$comment": "environment for developer testing of fully compiled and integrated application",
            "host": "dev.mobilex.com"
        },
        "qat": {
            "$comment": "qat team validates all compiled artifacts in separate test ",
            "host": "qat.mobilex.com",
            "dataService": "pd03.mobilex.com/data"
        },
        "staging": {
            "host": "qat.mobilex.com"
        },
        "prod": {

        }

    }
}


Unit tests (Mocha + Chai) are required, and the coverage should be above 90%. 
And you must use TypeScript, and lint must be setup as well. 
Note that we will need to perform a shallow clone against the remote bitbucket repository, and if it's not doable with nodegit npm package, you can use the simple-git npm package instead. 

All the requirements in the provided ADS document are in scope as well (excluding the UI). 
 

Final Submission Guidelines

Submission Deliverable
- Source Code with Unit Tests
- Docker Image file to run the app
- Detailed Deployment Guide and Verification Guide
- postman including failure and success test-cases

ELIGIBLE EVENTS:

Topcoder Open 2019

REVIEW STYLE:

Final Review:

Community Review Board

Approval:

User Sign-Off

SHARE:

ID: 30070171