Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job summary service #307

Merged
merged 6 commits into from Aug 23, 2022
Merged

Conversation

shubhbapna
Copy link
Contributor

Resolves #261

To preview of how the job summary will look like:

Build Chain Execution Summary

Project Starting the Job: owner2/project2

Pre
CommandExecution ResultExecution Time
cmd11
cmd22
cmd33
Execution phase: before
ProjectSourceTargetMergedExecution ResultAvg Execution Time
owner1/project1checkout skippedcheckout skipped0
owner2/project2owner2/project2:mainowner2/project2:main2
owner3/project3owner3/project3:mainowner3-forked/project3-forked:dev3
flowchart LR;
        owner1/project1:::noEntry==>owner2/project2:::okClass==>owner3/project3:::errorClass
        click owner1/project1 'https://github.com/owner1/project1'
				click owner2/project2 'https://github.com/owner2/project2'
				click owner3/project3 'https://github.com/owner3/project3'
        classDef okClass fill:#218838,stroke:#1e7e34,color: #fff,border-radius: 4px
        classDef errorClass fill:#dc3545,stroke:#dc3545,color: #fff,border-radius: 4px
        classDef noEntry fill:#6c757d,stroke:#6c757d,color: #fff,border-radius: 4px
Execution phase: commands
ProjectSourceTargetMergedExecution ResultAvg Execution Time
owner1/project1checkout skippedcheckout skipped0
owner2/project2owner2/project2:mainowner2/project2:main2
owner3/project3owner3/project3:mainowner3-forked/project3-forked:dev3
flowchart LR;
        owner1/project1:::noEntry==>owner2/project2:::okClass==>owner3/project3:::errorClass
        click owner1/project1 'https://github.com/owner1/project1'
				click owner2/project2 'https://github.com/owner2/project2'
				click owner3/project3 'https://github.com/owner3/project3'
        classDef okClass fill:#218838,stroke:#1e7e34,color: #fff,border-radius: 4px
        classDef errorClass fill:#dc3545,stroke:#dc3545,color: #fff,border-radius: 4px
        classDef noEntry fill:#6c757d,stroke:#6c757d,color: #fff,border-radius: 4px
Execution phase: after
ProjectSourceTargetMergedExecution ResultAvg Execution Time
owner1/project1checkout skippedcheckout skipped0
owner2/project2owner2/project2:mainowner2/project2:main2
owner3/project3owner3/project3:mainowner3-forked/project3-forked:dev3
flowchart LR;
        owner1/project1:::noEntry==>owner2/project2:::okClass==>owner3/project3:::errorClass
        click owner1/project1 'https://github.com/owner1/project1'
				click owner2/project2 'https://github.com/owner2/project2'
				click owner3/project3 'https://github.com/owner3/project3'
        classDef okClass fill:#218838,stroke:#1e7e34,color: #fff,border-radius: 4px
        classDef errorClass fill:#dc3545,stroke:#dc3545,color: #fff,border-radius: 4px
        classDef noEntry fill:#6c757d,stroke:#6c757d,color: #fff,border-radius: 4px
Post
CommandExecution ResultExecution Time
cmd11
cmd22
cmd33
Local ExecutionYou can copy paste the following commands to locally execute build chain tool.
npm i @kie/build-chain-action@2.3.35 -g build-chain-action -f definitionFile build cross_pr -u eventUrl

Git Version: 1.0.1

Notice: The GITHUB_TOKEN should be set in the environment.

@shubhbapna shubhbapna requested a review from Ginxo August 22, 2022 21:16
@Ginxo
Copy link
Contributor

Ginxo commented Aug 23, 2022

Testing output

Build Chain Execution Summary

Project Starting the Job: owner2/project2

