Skip to content

Commit

Permalink
feat(tekton): Add view output action in pipelinerun list view
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikjeeyar committed Jan 25, 2024
1 parent c19d23b commit 2417a17
Show file tree
Hide file tree
Showing 18 changed files with 1,509 additions and 50 deletions.
14 changes: 0 additions & 14 deletions plugins/shared-react/src/types/pipeline/taskRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,3 @@ export type TaskRunKind = {
};
status?: TaskRunStatus;
};

export enum TaskRunResultsAnnotations {
KEY = 'task.results.key',
TYPE = 'task.results.type',
}

export enum TaskRunResultsAnnotationValue {
EXTERNAL_LINK = 'external-link',
}

export enum TaskRunResults {
SBOM = 'LINK_TO_SBOM',
SCAN_OUTPUT = 'SCAN_OUTPUT',
}
4 changes: 3 additions & 1 deletion plugins/tekton/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"tsc": "tsc"
},
"dependencies": {
"@aonic-ui/pipelines": "^1.0.0",
"@backstage/catalog-model": "^1.4.3",
"@backstage/core-components": "^0.13.6",
"@backstage/core-plugin-api": "^1.7.0",
Expand All @@ -39,10 +40,11 @@
"@material-ui/lab": "^4.0.0-alpha.45",
"@patternfly/patternfly": "^5.1.0",
"@patternfly/react-charts": "^7.1.1",
"@patternfly/react-core": "^5.1.1",
"@patternfly/react-core": "^5.1.2",
"@patternfly/react-icons": "^5.1.1",
"@patternfly/react-tokens": "^5.1.2",
"@patternfly/react-topology": "^5.1.0",
"@patternfly/react-table": "^5.1.2",
"classnames": "^2.3.2",
"dagre": "^0.8.5",
"lodash": "^4.17.21",
Expand Down
95 changes: 95 additions & 0 deletions plugins/tekton/src/__fixtures__/enterpriseContractData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { EnterpriseContractResult } from '../types/output';

export const enterpriseContractResult: EnterpriseContractResult = {
success: false,
components: [
{
name: 'Unnamed',
containerImage:
'quay-q8tg2.apps.cluster-q8tg2.sandbox1329.opentlc.com/quayadmin/sbtestapp@sha256:bb1fcefb952b9f0b6c0c6fe9e84ea8a20fd828a2744dfbd1a9cb164d85507e12',
violations: [
{
msg:
'No image attestations found matching the given public key. Verify the correct public key was provided, and one or more attestations were created. Error: no matching attestations: no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY\n' +
' no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY',
metadata: {
collections: [],
code: 'builtin.attestation.signature_check',
description:
'The attestation signature matches available signing materials.',
title: 'Attestation signature check passed',
},
},

{
msg: 'No image signatures found matching the given public key. Verify the correct public key was provided, and a signature was created. Error: no matching signatures: no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY',
metadata: {
collections: [],
code: 'builtin.image.signature_check',
description:
'The image signature matches available signing materials.',
title: 'Image signature check passed',
},
},
],
warnings: [
{
msg:
'No image attestations found matching the given public key. Verify the correct public key was provided, and one or more attestations were created. Error: no matching attestations: no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY\n' +
' no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY',
metadata: {
collections: [],
code: 'builtin.attestation.signature_check',
description:
'The attestation signature matches available signing materials.',
title: 'Attestation signature check passed',
},
},
],
successes: [
{
msg:
'No image attestations found matching the given public key. Verify the correct public key was provided, and one or more attestations were created. Error: no matching attestations: no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY\n' +
' no valid tlog entries found rekor log public key not found for payload. Check your TUF root (see cosign initialize) or set a custom key with env var SIGSTORE_REKOR_PUBLIC_KEY',
metadata: {
collections: [],
code: 'builtin.attestation.signature_check',
description:
'The attestation signature matches available signing materials.',
title: 'Attestation signature check passed',
},
},
],
success: false,
},
],

key:
'-----BEGIN PUBLIC KEY-----\n' +
'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEufoDqiDhIyBmgFLdbgZugfk0qJSx\n' +
'mF3EqQuuhU1gMlQiAs2kWVHEc/SKyp4/ktaG3ktLgAhids7RfqDm7iAgGg==\n' +
'-----END PUBLIC KEY-----\n' +
'',
policy: {
configuration: {
collections: [],
exclude: [],
},
description:
'Includes rules for levels 1, 2 & 3 of SLSA v0.1. This is the default config used for new RHTAP applications. Available collections are defined in https://redhat-appstudio.github.io/docs.stonesoup.io/ec-policies/release_policy.html#_available_rule_collections. If a different policy configuration is desired, this resource can serve as a starting point. See the docs on how to include and exclude rules https://redhat-appstudio.github.io/docs.stonesoup.io/ec-policies/policy_configuration.html#_including_and_excluding_rules.',
sources: [
{
name: 'Default',
policy: [
'github.com/enterprise-contract/ec-policies//policy/lib',
'github.com/enterprise-contract/ec-policies//policy/release',
],
data: [
'oci::quay.io/redhat-appstudio-tekton-catalog/data-acceptable-bundles:latest',
'github.com/release-engineering/rhtap-ec-policy//data',
],
},
],
publicKey: '/workspace/cosign.pub',
},
};
30 changes: 30 additions & 0 deletions plugins/tekton/src/__fixtures__/pods-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,36 @@ export const testPods: V1Pod[] = [
phase: 'Succeeded',
conditions: [],

startTime: new Date('2023-12-08T12:19:38Z'),
},
},
{
metadata: {
name: 'pipelineRun-image-scan-task-t237ev-pod',
namespace: 'karthik',
uid: '055cc13a-bd3e-414e-9eb6-e6cb72870578',
resourceVersion: '379623',
labels: {
'backstage.io/kubernetes-id': 'developer-portal',
'janus-idp.io/tekton': 'developer-portal',
'tekton.dev/pipeline': 'test-pipeline',
'tekton.dev/pipelineRun': 'test-pipeline-8e09zm',
'tekton.dev/pipelineTask': 'sbom-task',
'tekton.dev/task': 'sbom-task',
'tekton.dev/taskRun': 'test-pipeline-8e09zm-sbom-task',
},
},
spec: {
containers: [
{
name: 'step-print-scan-results',
},
],
},
status: {
phase: 'Succeeded',
conditions: [],

startTime: new Date('2023-12-08T12:19:38Z'),
},
},
Expand Down
172 changes: 172 additions & 0 deletions plugins/tekton/src/__fixtures__/taskRunData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,175 @@ export const taskRunWithSBOMResultExternalLink: TaskRunKind = {
],
},
};

export const enterpriseContractTaskRun: TaskRunKind = {
apiVersion: 'tekton.dev/v1',
kind: 'TaskRun',
metadata: {
labels: {
'tekton.dev/pipelineRun': 'test-plr',
},
annotations: {
'chains.tekton.dev/signed': 'true',
'pipeline.openshift.io/preferredName': 'pipelineRun-ec-task',
'pipeline.openshift.io/started-by': 'kube:admin',
'pipeline.tekton.dev/release': 'a2f17f6',
'task.results.format': 'application/json',
'task.output.location': 'logs',
'task.results.type': 'ec',
name: 'pipelineRun-ec-task-t237ev',
uid: '764d0a6c-a4f6-419c-a3c3-585c2a9eb67c',
},
},
spec: {
serviceAccountName: 'pipeline',
taskRef: {
kind: 'Task',
name: 'ec-task',
},
timeout: '1h0m0s',
},
status: {
completionTime: '2023-11-08T08:18:25Z',
conditions: [
{
lastTransitionTime: '2023-11-08T08:18:25Z',
message: 'All Steps have completed executing',
reason: 'Succeeded',
status: 'True',
type: 'Succeeded',
},
],
podName: 'pipelineRun-ec-task-t237ev-pod',
},
};

export const acsImageScanTaskRun: TaskRunKind = {
apiVersion: 'tekton.dev/v1',
kind: 'TaskRun',
metadata: {
labels: {
'tekton.dev/pipelineRun': 'test-plr',
},
annotations: {
'chains.tekton.dev/signed': 'true',
'pipeline.openshift.io/preferredName': 'pipelineRun-image-scan-task',
'pipeline.openshift.io/started-by': 'kube:admin',
'pipeline.tekton.dev/release': 'a2f17f6',
'task.results.format': 'application/json',
'task.output.location': 'logs',
'task.results.type': 'roxctl-image-scan',
'task.results.key': 'SCAN_OUTPUT',
name: 'pipelineRun-image-scan-task-t237ev',
uid: '764d0a6c-a4f6-419c-a3c3-585c2a9eb67c',
},
},
spec: {
serviceAccountName: 'pipeline',
taskRef: {
kind: 'Task',
name: 'image-scan-task',
},
timeout: '1h0m0s',
},
status: {
completionTime: '2023-11-08T08:18:25Z',
conditions: [
{
lastTransitionTime: '2023-11-08T08:18:25Z',
message: 'All Steps have completed executing',
reason: 'Succeeded',
status: 'True',
type: 'Succeeded',
},
],
podName: 'pipelineRun-image-scan-task-t237ev-pod',
},
};

