feat: 使用单独目录部署。

This commit is contained in:
Ivan Li 2021-07-22 20:48:30 +08:00
parent c86772a5dd
commit 1b469e34f9
7 changed files with 26 additions and 5 deletions

4
package-lock.json generated
View File

@ -2896,7 +2896,7 @@
"node_modules/@nestjs-lib/auth": {
"version": "0.2.1",
"resolved": "https://npm.ivanli.cc/@nestjs-lib%2fauth/-/auth-0.2.1.tgz",
"integrity": "sha512-kGO8iPp69bG1PuTK8k1o0Ew9AZk0O+jhhsvSki9vOMzMYdRe7HMhwjXqdFTsgt2be9actoyA4nafZ/iHAXfqGw==",
"integrity": "sha512-HNOjIWh6H/PVTjp+nQ11LmKY/09zNhlLZqruukTteAPKQGvkeLUU51/OIp/vj0WWzMxp4qMWnfCrLaRYjkQ1Yw==",
"license": "MIT",
"peerDependencies": {
"@nestjs/common": "^7.0.0",
@ -18838,7 +18838,7 @@
"@nestjs-lib/auth": {
"version": "0.2.1",
"resolved": "https://npm.ivanli.cc/@nestjs-lib%2fauth/-/auth-0.2.1.tgz",
"integrity": "sha512-kGO8iPp69bG1PuTK8k1o0Ew9AZk0O+jhhsvSki9vOMzMYdRe7HMhwjXqdFTsgt2be9actoyA4nafZ/iHAXfqGw==",
"integrity": "sha512-HNOjIWh6H/PVTjp+nQ11LmKY/09zNhlLZqruukTteAPKQGvkeLUU51/OIp/vj0WWzMxp4qMWnfCrLaRYjkQ1Yw==",
"requires": {}
},
"@nestjs/cli": {

View File

@ -145,7 +145,7 @@ describe('PipelineTaskRunner', () => {
await runner.doTask(task);
expect(checkout).toBeCalledTimes(1);
expect(doTaskUnit).toBeCalledTimes(2);
expect(doTaskUnit).toBeCalledTimes(1);
expect(emitEvent).toBeCalledTimes(2);
});

View File

@ -27,7 +27,7 @@ import {
getSelfInstanceQueueKey,
getSelfInstanceRouteKey,
} from '../commons/utils/rabbit-mq';
import { unlink } from 'fs/promises';
import { rm, unlink } from 'fs/promises';
import { rename } from 'fs/promises';
type Spawn = typeof spawn;
@ -127,7 +127,7 @@ export class PipelineTaskRunner {
const oldRoot = workspaceRoot;
workspaceRoot = this.reposService.getDeployRoot(task);
if (oldRoot !== workspaceRoot) {
await unlink(workspaceRoot).catch(() => void 0);
await rm(workspaceRoot, { force: true, recursive: true });
await rename(oldRoot, workspaceRoot);
}
@ -231,6 +231,7 @@ export class PipelineTaskRunner {
'checkout failed.',
'stderr',
);
throw err;
}
}

View File

@ -1,3 +1,4 @@
import { JwtService } from '@nestjs-lib/auth';
import { Test, TestingModule } from '@nestjs/testing';
import { PipelineTaskLogger } from './pipeline-task.logger';
import { PipelineTasksResolver } from './pipeline-tasks.resolver';
@ -18,6 +19,10 @@ describe('PipelineTasksResolver', () => {
provide: PipelineTaskLogger,
useValue: {},
},
{
provide: JwtService,
useValue: {},
},
],
}).compile();

View File

@ -1,3 +1,4 @@
import { JwtService } from '@nestjs-lib/auth';
import { Test, TestingModule } from '@nestjs/testing';
import { PipelineTasksService } from '../pipeline-tasks/pipeline-tasks.service';
import { CommitLogsResolver } from './commit-logs.resolver';
@ -18,6 +19,10 @@ describe('CommitLogsResolver', () => {
provide: PipelineTasksService,
useValue: {},
},
{
provide: JwtService,
useValue: {},
},
],
}).compile();

View File

@ -1,3 +1,4 @@
import { JwtService } from '@nestjs-lib/auth';
import { Test, TestingModule } from '@nestjs/testing';
import { PipelinesResolver } from './pipelines.resolver';
import { PipelinesService } from './pipelines.service';
@ -13,6 +14,10 @@ describe('PipelinesResolver', () => {
provide: PipelinesService,
useValue: {},
},
{
provide: JwtService,
useValue: {},
},
],
}).compile();

View File

@ -1,3 +1,4 @@
import { JwtService } from '@nestjs-lib/auth';
import { Test, TestingModule } from '@nestjs/testing';
import { ProjectsResolver } from './projects.resolver';
import { ProjectsService } from './projects.service';
@ -13,6 +14,10 @@ describe('ProjectsResolver', () => {
provide: ProjectsService,
useValue: {},
},
{
provide: JwtService,
useValue: {},
},
],
}).compile();