Skip to content

Commit

Permalink
feat(STONEINTG-524): add diagram for statusreport controller
Browse files Browse the repository at this point in the history
Signed-off-by: Hongwei Liu <[email protected]>
  • Loading branch information
hongweiliu17 committed Sep 13, 2023
1 parent 19daf26 commit f55f104
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions docs/statusreport-controller.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<div align="center"><h1>StatusReport Controller</h1></div>

```mermaid
%%{init: {'theme':'forest'}}%%
flowchart TD
%% Defining the styles
classDef Amber fill:#FFDEAD;
predicate((PREDICATE: <br>Snapshot has annotation <br>test.appstudio.openshift.io/status <br>changed))
%%%%%%%%%%%%%%%%%%%%%%% Drawing EnsureSnapshotTestStatusReported() function
%% Node definitions
ensure(Process further if: Snapshot has label <br>pac.test.appstudio.openshift.io/git-provider:github <br>defined)
get_annotation_value(Get integration test status from annotation <br>test.appstudio.openshift.io/status <br>from Snapshot)
is_snapshot_from_PR_event{"Is the <br>Snapshot from <br>push request event?"}
collect_commit_info(Collect commit owner, repo and SHA from Snapshot)
is_installation_defined{Is annotation <br>pac.test.appstudio.openshift.io/installation-id <br>defined?}
create_appInstallation_token(Create github application installation token)
get_all_checkRuns_from_gh(Get all checkruns from github <br>according to <br>commit owner, repo and SHA)
create_checkRunAdapter(Create checkRun adapter according to <br>commit owner, repo, SHA <br>and integration test status)
does_checkRun_exist{Does checkRun exist <br>on github already?}
create_new_checkRun_on_gh(Create new checkrun on github)
is_checkRun_update_needed{Does existing checkRun <br>has older CompletedAt?}
update_existing_checkRun_on_gh(Update existing checkRun on github)
set_oAuth_token(Get token from Snapshot and set oAuth token)
get_all_commitStatuses_from_gh(Get all commitStatuses from github <br>according to commit owner, repo and SHA)
create_commitStatusAdapter(Create commitStatusAdapter according to <br>commit owner, repo, SHA <br>and integration test status)
does_commitStatus_exist{Does commitStatus exist <br>on github already?}
create_new_commitStatus_on_gh(Create new commitStatus on github)
continue_processing(Controller continues processing)
%% Node connections
predicate ----> |"EnsureSnapshotTestStatusReported()"|ensure
ensure --> get_annotation_value
get_annotation_value --> is_snapshot_from_PR_event
is_snapshot_from_PR_event --Yes--> collect_commit_info
is_snapshot_from_PR_event --No--> continue_processing
collect_commit_info --> is_installation_defined
is_installation_defined --Yes--> create_appInstallation_token
is_installation_defined --No--> set_oAuth_token
create_appInstallation_token --> get_all_checkRuns_from_gh
get_all_checkRuns_from_gh --> create_checkRunAdapter
create_checkRunAdapter --> does_checkRun_exist
does_checkRun_exist --Yes--> is_checkRun_update_needed
does_checkRun_exist --No--> create_new_checkRun_on_gh
create_new_checkRun_on_gh --> continue_processing
is_checkRun_update_needed --Yes--> update_existing_checkRun_on_gh
is_checkRun_update_needed --No--> continue_processing
update_existing_checkRun_on_gh --> continue_processing
set_oAuth_token --> get_all_commitStatuses_from_gh
get_all_commitStatuses_from_gh --> create_commitStatusAdapter
create_commitStatusAdapter --> does_commitStatus_exist
does_commitStatus_exist --Yes--> continue_processing
does_commitStatus_exist --No--> create_new_commitStatus_on_gh
create_new_commitStatus_on_gh --> continue_processing
%% Assigning styles to nodes
class predicate Amber;
```

0 comments on commit f55f104

Please sign in to comment.