Pre
CommandExecution ResultExecution Time
cmd11
cmd22
cmd33
Execution phase: before
ProjectSourceTargetMergedExecution ResultAvg Execution Time
owner1/project1checkout skippedcheckout skipped0
owner2/project2owner2/project2:mainowner2/project2:main2
owner3/project3owner3/project3:mainowner3-forked/project3-forked:dev3
flowchart LR;
        owner1/project1:::noEntry==>owner2/project2:::okClass==>owner3/project3:::errorClass
        click owner1/project1 'https://github.com/owner1/project1'
				click owner2/project2 'https://github.com/owner2/project2'
				click owner3/project3 'https://github.com/owner3/project3'
        classDef okClass fill:#218838,stroke:#1e7e34,color: #fff,border-radius: 4px
        classDef errorClass fill:#dc3545,stroke:#dc3545,color: #fff,border-radius: 4px
        classDef noEntry fill:#6c757d,stroke:#6c757d,color: #fff,border-radius: 4px
Execution phase: commands
ProjectSourceTargetMergedExecution ResultAvg Execution Time
owner1/project1checkout skippedcheckout skipped0
owner2/project2owner2/project2:mainowner2/project2:main2
owner3/project3owner3/project3:mainowner3-forked/project3-forked:dev3
flowchart LR;
        owner1/project1:::noEntry==>owner2/project2:::okClass==>owner3/project3:::errorClass
        click owner1/project1 'https://github.com/owner1/project1'
				click owner2/project2 'https://github.com/owner2/project2'
				click owner3/project3 'https://github.com/owner3/project3'
        classDef okClass fill:#218838,stroke:#1e7e34,color: #fff,border-radius: 4px
        classDef errorClass fill:#dc3545,stroke:#dc3545,color: #fff,border-radius: 4px
        classDef noEntry fill:#6c757d,stroke:#6c757d,color: #fff,border-radius: 4px
Execution phase: after
ProjectSourceTargetMergedExecution ResultAvg Execution Time
owner1/project1checkout skippedcheckout skipped0
owner2/project2owner2/project2:mainowner2/project2:main2
owner3/project3owner3/project3:mainowner3-forked/project3-forked:dev3
flowchart LR;
        owner1/project1:::noEntry==>owner2/project2:::okClass==>owner3/project3:::errorClass
        click owner1/project1 'https://github.com/owner1/project1'
				click owner2/project2 'https://github.com/owner2/project2'
				click owner3/project3 'https://github.com/owner3/project3'
        classDef okClass fill:#218838,stroke:#1e7e34,color: #fff,border-radius: 4px
        classDef errorClass fill:#dc3545,stroke:#dc3545,color: #fff,border-radius: 4px
        classDef noEntry fill:#6c757d,stroke:#6c757d,color: #fff,border-radius: 4px
Post
CommandExecution ResultExecution Time
cmd11
cmd22
cmd33
Local ExecutionYou can copy paste the following commands to locally execute build chain tool.
npm i @kie/build-chain-action@2.3.35 -g build-chain-action -f definitionFile build cross_pr -u eventUrl

Git Version: 1.0.1

Notice: The GITHUB_TOKEN should be set in the environment.

Copy link
Contributor

@Ginxo Ginxo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check my comments.
I propose to add open on every <details> section, like <details open>.
I propose to add title section before every detail, it seems the design has not weight enough, something like

## Pre
<details open><summary>Pre</summary>....

wdyt?

