Challenge Overview
Challenge Objectives
- Target environment: JIRA, Git, NodeJS CLI tool
- Basic Requirements: Build a NodeJS CLI tool to generate a report for JIRA.
Project Background
Cargo-NET is a CLI (command line) tool that can take 2 points in git history (like two tags, commits etc), aggregate the commits within, find all Jira work items listed in the commit messages.
For each completed Jira issue, the tool should extract a report that contains the changelogs (commit messages) included in the release (since the last release).
For each Jira issue that is not completed yet, the tool should extract a report that contains a list of issues Ids and links to the issues that need to be reviewed.
Technology Stack Individual requirements
In this challenge, we are providing a JIRA sandbox for you to work on, the link of the JIRA sandbox and the credentials are provided in the forum.
We also provided a list of git repositories for you to test,
- https://gitlab.com/tc-cargo-net/git-amend.git
- https://gitlab.com/tc-cargo-net/ms.git
- https://gitlab.com/tc-cargo-net/chalk.git
- https://gitlab.com/tc-cargo-net/node-glob.git
- https://gitlab.com/tc-cargo-net/classname.git
If you can’t access these git repositories, you can use the Topcoder-X link provided in the forum to grant yourself access.
1. CLI tool name and installation
The name of the CLI tool is cargo-net. We can use
npm install -g
to install it globally.
The CLI tool must be written in Typescript. You are required to use tslint to lint your Typescript code. The code should be lint error-free.
2. Clone the remote git repository to local
cargo-net --clone <Remote Git Repository>
For example
cargo-net --clone https://gitlab.com/tc-cargo-net/git-amend.git
The tool clones the git repo to local.
It should also support to clone the specific branch by
cargo-net --clone <Remote Git Repository> --target-branch <branch>
If --target-branch is not provided, clone the default branch.
If the git repo is private, the tool should provide an input interface to input credentials for the authentication.
3. Generate report
The following CLI commands are executed in the local git repository directory.
By giving a range of commits, the tool should generate a report in the JSON format.
For each completed Jira issue, in the report, it contains the changelogs (commit messages) included in the release (since the last release).
For each Jira issue that is not completed yet, in the report it contains a list of issues Ids and links to the issues that need to be reviewed.
The range of the commits can be given by
- tag (--start-tag, --end-tag)
- commit hash (--start-commit, --end-commit)
- date (--before, --after)
For example, the following command lines can analyze the commits in the given range and generate the report in the file report.json
cargo-net --start-tag="REL_1.0.0-256" --end-commit="HEAD" --output report.json
cargo-net --start-tag="REL_1.0.0-256" --end-commit="dc86fe" --output report.json
cargo-net --start-commit="e965bf" --end-commit="dc86fe" --output report.json
cargo-net --after="2019-02-15" --before="2019-04-15" --output report.json
You are free to design the JSON structure, as long as it includes all the required info.
4. Code structure: use Lerna to manage the npm modules of the CLI (VERY IMPORTANT)
The CLI app should be split in the following modules
- CLI app: @cargo/cli
- Jira service lib: @cargo/jira
- Local git repo analysis lib: @cargo/local-git
- Report generator: @cargo/report-gen
You should use Lerna to manage the different npm packages. Here is a good quick Lerna tutorial to help you get started.
In the next challenge, we will implement more npm modules to support remote git repositories, so the code structure is VERY important.
Each module should expose the interface to interact with other modules, the functionality of each module should include:
- Jira service lib: @cargo/jira: A wrapper of JIRA API, to fetch JIRA issue info, statuses etc. The JIRA API host should be configurable.
- Local git repo analysis lib: @cargo/local-git:
- Clone the remote git repo to local
- Switch between git branches
- Return git log messages in a given range.
- Report generator: @cargo/report-gen
- Invoke @cargo/local-git to analyze the git log messages, identify the JIRA issue IDs that are linked to the git log messages. You should use a regex to identify the JIRA issue IDs, the regex pattern should be configurable.
- Invoke @cargo/jira to check the JIRA issue status, then generate report as per the requirement
- The generated report should be in a JSON file.
- CLI app: @cargo/cli: The entry of the CLI tool, it just wraps the other modules to implement the whole functionality.
5. Convert the JSON report to HTML
You need to write another simple script to convert the JSON report to an HTML page. The HTML page is not required to be fancy, as long as it looks good and readable.
6. Unit test
You should write Unit Tests in mocha and chai for the following npm packages
- CLI app: @cargo/cli
- Jira service lib: @cargo/jira
- Local git repo analysis lib: @cargo/local-git
- Report generator: @cargo/report-gen
Important notes
If you have any questions, feel free to ask in the forum. Any assumption without approval won’t be accepted.
Final Submission Guidelines
Please submit the following items in a zip archive.- The source code with the 4 npm packages.
- The source code of the simple script to convert the JSON report to HTML.
- A detailed README.md to describe how to build, deploy and run of the CLI. Also include how to run the simple script to convert the JSON report to HTML.
- A separate document to verify your CLI tool working as expected.
- Another separate document to describe the structure of the JSON.