Skip to content

Commit

Permalink
Merge branch 'harness:main' into pixel-point-onboarding
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgolovanov authored Feb 4, 2025
2 parents a3efa6e + 2cef2fe commit 5d23aba
Show file tree
Hide file tree
Showing 185 changed files with 6,672 additions and 1,400 deletions.
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
# install pnpm
RUN npm install -g pnpm@latest-10
COPY . /canary
WORKDIR /canary

Expand All @@ -12,13 +13,10 @@ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-l
FROM base AS build
# install deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
# build all the packages and apps
RUN pnpm run build
# build the microfrontend
WORKDIR /canary/apps/gitness
RUN pnpm run build:webpack
# build all the packages and apps except portal and design-system
RUN pnpm --filter \!portal --filter \!design-system run build

FROM node:20-slim AS final
FROM alpine:3.21 AS final
COPY --from=build /canary/apps/gitness/dist /canary-dist
WORKDIR /canary-dist

Expand Down
29 changes: 29 additions & 0 deletions Dockerfile.mfe
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
# install pnpm
RUN npm install -g pnpm@latest-10
COPY . /canary
WORKDIR /canary

FROM base AS prod-deps
# install deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile

FROM base AS build
# install deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
# build all the packages and apps except gitness
RUN pnpm --filter \!gitness run build
# build the microfrontend
WORKDIR /canary/apps/gitness
RUN rm -rf dist
RUN pnpm run build:webpack

FROM alpine:3.21 AS final
COPY --from=build /canary/apps/gitness/dist /canary-dist
WORKDIR /canary-dist

# FROM harness/harness:unscripted2024 AS server
# COPY --from=build /canary/apps/gitness/dist /canary
# ENV GITNESS_DEVELOPMENT_UI_SOURCE_OVERRIDE=/canary
2 changes: 1 addition & 1 deletion apps/design-system/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@types/lodash-es": "^4.17.12",
"clsx": "^2.1.1",
"lodash-es": "^4.17.21",
"monaco-editor": "0.50.0",
"monaco-editor": "^0.40.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-live": "^4.1.8",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { FC, PropsWithChildren } from 'react'
import { Route, Routes } from 'react-router-dom'

import { ExecutionDetailsView } from '@subjects/views/execution-details'

export const ExecutionDetailsViewWrapper: FC<PropsWithChildren<React.HTMLAttributes<HTMLElement>>> = ({ children }) => {
return (
<Routes>
<Route path="*" element={<ExecutionDetailsView />}>
<Route path="*" element={children} />
</Route>
</Routes>
)
}
6 changes: 6 additions & 0 deletions apps/design-system/src/pages/view-preview/view-preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { NotFoundPage } from '@harnessio/ui/views'

import { CommitDetailsDiffViewWrapper } from './commit-details-diff-view-wrapper'
import CommitDetailsViewWrapper from './commit-details-view-wrapper'
import { ExecutionDetailsViewWrapper } from './execution-details-view-wrapper'
import { ProjectSettingsWrapper } from './project-settings-wrapper'
import PullRequestLayoutWrapper from './pull-request-layout-wrapper'
import { RepoFilesViewWrapper } from './repo-files-view-wrapper'
Expand Down Expand Up @@ -251,6 +252,11 @@ export const viewPreviews: Record<string, ReactNode> = {
<ProjectSettingsWrapper>
<LabelsForm />
</ProjectSettingsWrapper>
),
'execution-details': (
<RootViewWrapper>
<ExecutionDetailsViewWrapper />
</RootViewWrapper>
)
}

Expand Down
50 changes: 50 additions & 0 deletions apps/design-system/src/subjects/views/execution-details/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import {
ExecutionHeader,
ExecutionInfo,
ExecutionState,
ExecutionTabs,
ExecutionTree,
PipelineStatus
} from '@harnessio/ui/views'

import { elements, logs, stages } from './mocks/mock-data'

