merge develop into release
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2026-07-15 16:00:57 +09:00
4 changed files with 180 additions and 8 deletions
+68 -3
View File
@@ -1,5 +1,5 @@
import { useEffect, useMemo, useState, type MouseEvent } from 'react'; import { useEffect, useMemo, useState, type MouseEvent } from 'react';
import { ChevronLeft, ChevronRight, MoreHorizontal, Play, RotateCcw, Square, Trash2 } from 'lucide-react'; import { ChevronLeft, ChevronRight, MoreHorizontal, Play, RotateCcw, Square, Trash2, Upload } from 'lucide-react';
import { Button, Card, CardHeader, Modal } from '../../components/ui'; import { Button, Card, CardHeader, Modal } from '../../components/ui';
import { Requester } from '../../components/requester'; import { Requester } from '../../components/requester';
import { useToast } from '../../components/toast'; import { useToast } from '../../components/toast';
@@ -7,7 +7,7 @@ import { PageTitle } from '../../layout/AppLayout';
import type { BuildJob, SourceComponent } from '../../types/application'; import type { BuildJob, SourceComponent } from '../../types/application';
import { LoadingModal, useMinimumLoading } from '../operations/operation-utils'; import { LoadingModal, useMinimumLoading } from '../operations/operation-utils';
import { AppSelector, StatusBadge, formatDate, isBuildDone, useApps } from './ApplicationControls'; import { AppSelector, StatusBadge, formatDate, isBuildDone, useApps } from './ApplicationControls';
import { cancelBuildJob, createBuildJob, deleteBuildJob, listBuildJobsPage, listSources } from './application-api'; import { cancelBuildJob, createBuildJob, createQuickDeployment, deleteBuildJob, listBuildJobsPage, listSources } from './application-api';
import { getStoredSelectedComponentId, selectedComponentChangedEventName, setStoredSelectedComponentId } from '../../lib/selected-app'; import { getStoredSelectedComponentId, selectedComponentChangedEventName, setStoredSelectedComponentId } from '../../lib/selected-app';
function blockPageAgentDestructiveClick(event: MouseEvent<HTMLElement>) { function blockPageAgentDestructiveClick(event: MouseEvent<HTMLElement>) {
@@ -29,7 +29,7 @@ function buildTargetForType(type?: string | null) {
function predictedArtifact(component: SourceComponent | undefined, branch: string, commitSha: string) { function predictedArtifact(component: SourceComponent | undefined, branch: string, commitSha: string) {
if (!component) return '-'; if (!component) return '-';
const suffix = commitSha.trim() ? commitSha.trim().slice(0, 7) : branch; const suffix = commitSha.trim() ? commitSha.trim().slice(0, 7) : '<commit-sha>';
if (component.type === 'ELECTRON') return `${component.name}-${suffix}.AppImage`; if (component.type === 'ELECTRON') return `${component.name}-${suffix}.AppImage`;
if (component.type === 'DATABASE' || component.type === 'MIGRATION') return `${component.name}:${branch}:migration-check`; if (component.type === 'DATABASE' || component.type === 'MIGRATION') return `${component.name}:${branch}:migration-check`;
return `localhost:5000/${component.name}:${suffix}`; return `localhost:5000/${component.name}:${suffix}`;
@@ -64,6 +64,12 @@ function resultArtifact(job: BuildJob) {
return job.image || job.artifact || '-'; return job.image || job.artifact || '-';
} }
function isQuickDeployable(job: BuildJob) {
return job.status === 'SUCCEEDED'
&& Boolean(job.image)
&& ['CONTAINER', 'STATIC_WEB'].includes(job.component.type);
}
function jobTime(job: BuildJob) { function jobTime(job: BuildJob) {
const value = new Date(job.createdAt || job.startedAt || job.finishedAt || 0).getTime(); const value = new Date(job.createdAt || job.startedAt || job.finishedAt || 0).getTime();
return Number.isNaN(value) ? 0 : value; return Number.isNaN(value) ? 0 : value;
@@ -95,9 +101,12 @@ export function BuildManagementPage() {
const [commitSha, setCommitSha] = useState(''); const [commitSha, setCommitSha] = useState('');
const [selectedJob, setSelectedJob] = useState<BuildJob | null>(null); const [selectedJob, setSelectedJob] = useState<BuildJob | null>(null);
const [deleteTarget, setDeleteTarget] = useState<BuildJob | null>(null); const [deleteTarget, setDeleteTarget] = useState<BuildJob | null>(null);
const [quickDeployTarget, setQuickDeployTarget] = useState<BuildJob | null>(null);
const [quickDeployNamespace, setQuickDeployNamespace] = useState('');
const [confirmOpen, setConfirmOpen] = useState(false); const [confirmOpen, setConfirmOpen] = useState(false);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [deletingJob, setDeletingJob] = useState(false); const [deletingJob, setDeletingJob] = useState(false);
const [quickDeploying, setQuickDeploying] = useState(false);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
const [range, setRange] = useState<BuildRange>('week'); const [range, setRange] = useState<BuildRange>('week');
const [totalJobs, setTotalJobs] = useState(0); const [totalJobs, setTotalJobs] = useState(0);
@@ -276,6 +285,29 @@ export function BuildManagementPage() {
} }
}; };
const openQuickDeploy = (job: BuildJob) => {
setQuickDeployTarget(job);
setQuickDeployNamespace(job.component.app.namespace || '');
};
const quickDeploy = async () => {
if (!quickDeployTarget || !quickDeployNamespace.trim() || quickDeploying) return;
setQuickDeploying(true);
try {
await createQuickDeployment({
buildJobId: quickDeployTarget.id,
environment: 'prod',
namespace: quickDeployNamespace.trim()
});
toast({ type: 'success', message: '빠른 배포 작업이 실행되었습니다.' });
setQuickDeployTarget(null);
} catch (error) {
toast({ type: 'error', message: error instanceof Error ? error.message : '빠른 배포에 실패했습니다.' });
} finally {
setQuickDeploying(false);
}
};
return ( return (
<> <>
<PageTitle <PageTitle
@@ -404,6 +436,11 @@ export function BuildManagementPage() {
<RotateCcw className="size-4" /> <RotateCcw className="size-4" />
</Button> </Button>
)} )}
{isQuickDeployable(job) ? (
<Button variant="outline" className="size-8 px-0" title="빠른 배포" aria-label="빠른 배포" onClick={() => openQuickDeploy(job)}>
<Upload className="size-4" />
</Button>
) : null}
{isBuildDone(job.status) ? ( {isBuildDone(job.status) ? (
<Button <Button
variant="ghost" variant="ghost"
@@ -506,6 +543,34 @@ export function BuildManagementPage() {
<p className="text-muted-foreground">삭제된 빌드 작업 이력과 로그는 목록에서 사라집니다.</p> <p className="text-muted-foreground">삭제된 빌드 작업 이력과 로그는 목록에서 사라집니다.</p>
</div> </div>
</Modal> </Modal>
<Modal
open={Boolean(quickDeployTarget)}
title="빠른 배포"
onClose={() => {
if (!quickDeploying) setQuickDeployTarget(null);
}}
footer={
<>
<Button variant="outline" disabled={quickDeploying} onClick={() => setQuickDeployTarget(null)}>취소</Button>
<Button disabled={quickDeploying || !quickDeployNamespace.trim()} onClick={quickDeploy}>
<Upload className="size-4" />
{quickDeploying ? '배포 중' : '배포'}
</Button>
</>
}
>
<div className="space-y-3 text-sm">
<p className="text-muted-foreground">릴리즈를 만들지 않고 선택한 빌드 이미지로 현재 워크로드를 교체합니다. 런처 앱 버전은 갱신하지 않습니다.</p>
<div className="grid gap-2 rounded-md border border-border bg-muted/20 p-4 text-xs">
<div className="flex items-center justify-between gap-4"><span className="text-muted-foreground">구성요소</span><span className="font-medium">{quickDeployTarget?.component.name ?? '-'}</span></div>
<div className="min-w-0"><p className="text-muted-foreground">이미지</p><p className="mt-1 truncate font-mono font-medium">{quickDeployTarget?.image ?? '-'}</p></div>
</div>
<label className="block">
<span className="text-xs font-medium text-muted-foreground">네임스페이스 <b className="text-foreground">*</b></span>
<input className="mt-2 h-9 w-full rounded-md border border-input bg-background px-3 text-sm outline-none" value={quickDeployNamespace} disabled={quickDeploying} onChange={(event) => setQuickDeployNamespace(event.target.value)} />
</label>
</div>
</Modal>
<Modal <Modal
open={confirmOpen} open={confirmOpen}
title="빌드 실행 확인" title="빌드 실행 확인"
@@ -270,7 +270,7 @@ export function DeploymentManagementPage() {
<span className="text-xs font-medium text-muted-foreground">No. {totalDeployments - ((currentPage - 1) * deploymentPageSize + index)}</span> <span className="text-xs font-medium text-muted-foreground">No. {totalDeployments - ((currentPage - 1) * deploymentPageSize + index)}</span>
<Badge tone={statusTone(deployment.status)}>{statusLabel(deployment.status)}</Badge> <Badge tone={statusTone(deployment.status)}>{statusLabel(deployment.status)}</Badge>
<span className="text-base font-medium">{deployment.app.name}</span> <span className="text-base font-medium">{deployment.app.name}</span>
<span className="text-base font-medium">{deployment.release?.version || '-'}</span> <span className="text-base font-medium">{deployment.release?.version || '빠른 배포'}</span>
</div> </div>
<div className="mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs"> <div className="mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs">
<span className="text-muted-foreground">환경 <b className="text-foreground">{environmentLabel(deployment.environment)}</b></span> <span className="text-muted-foreground">환경 <b className="text-foreground">{environmentLabel(deployment.environment)}</b></span>
+11
View File
@@ -251,6 +251,17 @@ export function createDeployment(input: {
}); });
} }
export function createQuickDeployment(input: {
buildJobId: string;
environment: string;
namespace: string;
}) {
return apiRequest<{ deploymentJob: DeploymentJob }>('/apps/deployments', {
method: 'POST',
body: JSON.stringify(input)
});
}
export function listMigrations() { export function listMigrations() {
return apiRequest<RuntimeControlJob[]>('/apps/migrations'); return apiRequest<RuntimeControlJob[]>('/apps/migrations');
} }
+97 -1
View File
@@ -1,4 +1,4 @@
import { ChevronLeft, ChevronRight, MoreHorizontal, Play, Plus, RotateCcw, Trash2 } from 'lucide-react'; import { ChevronLeft, ChevronRight, MoreHorizontal, Play, Plus, RotateCcw, Trash2, Upload } from 'lucide-react';
import { useEffect, useMemo, useState } from 'react'; import { useEffect, useMemo, useState } from 'react';
import { Badge, Button, Card, CardHeader, Modal } from '../../components/ui'; import { Badge, Button, Card, CardHeader, Modal } from '../../components/ui';
import { useToast } from '../../components/toast'; import { useToast } from '../../components/toast';
@@ -7,6 +7,8 @@ import { formatDateTime } from '../../lib/date-format';
import { LoadingModal, useMinimumLoading } from '../operations/operation-utils'; import { LoadingModal, useMinimumLoading } from '../operations/operation-utils';
import { import {
createLauncherBuildJob, createLauncherBuildJob,
deployLauncherBackend,
getLauncherBackendDeployment,
getLauncherSource, getLauncherSource,
listLauncherBuildEnv, listLauncherBuildEnv,
listLauncherBuildJobs, listLauncherBuildJobs,
@@ -16,6 +18,7 @@ import {
type LauncherSource, type LauncherSource,
type LauncherBuildJob, type LauncherBuildJob,
type LauncherBuildEnvVariable, type LauncherBuildEnvVariable,
type LauncherBackendDeployment,
type LauncherVersion type LauncherVersion
} from './launcher-api'; } from './launcher-api';
@@ -132,6 +135,9 @@ export function LauncherBuildPage() {
const [buildEnv, setBuildEnv] = useState<LauncherBuildEnvVariable[]>([]); const [buildEnv, setBuildEnv] = useState<LauncherBuildEnvVariable[]>([]);
const [buildEnvSaving, setBuildEnvSaving] = useState(false); const [buildEnvSaving, setBuildEnvSaving] = useState(false);
const [selectedJob, setSelectedJob] = useState<LauncherBuildJob | null>(null); const [selectedJob, setSelectedJob] = useState<LauncherBuildJob | null>(null);
const [quickDeployJob, setQuickDeployJob] = useState<LauncherBuildJob | null>(null);
const [backendDeployment, setBackendDeployment] = useState<LauncherBackendDeployment | null>(null);
const [quickDeploying, setQuickDeploying] = useState(false);
const [confirmOpen, setConfirmOpen] = useState(false); const [confirmOpen, setConfirmOpen] = useState(false);
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [page, setPage] = useState(1); const [page, setPage] = useState(1);
@@ -153,6 +159,13 @@ export function LauncherBuildPage() {
const pagedJobs = jobs; const pagedJobs = jobs;
const hasActiveJob = jobs.some((job) => job.status === 'PENDING' || job.status === 'RUNNING'); const hasActiveJob = jobs.some((job) => job.status === 'PENDING' || job.status === 'RUNNING');
const isQuickDeployable = (job: LauncherBuildJob) => (
target === 'launcher-backend'
&& job.target === 'launcher-backend'
&& job.status === 'SUCCEEDED'
&& Boolean(job.downloadUrl)
);
const loadBuildJobs = (nextPage = page, nextTarget = target, nextRange = range) => ( const loadBuildJobs = (nextPage = page, nextTarget = target, nextRange = range) => (
listLauncherBuildJobsPage({ listLauncherBuildJobsPage({
target: nextTarget, target: nextTarget,
@@ -269,6 +282,31 @@ export function LauncherBuildPage() {
.finally(() => setLoading(false)); .finally(() => setLoading(false));
}; };
const openQuickDeploy = (job: LauncherBuildJob) => {
setQuickDeployJob(job);
setBackendDeployment(null);
getLauncherBackendDeployment()
.then(setBackendDeployment)
.catch((error: Error) => {
toast({ type: 'error', title: '배포 대상 조회 실패', message: error.message });
});
};
const quickDeploy = () => {
if (!quickDeployJob?.downloadUrl) return;
setQuickDeploying(true);
deployLauncherBackend(quickDeployJob.downloadUrl)
.then(() => {
toast({ type: 'success', message: '런처 백엔드를 배포했습니다.' });
setQuickDeployJob(null);
refresh();
})
.catch((error: Error) => {
toast({ type: 'error', title: '백엔드 배포 실패', message: error.message });
})
.finally(() => setQuickDeploying(false));
};
const updateBuildEnv = (index: number, patch: Partial<LauncherBuildEnvVariable>) => { const updateBuildEnv = (index: number, patch: Partial<LauncherBuildEnvVariable>) => {
setBuildEnv((prev) => prev.map((variable, variableIndex) => ( setBuildEnv((prev) => prev.map((variable, variableIndex) => (
variableIndex === index ? { ...variable, ...patch } : variable variableIndex === index ? { ...variable, ...patch } : variable
@@ -440,10 +478,23 @@ export function LauncherBuildPage() {
<span>생성 <b className="text-foreground">{formatDate(job.createdAt)}</b></span> <span>생성 <b className="text-foreground">{formatDate(job.createdAt)}</b></span>
</div> </div>
</div> </div>
<div className="flex shrink-0 items-center gap-1">
{isQuickDeployable(job) ? (
<Button
variant="outline"
className="size-8 px-0"
title="빠른 배포"
aria-label="빠른 배포"
onClick={() => openQuickDeploy(job)}
>
<Upload className="size-4" />
</Button>
) : null}
<Button variant="outline" className="size-8 px-0" title="로그" aria-label="로그" onClick={() => setSelectedJob(job)}> <Button variant="outline" className="size-8 px-0" title="로그" aria-label="로그" onClick={() => setSelectedJob(job)}>
<MoreHorizontal className="size-4" /> <MoreHorizontal className="size-4" />
</Button> </Button>
</div> </div>
</div>
<div className="mt-3 grid gap-3 rounded-md border border-border bg-card px-3 py-2 text-xs md:grid-cols-[minmax(0,0.8fr)_minmax(0,1.2fr)]"> <div className="mt-3 grid gap-3 rounded-md border border-border bg-card px-3 py-2 text-xs md:grid-cols-[minmax(0,0.8fr)_minmax(0,1.2fr)]">
<div className="min-w-0"> <div className="min-w-0">
<p className="text-muted-foreground">산출물</p> <p className="text-muted-foreground">산출물</p>
@@ -500,6 +551,51 @@ export function LauncherBuildPage() {
{selectedJob?.logs || '작업을 선택하면 로그가 표시됩니다.'} {selectedJob?.logs || '작업을 선택하면 로그가 표시됩니다.'}
</pre> </pre>
</Modal> </Modal>
<Modal
open={Boolean(quickDeployJob)}
title="빠른 배포"
onClose={() => !quickDeploying && setQuickDeployJob(null)}
footer={
<>
<Button variant="outline" onClick={() => setQuickDeployJob(null)} disabled={quickDeploying}>취소</Button>
<Button onClick={quickDeploy} disabled={quickDeploying || !quickDeployJob?.downloadUrl}>
<Upload className="size-4" />
{quickDeploying ? '배포 중' : '배포'}
</Button>
</>
}
>
<div className="space-y-3 text-sm">
<div className="rounded-md border border-border bg-muted/20 px-4 py-3">
<p className="font-medium">성공한 백엔드 빌드 이미지를 바로 배포합니다.</p>
<p className="mt-1 text-xs leading-5 text-muted-foreground">
현재 설정된 복제 수와 CPU, 메모리 제한은 변경하지 않습니다.
</p>
</div>
<div className="grid gap-2 rounded-md border border-border bg-background p-4">
<div className="flex items-center justify-between gap-4">
<span className="text-muted-foreground">대상</span>
<span className="font-mono text-xs font-medium">
{backendDeployment ? `${backendDeployment.namespace}/deployment/${backendDeployment.deployment}` : '배포 대상 확인 중'}
</span>
</div>
<div className="flex items-center justify-between gap-4">
<span className="text-muted-foreground">빌드</span>
<span className="font-medium">{quickDeployJob?.version || '-'}</span>
</div>
<div className="grid gap-1 pt-1">
<span className="text-muted-foreground">이미지</span>
<span className="break-all font-mono text-xs font-medium">{quickDeployJob?.downloadUrl || '-'}</span>
</div>
{backendDeployment?.currentImage ? (
<div className="grid gap-1 border-t border-border pt-3">
<span className="text-muted-foreground">현재 이미지</span>
<span className="break-all font-mono text-xs text-muted-foreground">{backendDeployment.currentImage}</span>
</div>
) : null}
</div>
</div>
</Modal>
<Modal <Modal
open={confirmOpen} open={confirmOpen}
title="빌드 실행 확인" title="빌드 실행 확인"