From 2b4092809c96753c592d38051602288791817162 Mon Sep 17 00:00:00 2001 From: Trey Ivy Date: Wed, 13 Nov 2024 14:37:41 +0000 Subject: [PATCH 1/4] add aBYTESTREAM to blob statuses --- ent/schema/blob.go | 2 +- pkg/processing/archive.go | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ent/schema/blob.go b/ent/schema/blob.go index c7747a6..41eb21e 100644 --- a/ent/schema/blob.go +++ b/ent/schema/blob.go @@ -16,7 +16,7 @@ func (Blob) Fields() []ent.Field { field.String("uri").Unique().Immutable(), field.Int64("size_bytes").Optional(), field.Enum("archiving_status"). - Values("QUEUED", "ARCHIVING", "SUCCESS", "FAILED"). + Values("QUEUED", "ARCHIVING", "SUCCESS", "FAILED", "BYTESTREAM"). Default("QUEUED"), field.String("reason").Optional(), field.String("archive_url").Optional(), diff --git a/pkg/processing/archive.go b/pkg/processing/archive.go index 1e89f4a..235271a 100644 --- a/pkg/processing/archive.go +++ b/pkg/processing/archive.go @@ -138,8 +138,9 @@ func NewNoopArchiver() NoopArchiver { // ArchiveBlob Archive Blob function. func (na NoopArchiver) ArchiveBlob(_ context.Context, blobURI detectors.BlobURI) ent.Blob { return ent.Blob{ - URI: string(blobURI), - SizeBytes: 0, - ArchiveURL: "", + URI: string(blobURI), + SizeBytes: 0, + ArchiveURL: "", + ArchivingStatus: blob.ArchivingStatusBYTESTREAM, } } From b18f2cc1b0317dc7f2ed8062316a6b4107d3c59e Mon Sep 17 00:00:00 2001 From: Trey Ivy Date: Wed, 13 Nov 2024 14:51:27 +0000 Subject: [PATCH 2/4] bytestream status --- ent/gen/ent/blob/blob.go | 11 ++++++----- ent/gen/ent/migrate/schema.go | 2 +- internal/graphql/schema/ent.graphql | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/ent/gen/ent/blob/blob.go b/ent/gen/ent/blob/blob.go index ce4469e..a628b8c 100644 --- a/ent/gen/ent/blob/blob.go +++ b/ent/gen/ent/blob/blob.go @@ -57,10 +57,11 @@ const DefaultArchivingStatus = ArchivingStatusQUEUED // ArchivingStatus values. const ( - ArchivingStatusQUEUED ArchivingStatus = "QUEUED" - ArchivingStatusARCHIVING ArchivingStatus = "ARCHIVING" - ArchivingStatusSUCCESS ArchivingStatus = "SUCCESS" - ArchivingStatusFAILED ArchivingStatus = "FAILED" + ArchivingStatusQUEUED ArchivingStatus = "QUEUED" + ArchivingStatusARCHIVING ArchivingStatus = "ARCHIVING" + ArchivingStatusSUCCESS ArchivingStatus = "SUCCESS" + ArchivingStatusFAILED ArchivingStatus = "FAILED" + ArchivingStatusBYTESTREAM ArchivingStatus = "BYTESTREAM" ) func (as ArchivingStatus) String() string { @@ -70,7 +71,7 @@ func (as ArchivingStatus) String() string { // ArchivingStatusValidator is a validator for the "archiving_status" field enum values. It is called by the builders before save. func ArchivingStatusValidator(as ArchivingStatus) error { switch as { - case ArchivingStatusQUEUED, ArchivingStatusARCHIVING, ArchivingStatusSUCCESS, ArchivingStatusFAILED: + case ArchivingStatusQUEUED, ArchivingStatusARCHIVING, ArchivingStatusSUCCESS, ArchivingStatusFAILED, ArchivingStatusBYTESTREAM: return nil default: return fmt.Errorf("blob: invalid enum value for archiving_status field: %q", as) diff --git a/ent/gen/ent/migrate/schema.go b/ent/gen/ent/migrate/schema.go index 91119c5..a90be65 100644 --- a/ent/gen/ent/migrate/schema.go +++ b/ent/gen/ent/migrate/schema.go @@ -198,7 +198,7 @@ var ( {Name: "id", Type: field.TypeInt, Increment: true}, {Name: "uri", Type: field.TypeString, Unique: true}, {Name: "size_bytes", Type: field.TypeInt64, Nullable: true}, - {Name: "archiving_status", Type: field.TypeEnum, Enums: []string{"QUEUED", "ARCHIVING", "SUCCESS", "FAILED"}, Default: "QUEUED"}, + {Name: "archiving_status", Type: field.TypeEnum, Enums: []string{"QUEUED", "ARCHIVING", "SUCCESS", "FAILED", "BYTESTREAM"}, Default: "QUEUED"}, {Name: "reason", Type: field.TypeString, Nullable: true}, {Name: "archive_url", Type: field.TypeString, Nullable: true}, } diff --git a/internal/graphql/schema/ent.graphql b/internal/graphql/schema/ent.graphql index b42269b..ffbe3ca 100644 --- a/internal/graphql/schema/ent.graphql +++ b/internal/graphql/schema/ent.graphql @@ -821,6 +821,7 @@ enum BlobArchivingStatus @goModel(model: "github.com/buildbarn/bb-portal/ent/gen ARCHIVING SUCCESS FAILED + BYTESTREAM } """ BlobWhereInput is used for filtering Blob objects. From e7df45b79d2c1d445338e8d9b15ae2a05fb80672 Mon Sep 17 00:00:00 2001 From: Trey Ivy Date: Wed, 13 Nov 2024 18:39:48 +0000 Subject: [PATCH 3/4] ephemeral download buttons --- .../[invocationID]/index.graphql.ts | 1 + .../components/Problems/LogOutput/index.tsx | 40 ++++++++ .../Problems/TestResultContainer/index.tsx | 12 ++- frontend/src/graphql/__generated__/gql.ts | 4 +- frontend/src/graphql/__generated__/graphql.ts | 17 ++-- .../__generated__/persisted-documents.json | 4 +- internal/graphql/custom.resolvers.go | 15 +++ internal/graphql/model/models_gen.go | 5 +- internal/graphql/schema/custom.graphql | 32 ++++-- internal/graphql/server_gen.go | 97 +++++++++++++++++++ ...D-output-blob-archiving-queued.golden.json | 1 + tools/sqllitebrowser.sh | 12 +++ 12 files changed, 215 insertions(+), 25 deletions(-) create mode 100644 tools/sqllitebrowser.sh diff --git a/frontend/src/app/bazel-invocations/[invocationID]/index.graphql.ts b/frontend/src/app/bazel-invocations/[invocationID]/index.graphql.ts index 3ed40f2..ce5cc17 100644 --- a/frontend/src/app/bazel-invocations/[invocationID]/index.graphql.ts +++ b/frontend/src/app/bazel-invocations/[invocationID]/index.graphql.ts @@ -302,6 +302,7 @@ fragment BlobReferenceInfo on BlobReference { name sizeInBytes downloadURL + ephemeralURL } `) diff --git a/frontend/src/components/Problems/LogOutput/index.tsx b/frontend/src/components/Problems/LogOutput/index.tsx index 789d71a..5aef0d3 100644 --- a/frontend/src/components/Problems/LogOutput/index.tsx +++ b/frontend/src/components/Problems/LogOutput/index.tsx @@ -2,6 +2,13 @@ import React, {useEffect, useState} from 'react'; import {util} from 'zod'; import {BlobReference} from '@/graphql/__generated__/graphql'; import {LogViewerCard} from "@/components/LogViewer"; +import { env } from 'next-runtime-env'; +import { Button, Card, Space, Tooltip } from 'antd'; +import ButtonGroup from 'antd/es/button/button-group'; +import { DownloadOutlined, WarningOutlined } from '@ant-design/icons'; +import Link from 'next/link'; +import styles from "@/components/LogViewer/index.module.css" +import DownloadButton from '@/components/DownloadButton'; interface Props { blobReference: BlobReference; @@ -10,8 +17,26 @@ interface Props { const DEFAULT_TAIL_BYTES = 10_000; + + /* eslint-disable consistent-return */ const LogOutput: React.FC = ({blobReference, tailBytes = DEFAULT_TAIL_BYTES}) => { + // if (blobReference.ephemeralURL != "" && env('NEXT_PUBLIC_BROWSER_URL')) { + // const url = new URL(blobReference.ephemeralURL, env('NEXT_PUBLIC_BROWSER_URL')) + // var logDownload = + // + // + // + // + // - // - //