export const ExecutionDetailsView = () => {
return (
<div className="flex flex-col h-full">
<ExecutionTabs />
<ExecutionHeader
commitName="8fbru3ix"
branchName="master"
title={{ number: '311. ', title: 'Alerting docs: adds sns integration' }}
storage="0 B"
storageAverage="0 B / 250 MB"
simpleOperation="27/100k"
advancedOperations="2/50k"
dataTransfer="4.21 kB/5 GB"
/>
<div className="grid h-[inherit]" style={{ gridTemplateColumns: '1fr 3fr' }}>
<div className="flex flex-col gap-4 border border-white/10 border-r-0 border-t-0">
<PipelineStatus status={ExecutionState.RUNNING} buildTime="1h 30m" createdTime="10 mins ago" />
<ExecutionTree
defaultSelectedId="initialize"
elements={elements}
onSelectNode={({ parentId, childId }: { parentId: string; childId: string }) => {
console.log(`Selected node: Parent ${parentId}, Child ${childId}`)
}}
/>
</div>
<div className="flex flex-col gap-4 border border-white/10 border-t-0">
<ExecutionInfo
logs={logs}
onCopy={() => {}}
onDownload={() => {}}
onEdit={() => {}}
selectedStepIdx={0}
stage={stages[0]}
/>
</div>
</div>
</div>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
import { ExecutionState, ExecutionTreeProps, LivelogLine, StageProps } from '@harnessio/ui/views'

export const logs: LivelogLine[] = [
{ pos: 1, time: 1707000000, duration: 2, out: 'Initializing pipeline...' },
{ pos: 2, time: 1707000002, duration: 3, out: 'Fetching repository...' },
{ pos: 3, time: 1707000005, duration: 5, out: 'Checking out commit abc123...' },
{ pos: 4, time: 1707000010, duration: 10, out: 'Installing dependencies...' },
{ pos: 5, time: 1707000020, duration: 7, out: 'Running pre-build checks...' },
{ pos: 6, time: 1707000027, duration: 12, out: 'Compiling source files...' },
{ pos: 7, time: 1707000039, duration: 3, out: "Compiler warning: Unused variable 'x' in src/utils.ts" },
{ pos: 8, time: 1707000042, duration: 8, out: 'Build completed successfully.' },
{ pos: 9, time: 1707000050, duration: 15, out: 'Running unit tests...' },
{ pos: 10, time: 1707000065, duration: 10, out: 'Test suite passed: 42 tests executed, 0 failed.' },
{ pos: 11, time: 1707000075, duration: 10, out: 'Deploying artifacts...' },
{ pos: 12, time: 1707000085, duration: 12, out: 'Deployment completed successfully.' },
{ pos: 13, time: 1707000097, duration: 2, out: 'Pipeline execution finished.' }
]

export const stages: StageProps[] = [
{
name: 'Initialize',
group: 'Setup',
steps: [
{
name: 'Fetch Repository',
status: ExecutionState.SUCCESS,
started: 1707000000,
stopped: 1707000002,
inputs: [{ name: 'branch', value: 'main' }],
outputs: [{ name: 'commit', value: 'abc123' }],
number: 1
},
{
name: 'Checkout Code',
status: ExecutionState.SUCCESS,
started: 1707000003,
stopped: 1707000005,
inputs: [{ name: 'commit', value: 'abc123' }],
outputs: [{ name: 'workspace', value: '/build/workspace' }],
number: 2
}
]
},
{
name: 'Build',
group: 'Compilation',
steps: [
{
name: 'Install Dependencies',
status: ExecutionState.SUCCESS,
started: 1707000010,
stopped: 1707000015,
inputs: [{ name: 'package.json', value: '/build/workspace/package.json' }],
outputs: [{ name: 'node_modules', value: '/build/workspace/node_modules' }],
number: 3
},
{
name: 'Compile Source',
status: ExecutionState.SUCCESS,
started: 1707000016,
stopped: 1707000025,
inputs: [{ name: 'source', value: '/build/workspace/src' }],
outputs: [{ name: 'binary', value: '/build/workspace/dist' }],
number: 4
}
]
},
{
name: 'Test',
group: 'Verification',
steps: [
{
name: 'Run Unit Tests',
status: ExecutionState.SUCCESS,
started: 1707000030,
stopped: 1707000040,
inputs: [{ name: 'binary', value: '/build/workspace/dist' }],
outputs: [{ name: 'testReport', value: '/build/workspace/reports/tests.xml' }],
number: 5
}
]
},
{
name: 'Deploy',
group: 'Deployment',
steps: [
{
name: 'Deploy to Staging',
status: ExecutionState.SUCCESS,
started: 1707000050,
stopped: 1707000060,
inputs: [{ name: 'testReport', value: '/build/workspace/reports/tests.xml' }],
outputs: [{ name: 'deploymentURL', value: 'https://staging.example.com' }],
number: 6
}
]
}
]

export const elements: ExecutionTreeProps['elements'] = [
{
id: 'initialize',
name: 'Initialize',
status: ExecutionState.SUCCESS,
duration: '00:05',
isSelectable: true,
children: [
{
id: 'fetch-repo',
name: 'Fetch Repository',
status: ExecutionState.SUCCESS,
duration: '00:02',
isSelectable: true
},
{
id: 'checkout-code',
name: 'Checkout Code',
status: ExecutionState.SUCCESS,
duration: '00:03',
isSelectable: true
}
]
},
{
id: 'build',
name: 'Build',
status: ExecutionState.FAILURE,
duration: '00:15',
isSelectable: true,
children: [
{
id: 'install-deps',
name: 'Install Dependencies',
status: ExecutionState.SUCCESS,
duration: '00:10',
isSelectable: true
},
{
id: 'compile',
name: 'Compile Source',
status: ExecutionState.FAILURE,
duration: '00:05',
isSelectable: true
}
]
},
{
id: 'test',
name: 'Test',
status: ExecutionState.SUCCESS,
duration: '00:10',
isSelectable: true,
children: [
{
id: 'unit-tests',
name: 'Run Unit Tests',
status: ExecutionState.SUCCESS,
duration: '00:10',
isSelectable: true
}
]
},
{
id: 'deploy',
name: 'Deploy',
status: ExecutionState.PENDING,
duration: '00:10',
isSelectable: true,
children: [
{
id: 'deploy-staging',
name: 'Deploy to Staging',
status: ExecutionState.PENDING,
duration: '00:10',
isSelectable: true
}
]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@ export const pipelineYaml1 = `pipeline:
stages:
- group:
stages:
- parallel:
stages:
- parallel:
stages:
- steps:
- run: go build
- run: go test
- steps:
- run: npm test
- group:
stages:
- group:
stages:
- steps:
- run: go build
- steps:
- run: npm run
- run: npm test
- group:
steps:
- run: go build
- run: go test
- parallel:
steps:
- run: go build
- run: go test
`
Loading

0 comments on commit 5d23aba

Please sign in to comment.