private constructGraph(executionResult: ExecuteNodeResult[]) {
return `flowchart LR;
${executionResult
.map((res) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.map((res) => {
.map(res => {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof sorry about this. I use VS code formatter for quick formatting and i think it adds these parenthesis

@shubhbapna
Copy link
Contributor Author

shubhbapna commented Aug 23, 2022

the addDetails method does not have any parameters to add the open attribute. I will have to use addRaw is that okay?
I can also wrap the summary title in a heading so we won't need a separate one.

Here is a preview of what it could look like:

Build Chain Execution Summary

Project Starting the Job: owner2/project2

Pre

CommandExecution ResultExecution Time
cmd11
cmd22
cmd33

Execution phase: before

ProjectSourceTargetMergedExecution ResultAvg Execution Time
owner1/project1checkout skippedcheckout skipped0
owner2/project2owner2/project2:mainowner2/project2:main2
owner3/project3owner3/project3:mainowner3-forked/project3-forked:dev3
flowchart LR;
        owner1/project1:::noEntry==>owner2/project2:::okClass==>owner3/project3:::errorClass
        click owner1/project1 'https://github.com/owner1/project1'
				click owner2/project2 'https://github.com/owner2/project2'
				click owner3/project3 'https://github.com/owner3/project3'
        classDef okClass fill:#218838,stroke:#1e7e34,color: #fff,border-radius: 4px
        classDef errorClass fill:#dc3545,stroke:#dc3545,color: #fff,border-radius: 4px
        classDef noEntry fill:#6c757d,stroke:#6c757d,color: #fff,border-radius: 4px

Execution phase: commands

ProjectSourceTargetMergedExecution ResultAvg Execution Time
owner1/project1checkout skippedcheckout skipped0
owner2/project2owner2/project2:mainowner2/project2:main2
owner3/project3owner3/project3:mainowner3-forked/project3-forked:dev3
flowchart LR;
        owner1/project1:::noEntry==>owner2/project2:::okClass==>owner3/project3:::errorClass
        click owner1/project1 'https://github.com/owner1/project1'
				click owner2/project2 'https://github.com/owner2/project2'
				click owner3/project3 'https://github.com/owner3/project3'
        classDef okClass fill:#218838,stroke:#1e7e34,color: #fff,border-radius: 4px
        classDef errorClass fill:#dc3545,stroke:#dc3545,color: #fff,border-radius: 4px
        classDef noEntry fill:#6c757d,stroke:#6c757d,color: #fff,border-radius: 4px

Execution phase: after

ProjectSourceTargetMergedExecution ResultAvg Execution Time
owner1/project1checkout skippedcheckout skipped0
owner2/project2owner2/project2:mainowner2/project2:main2
owner3/project3owner3/project3:mainowner3-forked/project3-forked:dev3
flowchart LR;
        owner1/project1:::noEntry==>owner2/project2:::okClass==>owner3/project3:::errorClass
        click owner1/project1 'https://github.com/owner1/project1'
				click owner2/project2 'https://github.com/owner2/project2'
				click owner3/project3 'https://github.com/owner3/project3'
        classDef okClass fill:#218838,stroke:#1e7e34,color: #fff,border-radius: 4px
        classDef errorClass fill:#dc3545,stroke:#dc3545,color: #fff,border-radius: 4px
        classDef noEntry fill:#6c757d,stroke:#6c757d,color: #fff,border-radius: 4px

Post

CommandExecution ResultExecution Time
cmd11
cmd22
cmd33

Local Execution

You can copy paste the following commands to locally execute build chain tool.
npm i @kie/build-chain-action@2.3.35 -g build-chain-action -f definitionFile build cross_pr -u eventUrl

Git Version: 1.0.1

Notice: The GITHUB_TOKEN should be set in the environment.

@Ginxo
Copy link
Contributor

Ginxo commented Aug 23, 2022

the addDetails method does not have any parameters to add the open attribute. I will have to use addRaw is that okay? I can also wrap the summary title in a heading so we won't need a separate one.

Here is a preview of what it could look like:

Build Chain Execution Summary

Project Starting the Job: owner2/project2

Pre

Command Execution Result Execution Time
cmd1 white_check_mark 1
cmd2 x 2
cmd3 white_check_mark 3

Execution phase: before

Project Source Target Merged Execution Result Avg Execution Time
owner1/project1 checkout skipped checkout skipped x no_entry 0
owner2/project2 owner2/project2:main owner2/project2:main x white_check_mark 2
owner3/project3 owner3/project3:main owner3-forked/project3-forked:dev white_check_mark x 3

Execution phase: commands

Project Source Target Merged Execution Result Avg Execution Time
owner1/project1 checkout skipped checkout skipped x no_entry 0
owner2/project2 owner2/project2:main owner2/project2:main x white_check_mark 2
owner3/project3 owner3/project3:main owner3-forked/project3-forked:dev white_check_mark x 3

Execution phase: after

Project Source Target Merged Execution Result Avg Execution Time
owner1/project1 checkout skipped checkout skipped x no_entry 0
owner2/project2 owner2/project2:main owner2/project2:main x white_check_mark 2
owner3/project3 owner3/project3:main owner3-forked/project3-forked:dev white_check_mark x 3

Post

Command Execution Result Execution Time
cmd1 white_check_mark 1
cmd2 x 2
cmd3 white_check_mark 3

Local Execution

You can copy paste the following commands to locally execute build chain tool.

npm i @kie/build-chain-action@2.3.35 -g build-chain-action -f definitionFile build cross_pr -u eventUrl

Git Version: 1.0.1

Notice: The GITHUB_TOKEN should be set in the environment.

I agree, @shubhbapna please proceed

@shubhbapna shubhbapna requested a review from Ginxo August 23, 2022 14:28
@Ginxo Ginxo merged commit 7a37530 into kiegroup:typescript/main Aug 23, 2022
Ginxo added a commit that referenced this pull request Jan 2, 2023
* Nodejs 16

* rmdirSync error fixed

* prettier

* pull_request.yml improved

* Typescript/main (#262)

* project scaffolding

* .gitignore

* report.yml flow adapted to typescript/main

* logger services implemented

* eslint

* jest

* Add DI library (#265)

* project scaffolding

* .gitignore

* report.yml flow adapted to typescript/main

* logger services implemented

* eslint

* jest

* Add DI library

* logger service tests (#266)

* project scaffolding

* .gitignore

* report.yml flow adapted to typescript/main

* logger services implemented

* eslint

* jest

* Add DI library

* implement loggerservice tests

* test:report script (#267)

* package-lock.json updated

* logger service refactored (#268)

* added jest as dev dependency which is needed by ts-jest (#269)

* solve "-Dsonar.projectName" from report file

* sonar report fixes

* pull_request.yml added npm install and npm run test:report. nodejs 12.x version removed

* added husky (#273)

* Arguments (#270)

* added cli argument parser for build and tool actions

* added cli parser test cases

* Add DI library (#265)

* project scaffolding

* .gitignore

* report.yml flow adapted to typescript/main

* logger services implemented

* eslint

* jest

* Add DI library

* logger service tests (#266)

* project scaffolding

* .gitignore

* report.yml flow adapted to typescript/main

* logger services implemented

* eslint

* jest

* Add DI library

* implement loggerservice tests

* test:report script (#267)

* package-lock.json updated

* logger service refactored (#268)

* added jest as dev dependency which is needed by ts-jest (#269)

* updated package.json

* added action.yml

* added documentation

* Create pull_request.yml

* 12.x removed from pull_request.yml

* implemented requested changes

* increased test coverage

* Update action.yml

Co-authored-by: Enrique Mingorance Cano <ginxaco@gmail.com>

* changed command option naming for token, cct and command. Fixed linting errors

Co-authored-by: Enrique Mingorance Cano <emingora@redhat.com>
Co-authored-by: Enrique Mingorance Cano <ginxaco@gmail.com>
Co-authored-by: Github <noreply@github.com>

* Git service (#274)

* implemented and tested git actions which don't use ocktokit

* added octokit git functions, test cases and created git mock env

* git config changes for test setup

* fix ci arror

* added test cases for octokit factory

* refactored and implemented github-api service

* Executor Service (#272)

* project scaffolding

* .gitignore

* report.yml flow adapted to typescript/main

* logger services implemented

* eslint

* jest

* Add DI library

* implement loggerservice tests

* implement command-executor

* logger service refactored

* export-command-executor.test.ts and export-command-executor.ts

* treatment

* command-builder.test.ts and implementation adapted

* command-treatment-delegator.test.ts

* maven-command-treatment.test.ts

* regex-command-treatment.test.ts

* improving coverage

* execute-command-service.ts basic stuff

* configuration-service implemented and covered

* test-logger-service.ts empty implementation

* test-logger-service.ts empty implementation

* command-executor-delegator.test.ts

* execute-command-service.test.ts

* execute-command-service.test.ts expectedCalls contract improved

* injection from constructors

* hrtime to util/date

* added types for build-chain-configuration-reader (#275)

* Typescript/system requirements (#276)

* About Commands to Execute (#257)

* system requirements section

* Inputs (#278)

* refactored arguments. restructed argument folder to contain cli folder. created a common input parser class

* refactored BuildActionType enum to FlowType and set logger level when debug flag is passed

* updated test to check for logger level

* renamed arguments/main-command-factory to arguments/cli

* added action input parser

* added documentation

* changed ParsedInputs to InputService, refactored test cases

* update logger level for debug option in the cli parser instead of input service

* added skip project execution and checkout (#279)

* Config service (#281)

* added configuration service

* added test cases for action configuration and fixed bugs for action configuration

* added cli congfiguration tests. Bug fixes in cli configuration. Refactored action configuration test

* added util tests

* added more test for cli and action config. Removed unnecessary code from base config

* added some test cases for configuration service

* refactored types for definition file

* load definition file in configuration

* refactored build-config-reader types and definition file loader in config service

* added more test cases for config service and added getTreatmentOption method

* fixed treatment options and custom command treatment option

* added parser to convert project nodes from build-config-reader to node domain object

* removed old config service

* added input validation

* bug fix in test setup

* added documentation

* updated with requested changes

* Code smells (#283)

* remove redundant await

* extracted nested ternary operations into independent statements

* remove nested string literals

* prefix unused function parameters with underscore

* remove mocks for coverage

* fix empty expect in logger test

* linted domain files

* linted arguments service

* linted config service

* linted git service

* linted input service

* linted types

* linted utils

* linted tests

* updated gitignore

* linted config.json

* added config initialization in runner (#282)

* added config initialization in runner

* bug fixes, shifted reflect-metadata import to individual runners since those are the actual entry point

* added test cases

* Update action-configuration.ts (#285)

* Checkout service (#286)

* added placeholder parser for definition file url

* added mapping to parsed node

* added definition file test cases to cli config

* updated config and input domain object

* added get source, target project in config service. update load git event and project config to consider case for branch flow

* added more test cases and updated old ones for config objects and services

* added clone to node object, added get source and target project to config service, validate start project

* added get flow type to config services

* clean up in loading git config

* changed hasPullRequest method

* added more functionality to config service to help with checkout service

* update eslint to ignore variables that begin with underscore

* implemented checkout service

* added test cases for checkout service

* updated package.json and lock file

* removed code smells

* added repository clone location to checkout info

* clean up of test data

* removed code duplication (#293)

* refactored checkout service and updated a test case (#292)

* Pre and post functionality  (#297)

* added pre and post services

* added test cases for  pre and post services

* updated test cases

* added test cases for getPre and getPost

* Archive service (#289)

* added placeholder parser for definition file url

* added mapping to parsed node

* added definition file test cases to cli config

* updated config and input domain object

* added get source, target project in config service. update load git event and project config to consider case for branch flow

* added more test cases and updated old ones for config objects and services

* added clone to node object, added get source and target project to config service, validate start project

* added get flow type to config services

* clean up in loading git config

* changed hasPullRequest method

* added more functionality to config service to help with checkout service

* update eslint to ignore variables that begin with underscore

* implemented checkout service

* added test cases for checkout service

* updated package.json and lock file

* removed code smells

* added repository clone location to checkout info

* clean up of test data

* added artifacts service

* refactored and added artifacts service

* added test cases for artifacts and upload service

* logged artifact upload results

* added requested change

* changed execute node chain argument from node to ExecutionNode (#300)

* changed execute node chain argument from node to ExecutionNode

* changed for loop for execute service

* changed node.map for execute service tests

* Prep flow (#298)

* added nodechain generator and its test cases. removed load definition file and generate place holders from base config

* added node field to checkedout node info. updated checkout service to use nodechain directly from config service

* renamed nodechain generator to definition file reader. added get definition file

* added test cases for get definition file

* refactored checkoutDefinitionTreeParallel

* Executor refactor (#304)

* changed excute result domain object to include no optional fields

* made get node command public, so that it can be used in printing execution plan. made changes as required by the changed execute result domain object

* updated test cases for executor service

* updated test cases according to the changed domain objects for executor service

* Artifact node chain (#305)

* changed artifact service to use node chain directly from config service

* updated test cases

* refactored artifact service

* updated test cases

* refactored getNodesToArchive

* Flow service (#306)

* added string representation of ExecutionResult

* added flow service

* added tests for flow service

* added FlowResult domain object

* lint fix

* bug fix while constructing NodeExecution array from CheckedOutInfo during a parallel checkout

* refactored flow

* more refactoring

* Job summary service (#307)

* pre-post services return their execution result

* added getEventUrl and getDefinitionFileUrl and updated test cases

* added job summary service

* added test cases for job summary

* fix in config service test cases

* added requested changes

* eslint: arrow-parens rule (#310)

* Runner setup (#312)

* added default flow result

* implemented runners and shifted execution to separate entry point file

* added test cases for runners

* updated package-lock.json

* updated package-lock.json

* resolve 14.x runner error

* added printing of execution failure

* configuration-reader to 3.0.0 (#318)

* @kie/build-chain-configuration-reader 3.0.4 (#321)

* updated domain objects to use Node from build-chain-config-reader

* updated artifact service to use domain objects directly from build-chain-config. passing project name as default artifact name

* updated test cases for artifact service

* updated checkout service to use domain objects directly from build-chain-config-reader

* updated command executor service to use domain objects directly from build-chain-config-reader

* updated configuration service to use domain objects directly from build-chain-config-reader

* removed code from definition file reader service which is now directly implemented by the build-chain-config-reader lib

* updated definition file reader tests

* updated tests to use domain objects directly from build-chain-config-reader

* removed custom types

* bumped up version of build-chain-config-reader to 3.0.4

* migrated mock-github poc to the actual mock-github (#322)

* e2e (#324)

* fixed action.yml

* updated .gitignore

* added scripts to build package, run e2e tests and updated dependencies

* made action argument a service and executed it in the action runner to parse input

* fixed bug in getting nodes to checkout and added artifact name validator

* improved logging in checkout service

* changed logging from info to debugging for regex-command-treatment

* getCloneUrl returns a path to the local repository when running e2e tests

* fixed bug in git version and clone

* improved error msg in getForkName

* configure octokit to use proxy if defined

* improved logging and annotations during flow execution

* improved logging for pre and post

* updated test cases

* added e2e tests for single pr flow

* fixed clone case

* added helper to enable disable easy logging

* added cross-pr tests

* updated dependencies file and single pr tests

* allow unrelated history merge

* updated gitignore and package.json

* added full downstream tests

* updated other e2e tests with comments and simplifications

* trimmed white spaces from additional-flag input

* added branch e2e tests

* added e2e pr checks

* increase test timeout limit

Co-authored-by: Github <noreply@github.com>

* Logger (#326)

* refactored logger to be a typedi service

* updated logger service for runners

* updated logger service for artifacts service

* updated logger service for checkout service

* updated logger service for command service

* updated logger service for config service

* updated logger service for flow service

* updated logger service for git services

* updated logger service for pre-post services

* updated logger util

* updated test cases

* fixed coverage script

* Cli args (#327)

* refactored cli arguments to typedi service

* updated runners

* updated test cases

* Octokit (#328)

* refactored octokit factory to typedi service

* updated config service

* updated github api service

* updated test cases

* CLI argument parsing bug fix (#329)

* placed the bash shebang in the correct entry point file

* fixed cli argument parsing

* updated test cases

* prepare for release, updated changelog, package.json, readme and minor changes

* fixed test case

* push compiled file for actions

Co-authored-by: Enrique Mingorance Cano <ginxaco@gmail.com>
Co-authored-by: Enrique Mingorance Cano <emingora@redhat.com>
Co-authored-by: Github <noreply@github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants