Skip to content

Commit

Permalink
Add sample workflow, fix conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Prudhvi Godithi <[email protected]>
  • Loading branch information
prudhvigodithi committed Sep 26, 2024
2 parents d9012c1 + 4366d27 commit b7d4959
Show file tree
Hide file tree
Showing 26 changed files with 190 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @getsaurabh02 @peterzhuamazon
* @getsaurabh02 @peterzhuamazon @gaiksaya @prudhvigodithi
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
- name: Install dependencies and build the code
run: npm install
- name: Verify styling
id: style_verify
run: npm run format-dryrun
- name: Verify styling failure msg
if: steps.style_verify.outcome == 'failure'
run: echo "Please run 'npm run format' before commiting the code!"
- name: Run build
run: npm run build
10 changes: 6 additions & 4 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ This document contains a list of maintainers in this repo. See [opensearch-proje

## Current Maintainers

| Maintainer | GitHub ID | Affiliation |
| ------------ | --------------------------------------------------- | ----------- |
| Peter Zhu | [peterzhuamazon](https://github.com/peterzhuamazon) | Amazon |
| Saurabh Sing | [getsaurabh02](https://github.com/getsaurabh02) | Amazon |
| 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 |

## Emeritus

Expand Down
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ module.exports = {
'^.+\\.tsx?$': 'ts-jest',
},
};

8 changes: 8 additions & 0 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { Probot } from 'probot';
import { Service } from './service/service';

Expand Down
8 changes: 8 additions & 0 deletions src/call/create-issue-comment.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

// Name : createIssueComment
// Description : create an issue comment as the app
// Arguments :
Expand Down
8 changes: 8 additions & 0 deletions src/call/github-merged-pulls-monitor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

// Name : githubMergedPullsMonitor
// Description : Monitors the CI workflows of merged pull requests, providing metrics that give an overview of whether pull requests were merged without passing CI checks.

Expand Down
8 changes: 8 additions & 0 deletions src/call/github-workflow-runs-monitor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

// Name : githubWorkflowRunsMonitor
// Description : prints the githubWorkflowRunsMonitor output and indexes logData to OpenSearch
// Arguments :
Expand Down
8 changes: 8 additions & 0 deletions src/call/print-to-console.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

// Name : printToConsole
// Description : print a message to the console
// Arguments :
Expand Down
8 changes: 8 additions & 0 deletions src/config/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import Ajv from 'ajv';
import addFormats from 'ajv-formats';
import { load, YAMLException } from 'js-yaml';
Expand Down
8 changes: 8 additions & 0 deletions src/config/operation-config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { Operation } from '../service/operation/operation';
import { Task } from '../service/operation/task';
import { OperationData, TaskData } from './types';
Expand Down
9 changes: 8 additions & 1 deletion src/config/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
// Resource
/**
* 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.
*/

export interface ResourceData {
organizations: OrganizationData[];
}
Expand Down
8 changes: 8 additions & 0 deletions src/service/operation/operation.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { Task } from './task';

export class Operation {
Expand Down
8 changes: 8 additions & 0 deletions src/service/operation/task.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import randomstring from 'randomstring';
import { TaskArgData } from '../../config/types';

Expand Down
8 changes: 8 additions & 0 deletions src/service/resource/entity.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { ProbotOctokit } from 'probot';

export abstract class Entity {
Expand Down
8 changes: 8 additions & 0 deletions src/service/resource/issue.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { ProbotOctokit } from 'probot';
import { Entity } from './entity';

Expand Down
8 changes: 8 additions & 0 deletions src/service/resource/organization.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { ProbotOctokit } from 'probot';
import { Entity } from './entity';
import { Project } from './project';
Expand Down
8 changes: 8 additions & 0 deletions src/service/resource/project-field.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { ProbotOctokit } from 'probot';
import { Entity } from './entity';

Expand Down
8 changes: 8 additions & 0 deletions src/service/resource/project.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { ProbotOctokit } from 'probot';
import { Entity } from './entity';
import { ProjectField } from './project-field';
Expand Down
8 changes: 8 additions & 0 deletions src/service/resource/repository.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { ProbotOctokit } from 'probot';
import { Entity } from './entity';

Expand Down
8 changes: 8 additions & 0 deletions src/service/resource/resource.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { Organization } from './organization';

export class Resource {
Expand Down
8 changes: 8 additions & 0 deletions src/service/service.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { Probot } from 'probot';
import type { WebhookEventMap } from '@octokit/webhooks-types';
import { access, realpath } from 'fs/promises';
Expand Down
8 changes: 8 additions & 0 deletions src/utility/octokit.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { Probot, ProbotOctokit } from 'probot';

export async function octokitAuth(app: Probot, installationId: number): Promise<ProbotOctokit> {
Expand Down
8 changes: 8 additions & 0 deletions src/utility/opensearchclient.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { STSClient, AssumeRoleCommand } from '@aws-sdk/client-sts';
import { ApiResponse, Client as OpenSearchClient } from '@opensearch-project/opensearch';
import { AwsSigv4Signer } from '@opensearch-project/opensearch/lib/aws/index';
Expand Down
8 changes: 8 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

/* eslint-disable */
// @ts-nocheck

Expand Down
16 changes: 11 additions & 5 deletions test/utility/opensearchclient.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* 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.
*/

import { STSClient, AssumeRoleCommand } from '@aws-sdk/client-sts';
import { Client as OpenSearchClient } from '@opensearch-project/opensearch';
import { OpensearchClient } from '../../src/utility/opensearchclient'; // Adjust import path as needed
Expand Down Expand Up @@ -29,7 +37,7 @@ describe('OpensearchClient', () => {
delete process.env.REGION;
delete process.env.OPENSEARCH_URL;
});

beforeEach(() => {
(STSClient as jest.Mock).mockImplementation(() => ({
send: jest.fn().mockResolvedValue({
Expand Down Expand Up @@ -60,9 +68,7 @@ describe('OpensearchClient', () => {

const opensearchClient = new OpensearchClient();

await expect(opensearchClient.getClient()).rejects.toThrow(
'Failed to assume role: credentials are undefined.'
);
await expect(opensearchClient.getClient()).rejects.toThrow('Failed to assume role: credentials are undefined.');
});
});

Expand Down Expand Up @@ -98,7 +104,7 @@ describe('OpensearchClient', () => {
const index = 'test-index';

await expect(opensearchClient.bulkIndex(index, documents)).rejects.toThrow(
'Bulk indexing errors: [{"type":"some_error","reason":"Some error occurred"}]'
'Bulk indexing errors: [{"type":"some_error","reason":"Some error occurred"}]',
);
});
});
Expand Down

0 comments on commit b7d4959

Please sign in to comment.