Skip to content

Commit

Permalink
Initial Version to Monitor Github workflows using the automation app (#4
Browse files Browse the repository at this point in the history
)

* Monitor Github workflows

Signed-off-by: Prudhvi Godithi <pgodithi@amazon.com>

* Improve wording and add license-hearder-checker

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>

---------

Signed-off-by: Prudhvi Godithi <pgodithi@amazon.com>
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
Co-authored-by: Peter Zhu <zhujiaxi@amazon.com>
  • Loading branch information
prudhvigodithi and peterzhuamazon authored Sep 26, 2024
1 parent 4366d27 commit f194866
Show file tree
Hide file tree
Showing 42 changed files with 2,604 additions and 132 deletions.
13 changes: 11 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

module.exports = {
env: {
browser: false,
Expand Down Expand Up @@ -26,8 +35,8 @@ module.exports = {
'import/prefer-default-export': 'off',
'max-classes-per-file': 'off',
'no-new': 'off',
"no-console": "off",
"no-underscore-dangle": 'off',
'no-console': 'off',
'no-underscore-dangle': 'off',
'max-len': ['error', { code: 160, ignoreComments: true }],
},
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: build app
name: build-test

on: [push, pull_request]

Expand Down Expand Up @@ -27,3 +27,5 @@ jobs:
run: echo "Please run 'npm run format' before commiting the code!"
- name: Run build
run: npm run build
- name: Run Test
run: npm test
12 changes: 12 additions & 0 deletions .github/workflows/license-header-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: License Header Checker

on: [push, pull_request]

jobs:
license-header-checker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Add License Header
run: npx @kt3k/license-checker
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ npm-debug.log
coverage
bin
temp/*

# Intellij files
.idea/*

.DS_Store
33 changes: 33 additions & 0 deletions .licenserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"**/*.*": [" Copyright OpenSearch Contributors", " SPDX-License-Identifier: Apache-2.0"],
"ignore": [
".prettierrc",
".md",
".flake8",
".yml",
".yaml",
".bat",
".json",
".txt",
".config",
".swp",
"tests/tests_test_workflow/test_integ_workflow/integ_test/data/artifacts/",
"tests/tests_sign_workflow/data/signature/",
"tests/tests_assemble_workflow/data/artifacts/",
".png",
"settings.gradle",
".git",
".lychee.excludes",
".whitesource",
".shellcheckrc",
".lock",
".gradle",
".cert",
".key",
".jar",
".gz",
".toml",
".ini",
"gradle/wrapper"
]
}
6 changes: 3 additions & 3 deletions ADMINS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Admins

| Admin | GitHub ID | Affiliation |
| --------------- | --------------------------------------- | ----------- |
| Henri Yandell | [hyandell](https://github.com/hyandell) | Amazon |
| Admin | GitHub ID | Affiliation |
| ------------- | --------------------------------------- | ----------- |
| Henri Yandell | [hyandell](https://github.com/hyandell) | Amazon |

[This document](https://github.com/opensearch-project/.github/blob/main/ADMINS.md) explains what admins do in this repo. and how they should be doing it. If you're interested in becoming a maintainer, see [MAINTAINERS](MAINTAINERS.md). If you're interested in contributing, see [CONTRIBUTING](CONTRIBUTING.md).
24 changes: 12 additions & 12 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ This code of conduct applies to all spaces provided by the OpenSource project in

**Our open source communities endeavor to:**

* Be Inclusive: We are committed to being a community where everyone can join and contribute. This means using inclusive and welcoming language.
* Be Welcoming: We are committed to maintaining a safe space for everyone to be able to contribute.
* Be Respectful: We are committed to encouraging differing viewpoints, accepting constructive criticism and work collaboratively towards decisions that help the project grow. Disrespectful and unacceptable behavior will not be tolerated.
* Be Collaborative: We are committed to supporting what is best for our community and users. When we build anything for the benefit of the project, we should document the work we do and communicate to others on how this affects their work.
- Be Inclusive: We are committed to being a community where everyone can join and contribute. This means using inclusive and welcoming language.
- Be Welcoming: We are committed to maintaining a safe space for everyone to be able to contribute.
- Be Respectful: We are committed to encouraging differing viewpoints, accepting constructive criticism and work collaboratively towards decisions that help the project grow. Disrespectful and unacceptable behavior will not be tolerated.
- Be Collaborative: We are committed to supporting what is best for our community and users. When we build anything for the benefit of the project, we should document the work we do and communicate to others on how this affects their work.

**Our Responsibility. As contributors, members, or bystanders we each individually have the responsibility to behave professionally and respectfully at all times. Disrespectful and unacceptable behaviors include, but are not limited to:**

* The use of violent threats, abusive, discriminatory, or derogatory language;
* Offensive comments related to gender, gender identity and expression, sexual orientation, disability, mental illness, race, political or religious affiliation;
* Posting of sexually explicit or violent content;
* The use of sexualized language and unwelcome sexual attention or advances;
* Public or private harassment of any kind;
* Publishing private information, such as physical or electronic address, without permission;
* Other conduct which could reasonably be considered inappropriate in a professional setting;
* Advocating for or encouraging any of the above behaviors.
- The use of violent threats, abusive, discriminatory, or derogatory language;
- Offensive comments related to gender, gender identity and expression, sexual orientation, disability, mental illness, race, political or religious affiliation;
- Posting of sexually explicit or violent content;
- The use of sexualized language and unwelcome sexual attention or advances;
- Public or private harassment of any kind;
- Publishing private information, such as physical or electronic address, without permission;
- Other conduct which could reasonably be considered inappropriate in a professional setting;
- Advocating for or encouraging any of the above behaviors.

**Enforcement and Reporting Code of Conduct Issues:**

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Contributing to this Project

OpenSearch is a community project that is built and maintained by people just like **you**.
OpenSearch is a community project that is built and maintained by people just like **you**.
[This document](https://github.com/opensearch-project/.github/blob/main/CONTRIBUTING.md) explains how you can contribute to this and related projects.
16 changes: 8 additions & 8 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ This document contains a list of maintainers in this repo. See [opensearch-proje

## Current Maintainers

| Maintainer | GitHub ID | Affiliation |
| ------------------ | --------------------------------------------------------- | ----------- |
| Saurabh Sing | [getsaurabh02](https://github.com/getsaurabh02) | Amazon |
| Peter Zhu | [peterzhuamazon](https://github.com/peterzhuamazon) | Amazon |
| Prudhvi Godithi | [prudhvigodithi](https://github.com/prudhvigodithi) | Amazon |
| Sayali Gaikawad | [gaiksaya](https://github.com/gaiksaya) | Amazon |
| Maintainer | GitHub ID | Affiliation |
| --------------- | --------------------------------------------------- | ----------- |
| Saurabh Singh | [getsaurabh02](https://github.com/getsaurabh02) | Amazon |
| Peter Zhu | [peterzhuamazon](https://github.com/peterzhuamazon) | Amazon |
| Prudhvi Godithi | [prudhvigodithi](https://github.com/prudhvigodithi) | Amazon |
| Sayali Gaikawad | [gaiksaya](https://github.com/gaiksaya) | Amazon |

## Emeritus

| Maintainer | GitHub ID | Affiliation |
| ------------------ | --------------------------------------------------------- | ----------- |
| Maintainer | GitHub ID | Affiliation |
| ---------- | --------- | ----------- |
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@ The automation app utilizes the [Probot](https://probot.github.io/) framework an

### Service

A **Service** is an instance of the app that manages and manipulates specific `Resource` while performing defined `Operation`.
* **Resource**: Objects or entities the service will manage or modify, such as GitHub organizations, project, repositories, issues, etc.
* **Operation**: A list of `Tasks` triggered by events with the resources.
* **Task**: Executed sequentially within an `Operation` to perform action, such as create comments, update labels, add issue to project, etc.
* **Call**: The callstack that contains the implementation of the aformentioned task action.
A `Service` is an instance of the app that manages and manipulates specific `Resource` while performing defined `Operation`.

- **Resource**: Objects or entities the service will manage or modify, such as GitHub organizations, project, repositories, issues, etc.
- **Operation**: A list of `Tasks` triggered by events with the resources.
- **Task**: Executed sequentially within an `Operation` to perform action, such as create comments, update labels, add issue to project, etc.
- **Call**: The callstack that contains the implementation of the aformentioned task action.

### Create a Service

To create a service, you need two configuration files:
* **Resource configuration file**: Defines the resources that the service will manage or modify (`configs/resources/sample-resource.yml`).
* **Operation configuration file**: Defines the operations (tasks) that the service will execute with the resources (`configs/resources/sample-operation.yml`).

- **Resource configuration file**: Defines the resources that the service will manage or modify (`configs/resources/sample-resource.yml`).
- **Operation configuration file**: Defines the operations (tasks) that the service will execute with the resources (`configs/resources/sample-operation.yml`).

### Start the Service

Expand All @@ -44,6 +46,7 @@ RESOURCE_CONFIG=configs/resources/sample-resource.yml OPERATION_CONFIG=configs/o
```

When you run the above command, the following takes place:

1. The app starts a `Service` instance based on the specified configurations.
1. Retrieves the [GitHub Context](https://probot.github.io/api/latest/classes/context.Context.html) (or any other defined context) for all the resources listed in the resource config file.
1. Registers and listens for events, executes the `Tasks` defined in the operation config. These tasks will be executed sequentially when the corresponding events occur.
Expand All @@ -63,4 +66,3 @@ This project is licensed under the [Apache v2.0 License](LICENSE).
## Copyright

Copyright OpenSearch Contributors. See [NOTICE](NOTICE) for details.

9 changes: 9 additions & 0 deletions configs/operations/github-merged-pulls-monitor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: Merged PRs Monitor with CI Status

events:
- pull_request.closed

tasks:
- name: PR Monitor Operation
call: github-merged-pulls-monitor@default
22 changes: 22 additions & 0 deletions configs/operations/github-workflow-runs-monitor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Workflow Runs Monitor

events:
- workflow_run.completed

tasks:
- name: Workflow Runs Monitor Operation
call: github-workflow-runs-monitor@default
args:
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
events:
- 'pull_request'
- 'push'
- 'pull_request_target'
- 'release'
- 'issues'
- 'check_run'
- 'check_suite'
- 'issue_comment'
- 'schedule'
- 'workflow_dispatch'
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module.exports = {
roots: ['<rootDir>/test'],
testMatch: ['**/*.test.ts'],
transform: {
'^.+\\.tsx?$': 'ts-jest'
}
'^.+\\.tsx?$': 'ts-jest',
},
};
Loading

0 comments on commit f194866

Please sign in to comment.