export const acsImageCheckTaskRun: TaskRunKind = {
apiVersion: 'tekton.dev/v1',
kind: 'TaskRun',
metadata: {
labels: {
'tekton.dev/pipelineRun': 'test-plr',
},
annotations: {
'chains.tekton.dev/signed': 'true',
'pipeline.openshift.io/preferredName': 'pipelineRun-image-check-task',
'pipeline.openshift.io/started-by': 'kube:admin',
'pipeline.tekton.dev/release': 'a2f17f6',
'task.results.format': 'application/json',
'task.output.location': 'logs',
'task.results.type': 'roxctl-image-check',
'task.results.key': 'SCAN_OUTPUT',
name: 'pipelineRun-image-check-task-t237ev',
uid: '764d0a6c-a4f6-419c-a3c3-585c2a9eb67c',
},
},
spec: {
serviceAccountName: 'pipeline',
taskRef: {
kind: 'Task',
name: 'image-check-task',
},
timeout: '1h0m0s',
},
status: {
completionTime: '2023-11-08T08:18:25Z',
conditions: [
{
lastTransitionTime: '2023-11-08T08:18:25Z',
message: 'All Steps have completed executing',
reason: 'Succeeded',
status: 'True',
type: 'Succeeded',
},
],
podName: 'pipelineRun-image-check-task-t237ev-pod',
},
};

export const acsDeploymentCheckTaskRun: TaskRunKind = {
apiVersion: 'tekton.dev/v1',
kind: 'TaskRun',
metadata: {
labels: {
'tekton.dev/pipelineRun': 'test-plr',
},
annotations: {
'chains.tekton.dev/signed': 'true',
'pipeline.openshift.io/preferredName':
'pipelineRun-deployment-check-task',
'pipeline.openshift.io/started-by': 'kube:admin',
'pipeline.tekton.dev/release': 'a2f17f6',
'task.results.format': 'application/json',
'task.output.location': 'logs',
'task.results.type': 'roxctl-deployment-check',
'task.results.key': 'SCAN_OUTPUT',
name: 'pipelineRun-deployment-check-task-t237ev',
uid: '764d0a6c-a4f6-419c-a3c3-585c2a9eb67c',
},
},
spec: {
serviceAccountName: 'pipeline',
taskRef: {
kind: 'Task',
name: 'deployment-check-task',
},
timeout: '1h0m0s',
},
status: {
completionTime: '2023-11-08T08:18:25Z',
conditions: [
{
lastTransitionTime: '2023-11-08T08:18:25Z',
message: 'All Steps have completed executing',
reason: 'Succeeded',
status: 'True',
type: 'Succeeded',
},
],
podName: 'pipelineRun-deployment-check-task-t237ev-pod',
},
};
37 changes: 37 additions & 0 deletions plugins/tekton/src/components/Icons/OutputIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import * as React from 'react';

import { createStyles, makeStyles, Theme } from '@material-ui/core';
import { SVGIconProps } from '@patternfly/react-icons/dist/esm/createIcon';
import classNames from 'classnames';

const useStyles = makeStyles((theme: Theme) =>
createStyles({
icon: {
fill: 'var(--pf-v5-global--Color--100)',
},
disabledButton: {
fill: theme.palette.grey[600],
},
}),
);

const OutputIcon: React.FC<SVGIconProps> = (props): React.ReactElement => {
const classes = useStyles();
return (
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
xmlns="http://www.w3.org/2000/svg"
className={classNames(classes.icon, {
[classes.disabledButton]: props.disabled,
})}
{...props}
>
<path d="M5 21C4.45 21 3.97917 20.8042 3.5875 20.4125C3.19583 20.0208 3 19.55 3 19V5C3 4.45 3.19583 3.97917 3.5875 3.5875C3.97917 3.19583 4.45 3 5 3H19C19.55 3 20.0208 3.19583 20.4125 3.5875C20.8042 3.97917 21 4.45 21 5V19C21 19.55 20.8042 20.0208 20.4125 20.4125C20.0208 20.8042 19.55 21 19 21H5ZM5 19H19V7H5V19ZM7 12V10H17V12H7ZM7 16V14H13V16H7Z" />
</svg>
);
};

export default OutputIcon;
Loading

0 comments on commit 2417a17

Please sign in to comment.