airbyte-faros-destination 0.19.57-rc7 → 0.20.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/converters/harness/common.d.ts +88 -6
- package/lib/converters/harness/common.js +2 -2
- package/lib/converters/harness/common.js.map +1 -1
- package/lib/converters/harness/executions.d.ts +7 -6
- package/lib/converters/harness/executions.js +170 -143
- package/lib/converters/harness/executions.js.map +1 -1
- package/lib/destination.js +2 -2
- package/lib/destination.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -5
- package/lib/converters/harness/organizations.d.ts +0 -7
- package/lib/converters/harness/organizations.js +0 -29
- package/lib/converters/harness/organizations.js.map +0 -1
- package/lib/converters/harness/pipelines.d.ts +0 -7
- package/lib/converters/harness/pipelines.js +0 -29
- package/lib/converters/harness/pipelines.js.map +0 -1
|
@@ -1,20 +1,102 @@
|
|
|
1
1
|
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
+
import { ComputeApplication } from '../common/common';
|
|
2
3
|
import { Converter } from '../converter';
|
|
3
|
-
|
|
4
|
-
export interface CICDOrganizationKey {
|
|
4
|
+
interface CICDOrganization {
|
|
5
5
|
uid: string;
|
|
6
6
|
source: string;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
interface CICDPipeline {
|
|
9
9
|
uid: string;
|
|
10
|
-
organization:
|
|
10
|
+
organization: CICDOrganization;
|
|
11
11
|
}
|
|
12
|
-
export interface
|
|
12
|
+
export interface CICDBuild {
|
|
13
13
|
uid: string;
|
|
14
|
-
pipeline:
|
|
14
|
+
pipeline: CICDPipeline;
|
|
15
|
+
}
|
|
16
|
+
interface CICDRepository {
|
|
17
|
+
uid: string;
|
|
18
|
+
organization: CICDOrganization;
|
|
19
|
+
}
|
|
20
|
+
export interface CICDArtifact {
|
|
21
|
+
readonly uid: string;
|
|
22
|
+
readonly repository: CICDRepository;
|
|
23
|
+
}
|
|
24
|
+
export interface Execution {
|
|
25
|
+
uid: string;
|
|
26
|
+
application: ComputeApplication;
|
|
27
|
+
startedAt: number;
|
|
28
|
+
endedAt: number;
|
|
29
|
+
env: string;
|
|
30
|
+
status: string;
|
|
31
|
+
build: CICDBuild;
|
|
32
|
+
artifact: CICDArtifact;
|
|
33
|
+
}
|
|
34
|
+
export interface ExecutionImplementation {
|
|
35
|
+
application: ComputeApplication;
|
|
36
|
+
env: string;
|
|
37
|
+
build?: CICDBuild;
|
|
38
|
+
artifact?: CICDArtifact;
|
|
39
|
+
}
|
|
40
|
+
interface HarnessService {
|
|
41
|
+
id: string;
|
|
42
|
+
name?: string;
|
|
43
|
+
artifactType: string;
|
|
44
|
+
artifactSources: {
|
|
45
|
+
name: string;
|
|
46
|
+
}[];
|
|
47
|
+
}
|
|
48
|
+
interface HarnessEnvironment {
|
|
49
|
+
type: string;
|
|
50
|
+
name: string;
|
|
51
|
+
}
|
|
52
|
+
export interface HarnessExecutionNode {
|
|
53
|
+
id: string;
|
|
54
|
+
application: {
|
|
55
|
+
id: string;
|
|
56
|
+
name?: string;
|
|
57
|
+
services?: {
|
|
58
|
+
nodes: HarnessService[];
|
|
59
|
+
};
|
|
60
|
+
environments?: {
|
|
61
|
+
nodes: HarnessEnvironment[];
|
|
62
|
+
};
|
|
63
|
+
tags?: {
|
|
64
|
+
name: string;
|
|
65
|
+
value: string;
|
|
66
|
+
}[];
|
|
67
|
+
};
|
|
68
|
+
status: string;
|
|
69
|
+
createdAt: number;
|
|
70
|
+
startedAt: number;
|
|
71
|
+
endedAt: number;
|
|
72
|
+
artifacts?: {
|
|
73
|
+
id: string;
|
|
74
|
+
buildNo: string;
|
|
75
|
+
artifactSource: {
|
|
76
|
+
id: string;
|
|
77
|
+
name: string;
|
|
78
|
+
};
|
|
79
|
+
}[];
|
|
80
|
+
outcomes?: {
|
|
81
|
+
nodes: {
|
|
82
|
+
service: HarnessService;
|
|
83
|
+
environment: HarnessEnvironment;
|
|
84
|
+
}[];
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export interface ExecutionWorkflow {
|
|
88
|
+
application: ComputeApplication;
|
|
89
|
+
env: string;
|
|
90
|
+
build: CICDBuild;
|
|
91
|
+
artifact: CICDArtifact;
|
|
92
|
+
}
|
|
93
|
+
export interface ExecutionPipeline {
|
|
94
|
+
application: ComputeApplication;
|
|
95
|
+
env: string;
|
|
15
96
|
}
|
|
16
97
|
/** Harness converter base */
|
|
17
98
|
export declare abstract class HarnessConverter extends Converter {
|
|
18
99
|
source: string;
|
|
19
100
|
id(record: AirbyteRecord): any;
|
|
20
101
|
}
|
|
102
|
+
export {};
|
|
@@ -9,8 +9,8 @@ class HarnessConverter extends converter_1.Converter {
|
|
|
9
9
|
this.source = 'Harness';
|
|
10
10
|
}
|
|
11
11
|
id(record) {
|
|
12
|
-
var _a, _b
|
|
13
|
-
return (
|
|
12
|
+
var _a, _b;
|
|
13
|
+
return (_b = (_a = record === null || record === void 0 ? void 0 : record.record) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.id;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.HarnessConverter = HarnessConverter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/harness/common.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/converters/harness/common.ts"],"names":[],"mappings":";;;AAGA,4CAAuC;AA2GvC,6BAA6B;AAC7B,MAAsB,gBAAiB,SAAQ,qBAAS;IAAxD;;QACE,WAAM,GAAG,SAAS,CAAC;IAKrB,CAAC;IAHC,EAAE,CAAC,MAAqB;;QACtB,OAAO,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,0CAAE,IAAI,0CAAE,EAAE,CAAC;IAClC,CAAC;CACF;AAND,4CAMC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { AirbyteRecord } from 'faros-airbyte-cdk';
|
|
2
|
-
import { DestinationModel, DestinationRecord } from '../converter';
|
|
2
|
+
import { DestinationModel, DestinationRecord, StreamContext } from '../converter';
|
|
3
3
|
import { HarnessConverter } from './common';
|
|
4
4
|
export declare class Executions extends HarnessConverter {
|
|
5
5
|
readonly destinationModels: ReadonlyArray<DestinationModel>;
|
|
6
6
|
private seenApplications;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
private
|
|
10
|
-
private
|
|
7
|
+
convert(record: AirbyteRecord, ctx: StreamContext): Promise<ReadonlyArray<DestinationRecord>>;
|
|
8
|
+
private parseArtifactFromTags;
|
|
9
|
+
private parseWorkflow;
|
|
10
|
+
private parsePipeline;
|
|
11
11
|
private toBuildStatus;
|
|
12
|
+
private toEnvironmentStatus;
|
|
13
|
+
private toExecution;
|
|
12
14
|
private toDeploymentStatus;
|
|
13
|
-
private toEnvironment;
|
|
14
15
|
}
|
|
@@ -1,213 +1,240 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.Executions = void 0;
|
|
7
4
|
const faros_js_client_1 = require("faros-js-client");
|
|
8
|
-
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
9
5
|
const common_1 = require("../common/common");
|
|
10
6
|
const common_2 = require("./common");
|
|
7
|
+
const DEFAULT_CICD_ORGANIZATION_UID = 'default';
|
|
8
|
+
const DEFAULT_EXECUTION_TAG_APPLICATION_PLATFORM = 'faros_app_platform';
|
|
9
|
+
const DEFAULT_EXECUTION_TAG_ARTIFACT_ORG = 'faros_artifact_org';
|
|
10
|
+
const DEFAULT_EXECUTION_TAG_ARTIFACT_SOURCE = 'faros_artifact_source';
|
|
11
|
+
const DEFAULT_EXECUTION_TAG_ARTIFACT_REPO = 'faros_artifact_repo';
|
|
11
12
|
class Executions extends common_2.HarnessConverter {
|
|
12
13
|
constructor() {
|
|
13
14
|
super(...arguments);
|
|
14
15
|
this.destinationModels = [
|
|
16
|
+
'cicd_ArtifactDeployment',
|
|
15
17
|
'cicd_Build',
|
|
16
18
|
'cicd_Deployment',
|
|
17
|
-
'cicd_DeploymentTag',
|
|
18
19
|
'compute_Application',
|
|
19
|
-
'faros_Tag',
|
|
20
20
|
];
|
|
21
21
|
this.seenApplications = new Set();
|
|
22
|
-
this.seenTags = new Set();
|
|
23
22
|
}
|
|
24
|
-
async convert(record) {
|
|
25
|
-
var _a, _b
|
|
23
|
+
async convert(record, ctx) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const executionRaw = record.record.data;
|
|
26
26
|
const source = this.streamName.source;
|
|
27
|
-
const execution = record.record.data;
|
|
28
27
|
const res = [];
|
|
29
|
-
const
|
|
30
|
-
if (!cdInfo) {
|
|
31
|
-
return res;
|
|
32
|
-
}
|
|
33
|
-
// Build key
|
|
34
|
-
const build = {
|
|
35
|
-
uid: execution.planExecutionId,
|
|
36
|
-
pipeline: {
|
|
37
|
-
uid: execution.pipelineIdentifier,
|
|
38
|
-
organization: { uid: execution.orgIdentifier, source },
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
// Build (pipeline execution)
|
|
42
|
-
res.push({
|
|
43
|
-
model: 'cicd_Build',
|
|
44
|
-
record: {
|
|
45
|
-
...build,
|
|
46
|
-
name: execution.name,
|
|
47
|
-
startedAt: faros_js_client_1.Utils.toDate(execution.startTs),
|
|
48
|
-
endedAt: faros_js_client_1.Utils.toDate(execution.endTs),
|
|
49
|
-
status: this.toBuildStatus(execution.status),
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
// Application (from service)
|
|
53
|
-
const serviceName = (_b = cdInfo.serviceIdentifiers) === null || _b === void 0 ? void 0 : _b[0];
|
|
28
|
+
const execution = this.toExecution(executionRaw, source);
|
|
54
29
|
let application = null;
|
|
55
|
-
if (
|
|
56
|
-
application = common_1.Common.computeApplication(
|
|
30
|
+
if (execution === null || execution === void 0 ? void 0 : execution.application) {
|
|
31
|
+
application = common_1.Common.computeApplication((_a = execution.application) === null || _a === void 0 ? void 0 : _a.name, (_b = execution.application) === null || _b === void 0 ? void 0 : _b.platform);
|
|
57
32
|
const appKey = application.uid;
|
|
58
33
|
if (!this.seenApplications.has(appKey)) {
|
|
59
34
|
res.push({ model: 'compute_Application', record: application });
|
|
60
35
|
this.seenApplications.add(appKey);
|
|
61
36
|
}
|
|
62
37
|
}
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const deploymentKey = {
|
|
67
|
-
uid: execution.planExecutionId,
|
|
68
|
-
source,
|
|
69
|
-
};
|
|
38
|
+
const deploymentStatus = this.toDeploymentStatus(execution.status);
|
|
39
|
+
const buildStatus = this.toBuildStatus(execution.status);
|
|
40
|
+
const deployment = { uid: execution.uid, source };
|
|
70
41
|
res.push({
|
|
71
42
|
model: 'cicd_Deployment',
|
|
72
43
|
record: {
|
|
73
|
-
...
|
|
44
|
+
...deployment,
|
|
74
45
|
application,
|
|
75
|
-
build,
|
|
76
|
-
startedAt: faros_js_client_1.Utils.toDate(execution.
|
|
77
|
-
endedAt: faros_js_client_1.Utils.toDate(execution.
|
|
78
|
-
env: this.
|
|
79
|
-
status:
|
|
46
|
+
build: execution.build,
|
|
47
|
+
startedAt: faros_js_client_1.Utils.toDate(execution.startedAt),
|
|
48
|
+
endedAt: faros_js_client_1.Utils.toDate(execution.endedAt),
|
|
49
|
+
env: this.toEnvironmentStatus(execution.env),
|
|
50
|
+
status: deploymentStatus,
|
|
80
51
|
},
|
|
81
52
|
});
|
|
82
|
-
|
|
83
|
-
const variables = this.parseInputSetVariables(execution.inputSetYaml);
|
|
84
|
-
for (const variable of variables) {
|
|
85
|
-
const tagUid = `harness__${variable.name}__${variable.value}`;
|
|
86
|
-
const tagKey = { uid: tagUid };
|
|
87
|
-
if (!this.seenTags.has(tagUid)) {
|
|
88
|
-
res.push({
|
|
89
|
-
model: 'faros_Tag',
|
|
90
|
-
record: {
|
|
91
|
-
...tagKey,
|
|
92
|
-
key: variable.name,
|
|
93
|
-
value: variable.value,
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
this.seenTags.add(tagUid);
|
|
97
|
-
}
|
|
53
|
+
if (execution.build) {
|
|
98
54
|
res.push({
|
|
99
|
-
model: '
|
|
55
|
+
model: 'cicd_Build',
|
|
100
56
|
record: {
|
|
101
|
-
|
|
102
|
-
|
|
57
|
+
...execution.build,
|
|
58
|
+
startedAt: faros_js_client_1.Utils.toDate(execution.startedAt),
|
|
59
|
+
endedAt: faros_js_client_1.Utils.toDate(execution.endedAt),
|
|
60
|
+
status: buildStatus,
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (execution.artifact) {
|
|
65
|
+
res.push({
|
|
66
|
+
model: 'cicd_ArtifactDeployment',
|
|
67
|
+
record: {
|
|
68
|
+
artifact: execution.artifact,
|
|
69
|
+
deployment,
|
|
103
70
|
},
|
|
104
71
|
});
|
|
105
72
|
}
|
|
106
73
|
return res;
|
|
107
74
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
75
|
+
parseArtifactFromTags(execution) {
|
|
76
|
+
var _a, _b, _c, _d;
|
|
77
|
+
if (!execution.artifacts || !execution.artifacts.length) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
const executionArtifact = execution.artifacts[0];
|
|
81
|
+
// artifact repo organization pulled from application tags
|
|
82
|
+
const organization = {
|
|
83
|
+
uid: (_a = execution.application.tags.find((t) => t.name === DEFAULT_EXECUTION_TAG_ARTIFACT_ORG)) === null || _a === void 0 ? void 0 : _a.value,
|
|
84
|
+
source: (_c = (_b = execution.application.tags.find((t) => t.name === DEFAULT_EXECUTION_TAG_ARTIFACT_SOURCE)) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : executionArtifact === null || executionArtifact === void 0 ? void 0 : executionArtifact.artifactSource.name,
|
|
85
|
+
};
|
|
86
|
+
const repository = {
|
|
87
|
+
uid: (_d = execution.application.tags.find((t) => t.name === DEFAULT_EXECUTION_TAG_ARTIFACT_REPO)) === null || _d === void 0 ? void 0 : _d.value,
|
|
88
|
+
organization,
|
|
89
|
+
};
|
|
90
|
+
const artifact = {
|
|
91
|
+
uid: executionArtifact === null || executionArtifact === void 0 ? void 0 : executionArtifact.buildNo,
|
|
92
|
+
repository,
|
|
93
|
+
};
|
|
94
|
+
if (artifact.uid &&
|
|
95
|
+
artifact.repository.uid &&
|
|
96
|
+
artifact.repository.organization.uid &&
|
|
97
|
+
artifact.repository.organization.source) {
|
|
98
|
+
return artifact;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
return undefined;
|
|
111
102
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
103
|
+
}
|
|
104
|
+
parseWorkflow(execution, source) {
|
|
105
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
106
|
+
const outcome = (_a = execution.outcomes) === null || _a === void 0 ? void 0 : _a.nodes.find((o) => { var _a; return (_a = o.service) === null || _a === void 0 ? void 0 : _a.artifactType; });
|
|
107
|
+
if (!outcome) {
|
|
108
|
+
return undefined;
|
|
117
109
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return
|
|
110
|
+
const artifactSource = outcome.service.artifactSources.find((a) => a.name);
|
|
111
|
+
if (!artifactSource) {
|
|
112
|
+
return undefined;
|
|
121
113
|
}
|
|
114
|
+
const build = {
|
|
115
|
+
uid: execution.id,
|
|
116
|
+
pipeline: {
|
|
117
|
+
uid: (_c = (_b = outcome.service.name) !== null && _b !== void 0 ? _b : execution.application.name) !== null && _c !== void 0 ? _c : artifactSource.name,
|
|
118
|
+
organization: {
|
|
119
|
+
uid: DEFAULT_CICD_ORGANIZATION_UID,
|
|
120
|
+
source,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
let artifact = undefined;
|
|
125
|
+
// artifact computation needs to have application tags
|
|
126
|
+
if (execution.application.tags) {
|
|
127
|
+
artifact = this.parseArtifactFromTags(execution);
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
application: common_1.Common.computeApplication((_d = execution.application.name) !== null && _d !== void 0 ? _d : artifactSource.name, (_g = (_f = (_e = execution.application.tags) === null || _e === void 0 ? void 0 : _e.find((t) => t.name === DEFAULT_EXECUTION_TAG_APPLICATION_PLATFORM)) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : ''),
|
|
131
|
+
env: (_h = outcome.environment.name) !== null && _h !== void 0 ? _h : outcome.environment.type,
|
|
132
|
+
build,
|
|
133
|
+
artifact,
|
|
134
|
+
};
|
|
122
135
|
}
|
|
123
|
-
|
|
124
|
-
|
|
136
|
+
parsePipeline(execution) {
|
|
137
|
+
var _a, _b, _c;
|
|
138
|
+
const service = (_a = execution.application.services) === null || _a === void 0 ? void 0 : _a.nodes.find((s) => s.artifactType);
|
|
139
|
+
if (!service) {
|
|
125
140
|
return;
|
|
126
141
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
142
|
+
const artifactSource = service.artifactSources.find((a) => a.name);
|
|
143
|
+
const environment = (_b = execution.application.environments) === null || _b === void 0 ? void 0 : _b.nodes.find((e) => e.type);
|
|
144
|
+
if (!artifactSource || !environment) {
|
|
131
145
|
return;
|
|
132
146
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
record.value !== '<+input>' // Skip unresolved inputs
|
|
138
|
-
) {
|
|
139
|
-
result.push({ name: record.name, value: record.value });
|
|
140
|
-
}
|
|
141
|
-
// Recursively check all properties
|
|
142
|
-
for (const value of Object.values(record)) {
|
|
143
|
-
this.extractVariables(value, result);
|
|
144
|
-
}
|
|
147
|
+
return {
|
|
148
|
+
application: common_1.Common.computeApplication(artifactSource.name, service.artifactType),
|
|
149
|
+
env: (_c = environment.name) !== null && _c !== void 0 ? _c : environment.type,
|
|
150
|
+
};
|
|
145
151
|
}
|
|
146
152
|
toBuildStatus(status) {
|
|
147
|
-
const
|
|
148
|
-
switch (
|
|
149
|
-
case '
|
|
153
|
+
const statusLower = status.toLowerCase();
|
|
154
|
+
switch (statusLower) {
|
|
155
|
+
case 'aborted':
|
|
156
|
+
case 'rejected':
|
|
150
157
|
return { category: 'Canceled', detail: status };
|
|
151
|
-
case '
|
|
152
|
-
case '
|
|
158
|
+
case 'error':
|
|
159
|
+
case 'expired':
|
|
160
|
+
case 'failed':
|
|
153
161
|
return { category: 'Failed', detail: status };
|
|
154
|
-
case '
|
|
155
|
-
case '
|
|
156
|
-
case '
|
|
157
|
-
case 'APPROVALWAITING':
|
|
158
|
-
case 'ASYNCWAITING':
|
|
159
|
-
case 'TASKWAITING':
|
|
160
|
-
case 'TIMEDWAITING':
|
|
162
|
+
case 'paused':
|
|
163
|
+
case 'queued':
|
|
164
|
+
case 'waiting':
|
|
161
165
|
return { category: 'Queued', detail: status };
|
|
162
|
-
case '
|
|
166
|
+
case 'resumed':
|
|
167
|
+
case 'running':
|
|
163
168
|
return { category: 'Running', detail: status };
|
|
164
|
-
case '
|
|
169
|
+
case 'success':
|
|
165
170
|
return { category: 'Success', detail: status };
|
|
171
|
+
case 'skipped':
|
|
166
172
|
default:
|
|
167
173
|
return { category: 'Custom', detail: status };
|
|
168
174
|
}
|
|
169
175
|
}
|
|
176
|
+
toEnvironmentStatus(status) {
|
|
177
|
+
const statusLower = status.toLowerCase();
|
|
178
|
+
if (statusLower.startsWith('prod')) {
|
|
179
|
+
return { category: 'Prod', detail: status };
|
|
180
|
+
}
|
|
181
|
+
if (statusLower === 'staging') {
|
|
182
|
+
return { category: 'Staging', detail: status };
|
|
183
|
+
}
|
|
184
|
+
if (statusLower.startsWith('dev')) {
|
|
185
|
+
return { category: 'Dev', detail: status };
|
|
186
|
+
}
|
|
187
|
+
if (statusLower === 'qa') {
|
|
188
|
+
return { category: 'QA', detail: status };
|
|
189
|
+
}
|
|
190
|
+
return { category: 'Custom', detail: status };
|
|
191
|
+
}
|
|
192
|
+
toExecution(item, source) {
|
|
193
|
+
let implementation;
|
|
194
|
+
if (item.outcomes) {
|
|
195
|
+
implementation = this.parseWorkflow(item, source);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
implementation = this.parsePipeline(item);
|
|
199
|
+
}
|
|
200
|
+
if (!implementation) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
uid: item.id,
|
|
205
|
+
application: implementation.application,
|
|
206
|
+
startedAt: item.startedAt,
|
|
207
|
+
endedAt: item.endedAt,
|
|
208
|
+
env: implementation.env,
|
|
209
|
+
status: item.status,
|
|
210
|
+
build: implementation.build,
|
|
211
|
+
artifact: implementation.artifact,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
170
214
|
toDeploymentStatus(status) {
|
|
171
|
-
const
|
|
172
|
-
switch (
|
|
173
|
-
case '
|
|
215
|
+
const statusLower = status.toLowerCase();
|
|
216
|
+
switch (statusLower) {
|
|
217
|
+
case 'aborted':
|
|
218
|
+
case 'rejected':
|
|
174
219
|
return { category: 'Canceled', detail: status };
|
|
175
|
-
case '
|
|
176
|
-
case '
|
|
220
|
+
case 'error':
|
|
221
|
+
case 'expired':
|
|
222
|
+
case 'failed':
|
|
177
223
|
return { category: 'Failed', detail: status };
|
|
178
|
-
case '
|
|
179
|
-
case '
|
|
180
|
-
case '
|
|
181
|
-
case 'APPROVALWAITING':
|
|
182
|
-
case 'ASYNCWAITING':
|
|
183
|
-
case 'TASKWAITING':
|
|
184
|
-
case 'TIMEDWAITING':
|
|
224
|
+
case 'paused':
|
|
225
|
+
case 'queued':
|
|
226
|
+
case 'waiting':
|
|
185
227
|
return { category: 'Queued', detail: status };
|
|
186
|
-
case '
|
|
228
|
+
case 'resumed':
|
|
229
|
+
case 'running':
|
|
187
230
|
return { category: 'Running', detail: status };
|
|
188
|
-
case '
|
|
231
|
+
case 'success':
|
|
189
232
|
return { category: 'Success', detail: status };
|
|
233
|
+
case 'skipped':
|
|
190
234
|
default:
|
|
191
235
|
return { category: 'Custom', detail: status };
|
|
192
236
|
}
|
|
193
237
|
}
|
|
194
|
-
toEnvironment(envName, envType) {
|
|
195
|
-
const env = envName || envType || 'unknown';
|
|
196
|
-
const envLower = env.toLowerCase();
|
|
197
|
-
if (envLower.includes('prod')) {
|
|
198
|
-
return { category: 'Prod', detail: env };
|
|
199
|
-
}
|
|
200
|
-
if (envLower.includes('staging')) {
|
|
201
|
-
return { category: 'Staging', detail: env };
|
|
202
|
-
}
|
|
203
|
-
if (envLower.includes('dev')) {
|
|
204
|
-
return { category: 'Dev', detail: env };
|
|
205
|
-
}
|
|
206
|
-
if (envLower.includes('qa') || envLower.includes('test')) {
|
|
207
|
-
return { category: 'QA', detail: env };
|
|
208
|
-
}
|
|
209
|
-
return { category: 'Custom', detail: env };
|
|
210
|
-
}
|
|
211
238
|
}
|
|
212
239
|
exports.Executions = Executions;
|
|
213
240
|
//# sourceMappingURL=executions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executions.js","sourceRoot":"","sources":["../../../src/converters/harness/executions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"executions.js","sourceRoot":"","sources":["../../../src/converters/harness/executions.ts"],"names":[],"mappings":";;;AACA,qDAAsC;AAEtC,6CAAwC;AAExC,qCASkB;AAElB,MAAM,6BAA6B,GAAG,SAAS,CAAC;AAChD,MAAM,0CAA0C,GAAG,oBAAoB,CAAC;AACxE,MAAM,kCAAkC,GAAG,oBAAoB,CAAC;AAChE,MAAM,qCAAqC,GAAG,uBAAuB,CAAC;AACtE,MAAM,mCAAmC,GAAG,qBAAqB,CAAC;AAElE,MAAa,UAAW,SAAQ,yBAAgB;IAAhD;;QACW,sBAAiB,GAAoC;YAC5D,yBA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Q,EAAE,MAAM,EAAE,MAAM,EAAC,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AAxSD,gCAwSC"}
|
package/lib/destination.js
CHANGED
|
@@ -551,7 +551,7 @@ class FarosDestination extends faros_airbyte_cdk_1.AirbyteDestination {
|
|
|
551
551
|
for await (const line of input) {
|
|
552
552
|
let stateMessage = undefined;
|
|
553
553
|
await this.handleRecordProcessingError(stats, async () => {
|
|
554
|
-
var _a, _b, _c, _d
|
|
554
|
+
var _a, _b, _c, _d;
|
|
555
555
|
const msg = (0, faros_airbyte_cdk_1.parseAirbyteMessage)(line);
|
|
556
556
|
stats.messagesRead++;
|
|
557
557
|
if ((0, faros_airbyte_cdk_1.isStateMessage)(msg)) {
|
|
@@ -629,7 +629,7 @@ class FarosDestination extends faros_airbyte_cdk_1.AirbyteDestination {
|
|
|
629
629
|
}
|
|
630
630
|
else {
|
|
631
631
|
stateMessage = msg;
|
|
632
|
-
stateReset = (0, lodash_1.isEmpty)((
|
|
632
|
+
stateReset = (0, lodash_1.isEmpty)(faros_airbyte_cdk_1.State.decode(msg.state));
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
635
|
else if (msg.type === faros_airbyte_cdk_1.AirbyteMessageType.RECORD) {
|