-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pipelines): add tekton core type and Output component integratio…
…n utils (#16) * add tekton core types * add Integration utils and refactor * Add unit test for integration utils
- Loading branch information
1 parent
bdce6c3
commit e44299e
Showing
35 changed files
with
2,074 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@aonic-ui/pipelines": minor | ||
--- | ||
|
||
Added core tekton types | ||
Added integration utils, hooks and sample data helpers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import { PipelineRunKind } from '../types/pipelinerun'; | ||
import { createPipelineRunData, mockPipelineRunConfig } from '../utils/data-utils'; | ||
import { RunStatus, SucceedConditionReason } from '../utils/pipelinerun-utils'; | ||
|
||
const pipelineRunConfig: mockPipelineRunConfig = { | ||
name: 'test', | ||
status: RunStatus.Running, | ||
tasks: [ | ||
{ name: 'scan-task', status: RunStatus.Succeeded }, | ||
{ name: 'sbom-task', status: RunStatus.Succeeded }, | ||
], | ||
}; | ||
|
||
const { pipelineRun, taskRuns, pods } = createPipelineRunData(pipelineRunConfig); | ||
|
||
export const scanPipelineRun = pipelineRun; | ||
export const scanTaskRuns = taskRuns; | ||
export const scanTaskRunPods = pods; | ||
|
||
export enum DataState { | ||
RUNNING = 'Running', | ||
SUCCEEDED = 'Succeeded', | ||
FAILED = 'Failed', | ||
SKIPPED = 'Skipped', | ||
PENDING = 'PipelineRunPending', | ||
STOPPED = 'StoppedRunFinally', | ||
CANCELLED = 'CancelledRunFinally', | ||
CANCELLING = 'PipelineRunCancelling', | ||
STOPPING = 'PipelineRunStopping', | ||
|
||
/*Custom data state to test various scnearios*/ | ||
STATUS_WITHOUT_CONDITIONS = 'StatusWithoutCondition', | ||
EXCEEDED_NODE_RESOURCES = 'ExceededNodeResources', | ||
STATUS_WITH_EMPTY_CONDITIONS = 'StatusWithEmptyCondition', | ||
STATUS_WITH_UNKNOWN_REASON = 'StatusWithUnknownReason', | ||
} | ||
|
||
type TestPipelineRuns = { [key in Partial<DataState>]: PipelineRunKind }; | ||
|
||
const sampleTasks = [ | ||
{ name: 'build-task', status: RunStatus.Succeeded }, | ||
{ name: 'scan-task', status: RunStatus.Succeeded }, | ||
{ name: 'sbom-task', status: RunStatus.Succeeded }, | ||
]; | ||
|
||
export const testPipelineRuns: TestPipelineRuns = { | ||
[DataState.RUNNING]: createPipelineRunData({ | ||
name: 'test-plr-running', | ||
status: RunStatus.Running, | ||
tasks: sampleTasks, | ||
}).pipelineRun, | ||
[DataState.PENDING]: createPipelineRunData({ | ||
name: 'test-plr-pending', | ||
status: RunStatus.Pending, | ||
tasks: sampleTasks, | ||
}).pipelineRun, | ||
[DataState.SUCCEEDED]: createPipelineRunData({ | ||
name: 'test-plr-succeeded', | ||
status: RunStatus.Succeeded, | ||
tasks: sampleTasks, | ||
}).pipelineRun, | ||
[DataState.FAILED]: createPipelineRunData({ | ||
name: 'test-plr-failed', | ||
status: RunStatus.Failed, | ||
tasks: sampleTasks, | ||
}).pipelineRun, | ||
|
||
[DataState.CANCELLING]: createPipelineRunData({ | ||
name: 'test-plr-cancelling', | ||
status: RunStatus.Running, | ||
spec: { status: 'CancelledRunFinally' }, | ||
tasks: sampleTasks, | ||
}).pipelineRun, | ||
[DataState.CANCELLED]: createPipelineRunData({ | ||
name: 'test-plr-cancelled', | ||
status: RunStatus.Cancelled, | ||
spec: { status: 'CancelledRunFinally' }, | ||
tasks: sampleTasks, | ||
}).pipelineRun, | ||
[DataState.STOPPING]: createPipelineRunData({ | ||
name: 'test-plr-cancelled', | ||
status: SucceedConditionReason.PipelineRunStopping, | ||
tasks: sampleTasks, | ||
}).pipelineRun, | ||
[DataState.SKIPPED]: createPipelineRunData({ | ||
name: 'test-plr-skipped', | ||
status: RunStatus.Skipped, | ||
tasks: sampleTasks, | ||
}).pipelineRun, | ||
[DataState.STOPPED]: createPipelineRunData({ | ||
name: 'test-plr-stopping', | ||
status: SucceedConditionReason.PipelineRunStopped, | ||
tasks: sampleTasks, | ||
}).pipelineRun, | ||
[DataState.EXCEEDED_NODE_RESOURCES]: createPipelineRunData({ | ||
name: 'test-plr-exceeded-node-resources', | ||
status: SucceedConditionReason.ExceededNodeResources, | ||
tasks: sampleTasks, | ||
}).pipelineRun, | ||
[DataState.STATUS_WITHOUT_CONDITIONS]: createPipelineRunData({ | ||
name: 'test-plr-without-conditions', | ||
status: 'STATUS_WITHOUT_CONDITIONS', | ||
tasks: sampleTasks, | ||
}).pipelineRun, | ||
[DataState.STATUS_WITH_UNKNOWN_REASON]: createPipelineRunData({ | ||
name: 'test-plr-with-unknown-reason', | ||
status: RunStatus.Unknown, | ||
tasks: sampleTasks, | ||
}).pipelineRun, | ||
[DataState.STATUS_WITH_EMPTY_CONDITIONS]: createPipelineRunData({ | ||
name: 'test-plr-with-empty-conditions', | ||
status: 'STATUS_WITH_EMPTY_CONDITIONS', | ||
tasks: sampleTasks, | ||
}).pipelineRun, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { createPipelineRunData, mockPipelineRunConfig } from '../utils/data-utils'; | ||
import { RunStatus } from '../utils/pipelinerun-utils'; | ||
|
||
const pipelineRunConfig: mockPipelineRunConfig = { | ||
name: 'test-plr', | ||
status: RunStatus.Running, | ||
tasks: [ | ||
{ | ||
name: 'sbom-task', | ||
status: RunStatus.Succeeded, | ||
annotations: { | ||
'task.output.location': 'results', | ||
'task.results.format': 'application/text', | ||
'task.results.key': 'LINK_TO_SBOM', | ||
}, | ||
}, | ||
{ | ||
name: 'ec-task', | ||
status: RunStatus.Succeeded, | ||
annotations: { | ||
'task.results.type': 'ec', | ||
'task.results.format': 'application/json', | ||
'task.output.location': 'logs', | ||
'task.output.container': 'step-report', | ||
}, | ||
}, | ||
{ | ||
name: 'acs-image-scan-task', | ||
status: RunStatus.Succeeded, | ||
annotations: { | ||
'task.results.type': 'roxctl-image-scan', | ||
'task.results.format': 'application/json', | ||
'task.output.location': 'logs', | ||
'task.output.container': 'step-report', | ||
}, | ||
}, | ||
{ | ||
name: 'acs-image-check-task', | ||
status: RunStatus.Succeeded, | ||
annotations: { | ||
'task.results.type': 'roxctl-image-check', | ||
'task.results.format': 'application/json', | ||
'task.output.location': 'logs', | ||
'task.output.container': 'step-report', | ||
}, | ||
}, | ||
{ | ||
name: 'acs-deployment-check-task', | ||
status: RunStatus.Succeeded, | ||
annotations: { | ||
'task.results.type': 'roxctl-deployment-check', | ||
'task.results.format': 'application/json', | ||
'task.output.location': 'logs', | ||
'task.output.container': 'step-report', | ||
}, | ||
}, | ||
{ | ||
name: 'sbom-with-external-link-task', | ||
status: RunStatus.Succeeded, | ||
annotations: { | ||
'task.output.location': 'results', | ||
'task.results.type': 'external-link', | ||
'task.results.format': 'application/text', | ||
'task.results.key': 'LINK_TO_SBOM', | ||
}, | ||
results: [ | ||
{ | ||
name: 'LINK_TO_SBOM', | ||
type: 'string', | ||
value: 'http://quay.io/test/image:build-8e536-1692702836', | ||
}, | ||
], | ||
}, | ||
], | ||
createTaskRuns: true, | ||
createPods: true, | ||
}; | ||
|
||
const { pipelineRun, taskRuns, pods } = createPipelineRunData(pipelineRunConfig); | ||
|
||
export const SampleOutputPipelineRunData = { | ||
pipelineRun, | ||
taskRuns, | ||
pods, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.