Challenge Overview

Challenge Objectives

  • Target environmentJIRA, Git, NodeJS CLI tool

  • Basic Requirements: Build a NodeJS CLI tool to generate 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 the previous challenges, we implemented the main structure of the CLI tool with the local git support and the remote GitLab repo support. In this challenge, you are required to implement the remote GitHub repo support. 

Unlike the local git support, to support the remote GitHub repo, all operations should be done by invoking GitHub APIs.

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, 

The codebase of the existing CLI app is https://gitlab.com/tc-cargo-net/cargo-net-cli.git

 

If you can’t access the codebase, you can use the Topcoder-X link provided in the forum to grant yourself access.

NOTE: All these github repos are public, but your CLI should also support the private GitHub repos. The reviewers should create private GitHub repo and verify the submission.

 

1. Code structure (VERY IMPORTANT)

The existing CLI app is already managed by Lerna split in the following modules

  1. CLI app: @cargo/cli

  2. Jira service lib: @cargo/jira

  3. Local git repo analysis lib: @cargo/local-git

  4. Remote GitLab repo lib: @cargo/gitlab

  5. Report generator: @cargo/report-gen

 

In this challenge, you need to add a new module @cargo/github to support the remote GitHub repo.

 

Similar to the existing modules, @cargo/github module should also expose the interface to interact with other modules. Specifically, it should support

  • Fetch logs of the specified git branch

  • Return git log messages in a given range, please note if the given range is large enough, you might need to call the APIs multiple times due to the pagination limits.

  • All these should be done by invoking GitHub APIs.

 

The @cargo/github and @cargo/gitlab should expose the same interface and be interchangeable. If you think the interface of @cargo/gitlab is not designed properly, feel free to update.

Please keep other modules as is and make sure your @cargo/github can work with the other modules as the same as @cargo/gitlab.

Don’t modify the interface of @cargo/report-gen, you can parse the prefix of the remote URL to determine whether it’s GitHub repo or GitLab repo.

 

2. Generate report and CLI usage

 

For the remote git repo, we don’t need to clone it to local, so to generate report, we need to add--remote-url <Remote Git Repository> --target-branch <branch> parameters.

 

If --target-branch is not provided, then targets to the default branch.

 

Here are some examples

 

cargo-net --start-tag="REL_1.0.0-256" --end-commit="HEAD" --output report.json --remote <Remote Git Repository> --target-branch <branch>

 

cargo-net --start-tag="REL_1.0.0-256" --end-commit="dc86fe" --output report.json --remote-url https://gitlab.com/tc-cargo-net/git-amend.git --target-branch master

cargo-net --start-commit="e965bf" --end-commit="dc86fe" --output report.json --remote-url https://gitlab.com/tc-cargo-net/git-amend.git --target-branch master

cargo-net --after="2019-02-15" --before="2019-04-15" --output report.json --remote-url https://github.com/tc-cargo-net/node-glob.git

 

3. Unit test

 

You should write Unit Tests in mocha and chai for the @cargo/github module, you must ensure

  • % Stmts: 100%

  • % Branch: 100%

  • % Funcs: 100%

  • % Lines: 100%

  • No uncovered lines

 

Important notes

  1. If you have any questions, feel free to ask in the forum. Any assumption without approval won’t be accepted.

  2. Please consider all the possible errors when calling the GitHub API and handle the error gracefully.

  3. If the GitHub repository requires authentication, you should use inquirer library to input credentials.

  4. Please keep the existing functionalities work well.

  5. Please keep the tslint config and tsconfig.json as is.

  6. Please keep the structure of the JSON as is.



Final Submission Guidelines

Please submit the following items in a zip archive. 

  • A git patch against the commit hash c0eba3996d478e3a5a69fd370bb65b65ed1d8c1f or later of https://gitlab.com/tc-cargo-net/cargo-net-cli.git master branch.

  • The updated 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.

  • separate document to verify your CLI tool working as expected.

  • A video to verify your CLI tool meets all requirements. If you are not comfortable with spoken English you may feel free to annotate your video with text.

  • Some sample reports in JSON and the corresponding converted HTML pages.

ELIGIBLE EVENTS:

Topcoder Open 2019

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30096472