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

Feature opensearch #89

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3cf2693
Opensearch
Andrei-Stepanov Apr 3, 2023
914a269
Add draft for opensearch loader.
Andrei-Stepanov May 5, 2023
c2e37fb
Merge branch 'opensearch' into feature-opensearch
Andrei-Stepanov May 11, 2023
bfa55a1
Fix var names
Andrei-Stepanov May 16, 2023
4df3bea
Remove useless code
Andrei-Stepanov May 16, 2023
88ee17f
Add debug and protection
Andrei-Stepanov May 17, 2023
bedaddb
Add errors tracking
Andrei-Stepanov May 17, 2023
dd13c4c
Add redhat-container-image index
Andrei-Stepanov May 18, 2023
747ab03
Add info about failed message
Andrei-Stepanov May 18, 2023
ddbb625
Fix artifact context
Andrei-Stepanov May 18, 2023
09fe7cf
Situation when a message produces 0 upserts
Andrei-Stepanov May 18, 2023
9de7b50
Fix mbs handler
Andrei-Stepanov May 19, 2023
422db3b
Add parent docs
Andrei-Stepanov May 30, 2023
2be8590
Update
Andrei-Stepanov Jun 2, 2023
c67185a
Update 2
Andrei-Stepanov Jun 2, 2023
ed333e0
test
Andrei-Stepanov Sep 14, 2023
88c3bba
wip
Andrei-Stepanov Oct 20, 2023
fdf9d7e
wip
Andrei-Stepanov Oct 20, 2023
9670c52
msgFullText: do not store keys
Andrei-Stepanov Nov 14, 2023
0c4fa47
OSCI-5901
Andrei-Stepanov Nov 20, 2023
b4f4b4a
OSCI-5932
Andrei-Stepanov Nov 23, 2023
e114681
OSCI-6469
Andrei-Stepanov Mar 6, 2024
f9a8386
Update rhcachain.crt
Andrei-Stepanov Mar 13, 2024
166b93c
OSCI-6545
Andrei-Stepanov Mar 20, 2024
3ea1053
OSCI-6545 rev 1
Andrei-Stepanov Mar 21, 2024
a41f4da
update package-lock.json
Andrei-Stepanov Apr 19, 2024
6b5e929
src/listener_fedora.ts
Andrei-Stepanov Apr 19, 2024
f62e16f
Merge branch 'main' into feature-opensearch
Andrei-Stepanov Apr 19, 2024
4ce854f
package-lock.json
Andrei-Stepanov Apr 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions assets/config-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ loader:
options:
name: 'added_v1'

opensearch:
client: {}
indexes_prefix: ~

