0.0.5 • Published 3 years ago

@kie/chain-status-action v0.0.5

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
3 years ago

Generate Data JS Tool

This package provides a NodeJS CLI tool which basically consumes information from Github API and/or Jenkins API and generates a JSON file which is retrieved by the React web application.

Usage

This tool can be easy use as a NodeJS CLI tool or as a Github Action

NodeJS CLI Usage

In order to use you just need to install all required libraries, build the project and run the automatically generated distribution file at packages/action/dist/index.js.

  1. Install libraries run it from the project's root
$ yarn
  1. Run the tool, this can be done either Command Line Interface approach (see local dev section) or using Github action (see action flow section)

Inputs

In this section you can find overall list of inputs that you can or must provide to the tool, either using cli or using the Github workflow.

FieldRequiredDefaultDescription
github-tokentrueThe Github token that must be used to interact with Github API
definition-filetrueThe file containing all projects for which you want to provide the status, an example - more infos here
titlefalseProject statusThe project/webapp title
subtitlefalseContribution statusThe project/webapp subtitle
base-branch-filterfalseA comma separated list of base branches RegEx to be filtered. Like main,7.59.x,8.x or main,^7.*
project-filterfalseA comma separated list of project RegEx to be filtered. Like drools,opta.* or jbpm,^drools.*
created-byfalsegithub actionThe user/machine/whatever that regenerates the report
created-urlfalseNormally the job generating the info URL
logger-levelfalseinfoThe log level. 'info' (default) | 'trace' | 'debug'
gh-pages-branchfalsegh-pagesThe branch used by gh-pages tool, where the webpage will be stored
branchesfalse[]The list of branches for which to provide branches comparison

Local Execution

In order to locally run this, you simply need to run the cli tool providing at least all required arguments (more details in inputs section)

Here an usage example:

$ node packages/action/src/bin/cli.js -t 'Title' -st 'Subtitle' --token <GH-TOKEN> -df https://raw.githubusercontent.com/kiegroup/kogito-pipelines/main/.ci/pull-request-config.yaml [-o <PATH-TO-REACT-WEBAPP-DATA>]

Github Action Flow

This tool can be integrated in a Github action in order to automate the data generation process, for this purpose this project comes with an easy to use Github action that you only need to use in your own Github workflows.

Here the main important steps performed by generate-data action:

  1. Checkout in the branch where you want to store the webpage code and content, the default is gh-pages.
  2. Execute the chain-status tool that, given a set of inputs, compute the configuration files and all the contents that are used by the webpage - this execution is performed using another Github action.
  3. Commit and push the newly generated data in the target branch (e.g., gh-pages).