Skip to content

Commit

Permalink
fix: fix build for new tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Pascal Klesse committed Dec 22, 2024
1 parent 894a287 commit 80fd6fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 7 additions & 1 deletion projects/api/src/server/modules/build/build.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import axios from 'axios';
import {AdditionalBuildInfos} from "../../common/interfaces/additional-build-infos.interface";
import {DeploymentType} from "../container/enums/deployment-type.enum";
import * as console from "node:console";
import {promises as fs} from "fs";
import envConfig from "../../../config.env";

/**
* Build service
Expand Down Expand Up @@ -254,7 +256,11 @@ export class BuildService extends CrudService<Build> {

// update containers version if deployment type tag
if (additionalInfos?.deploymentType === DeploymentType.TAG) {
await this.containerService.updateForce(container.id, {tag: additionalInfos.targetVersion});
try {
await fs.rm(`${envConfig.projectsDir}/${container.id}/${additionalInfos?.currentVersion}`, { recursive: true, force: true });
} catch (e) {
console.debug(`Error while removing old version: ${e}`);
}
}

const projectIsRunning = await this.checkProjectIsBuilding(build);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ export class BuildProcessor {

// update containers version if deployment type tag
if (job?.data?.additionalInfos?.deploymentType === DeploymentType.TAG) {
await fs.rm(`${this.dockerService.getPath(container)}`, { recursive: true, force: true });
container = await this.containerService.updateForce(job?.data?.containerId, {tag: job?.data?.additionalInfos.targetVersion});
await this.fileService.recreateFolder(`${this.dockerService.getPath(container)}/code`);

Expand Down

0 comments on commit 80fd6fa

Please sign in to comment.