file_queue_path: 'messages-queue'
schemas_git_upstream: 'https://pagure.io/fedora-ci/messages.git'
schemas_local_git_repo_path: 'schemas.git'
Expand Down Expand Up @@ -247,6 +251,12 @@ env_to_config_map:
schemas_git_upstream: LOADER_SCHEMAS_GIT_UPSTREAM
schemas_local_git_repo_path: LOADER_SCHEMAS_GIT_REPO_PATH
schemas_local_dir_unpacked: LOADER_SCHEMAS_DIR_UNPACKED
opensearch:
client:
node: LOADER_OPENSEARCH_CLIENT_NODE
ssl:
ca: LOADER_OPENSEARCH_CLIENT_SSL_CA
indexes_prefix: LOADER_OPENSEARCH_INDEXES_PREFIX
listener:
broker_umb:
client_name: LISTENER_BROKER_UMB_CLIENT_NAME
Expand Down
6 changes: 6 additions & 0 deletions dev-loader-opensearch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"watch": ["src"],
"ext": ".ts,.js",
"ignore": [],
"exec": "source ./env.sh && ts-node ./src/loader_opensearch.ts | ./node_modules/.bin/pino-pretty"
}
733 changes: 382 additions & 351 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
"dev:listener-fedora": "nodemon --config dev-listener-fedora.json",
"start:listener-fedora": "source ./env.sh && node build/listener_fedora.js | ./node_modules/.bin/pino-pretty",
"dev:loader": "nodemon --config dev-loader.json",
"dev:loader-opensearch": "nodemon --config dev-loader-opensearch.json",
"start:loader": "source ./env.sh && node build/loader.js | ./node_modules/.bin/pino-pretty",
"start:loader-opensearch": "source ./env.sh && node build/loader_opensearch.js | ./node_modules/.bin/pino-pretty",
"build": "rimraf ./build && tsc"
},
"author": "Andrei Stepanov",
"license": "LGPLv3+",
"dependencies": {
"@opensearch-project/opensearch": "^2.2.0",
"@types/amqplib": "^0.10.1",
"@types/debug": "^4.1.8",
"@types/lodash": "^4.14.195",
Expand Down
66 changes: 66 additions & 0 deletions rhcachain.crt
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,69 @@ X6KXw/3RH9f5YgKqydtEZtZ0isA4+55gf0m7I0O5lNK3mgY/uBmIk/jSI9WqczrD
WGf78pvkTQ2PcYg/WiCv+AVsaSaiEDUf4rDj55wQ30h78Ox5J2izd4I6QylB9Lpu
fQEw+cWRxwFPJujSOTSKRHZDo1UwOIQbxqkbznSHlLCICEXxuvQ=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIF6TCCA9GgAwIBAgIFICIEEF4wDQYJKoZIhvcNAQEMBQAwgaMxCzAJBgNVBAYT
AlVTMRcwFQYDVQQIDA5Ob3J0aCBDYXJvbGluYTEQMA4GA1UEBwwHUmFsZWlnaDEW
MBQGA1UECgwNUmVkIEhhdCwgSW5jLjETMBEGA1UECwwKUmVkIEhhdCBJVDEZMBcG
A1UEAwwQSW50ZXJuYWwgUm9vdCBDQTEhMB8GCSqGSIb3DQEJARYSaW5mb3NlY0By
ZWRoYXQuY29tMB4XDTIzMDQwNjE4MjI0M1oXDTQzMDQwMjE4MjI0M1owTTEQMA4G
A1UEChMHUmVkIEhhdDENMAsGA1UECxMEcHJvZDEqMCgGA1UEAxMhMjAyMyBDZXJ0
aWZpY2F0ZSBBdXRob3JpdHkgUkhDU3YyMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
MIICCgKCAgEAukugmlnSPsZbxx3MTj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o0PHmziaIHe+Oeesx+Xi/WHUeDc
ZO0IzixnBuhKcBYhaw1ckL61bePWs5eiomLjgUlAZB2+ViH7u+v+/AqeFjdyTCYn
GHLS7CTprBUBnIotIN5G9Uy1QlkrxxQAIZKxeUmqZ/SMXR0hSdOVrnmjUaRdNOke
cz13SFjq0y2+PcsFaptAmFGbi4MiiKk6ofssBR66q/Hmb65qWOijwy24UhNmbiWZ
YyoEjnCcv9rLzuv4hUqAQsk9BwzLbFaDWNAxBUvFBe6tcU7LroZAGE4ohMOdOD3y
jTE=
-----END CERTIFICATE-----
7 changes: 6 additions & 1 deletion src/cfg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import debug from 'debug';
import yaml from 'js-yaml';
import assert from 'assert';
import { ConnectionOptions } from 'rhea-promise';
import { ClientOptions } from '@opensearch-project/opensearch/.';

const log = debug('kaijs:cfg');
/** Default config must present */
Expand Down Expand Up @@ -164,7 +165,7 @@ class Config {
/**
* Uncomment to print whole active config
*/
// log('Active config: %s', '\n' + yaml.dump(this.config_active));
log('Active config: %s', '\n' + yaml.dump(this.config_active));
/** constructor in javascript returns this object automatically
* constructor returns the type of the class, the constructor implicitly returns 'this'
* Even though you technically can't extend a proxy, there is a way to force a class
Expand Down Expand Up @@ -230,6 +231,10 @@ export interface Cfg {
};
};
};
opensearch: {
client: ClientOptions;
indexes_prefix: string;
};
schemas_git_upstream: string;
schemas_local_git_repo_path: string;
schemas_local_dir_unpacked: string;
Expand Down
4 changes: 2 additions & 2 deletions src/db_interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export type ArtifactTypes =
| 'redhat-container-image';

export const atype_to_hub_map = {
'koji-build': 'fedoraproject',
'koji-build-cs': 'centos-stream',
'koji-build': 'fedora',
'koji-build-cs': 'centos',
};

export interface KaiEtaState {
Expand Down
4 changes: 2 additions & 2 deletions src/fqueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ export interface FileQueueMessage {
/** Timestamp from message header */
header_timestamp?: number;
/** Payload of message */
body: any;
body: { [key: string]: any };
/** Message headers */
broker_extra?: any;
broker_extra: { [key: string]: any };
}

async function make(path: string, opts = { poll: false, optimizeList: false }) {
Expand Down
6 changes: 3 additions & 3 deletions src/koji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const log = debug('kaijs:kojibrew');
const cfg = getcfg();

export const koji_clients = {
fedoraproject: xmlrpc.createSecureClient(cfg.koji_fp),
'centos-stream': xmlrpc.createSecureClient(cfg.koji_cs),
fedora: xmlrpc.createSecureClient(cfg.koji_fp),
centos: xmlrpc.createSecureClient(cfg.koji_cs),
};

interface BuildInfo {
Expand Down Expand Up @@ -148,7 +148,7 @@ export const koji_query = async (
log("Response for '%s':\n%o", method, value);
resolve(value);
}
}
},
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/listener_fedora.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const process_msg = (
broker_extra: { ...headers },
};
/** 'sent-at': '2021-07-30T13:10:14+00:00' */
let provider_timestamp = Math.floor(Date.parse(headers['sent-at']) / 1000);
let provider_timestamp = Math.floor(Date.parse(headers!['sent-at']) / 1000);
if (!_.isNaN(provider_timestamp)) {
payload_obj.header_timestamp = provider_timestamp;
}
Expand Down
Loading
Loading