Skip to content

Commit 803c347

Browse files
committed
workflow test
1 parent 05e409d commit 803c347

File tree

1 file changed

+3
-23
lines changed

1 file changed

+3
-23
lines changed

src/scripts/build-threat-model.ts

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,6 @@ function toShellSingleQuoted(value: string): string {
9494
return `'${value.replace(/'/g, `'"'"'`)}'`;
9595
}
9696

97-
function hasLocalPlantUml(): boolean {
98-
try {
99-
execSync('plantuml -version', { stdio: 'ignore' });
100-
return true;
101-
} catch {
102-
return false;
103-
}
104-
}
105-
10697
function copyDirectoryContents(sourceDir: string, destinationDir: string): void {
10798
if (!fs.existsSync(sourceDir) || !fs.statSync(sourceDir).isDirectory()) {
10899
console.warn(`Asset folder not found or not a directory, skipping: ${sourceDir}`);
@@ -218,7 +209,6 @@ export function buildSingleTM(yamlFile: string, outputDir: string, options: Buil
218209
}
219210
}
220211

221-
// Run PlantUML via Docker
222212
const imgDir = path.join(absOutputDir, 'img');
223213
console.log('Generating PlantUML diagrams...');
224214

@@ -227,28 +217,18 @@ export function buildSingleTM(yamlFile: string, outputDir: string, options: Buil
227217

228218
const pumlFiles = collectPumlFiles(imgDir);
229219
if (pumlFiles.length > 0) {
230-
const localQuoted = pumlFiles.map(toShellSingleQuoted).join(' ');
231220
const dockerRelativeQuoted = pumlFiles
232221
.map(filePath => path.relative(imgDir, filePath).replace(/\\/g, '/'))
233222
.map(toShellSingleQuoted)
234223
.join(' ');
235224

236-
if (hasLocalPlantUml()) {
237-
try {
238-
execSync(`plantuml -tsvg ${localQuoted}`, { stdio: 'inherit' });
239-
return;
240-
} catch {
241-
console.log('Local plantuml failed, trying docker...');
242-
}
243-
} else {
244-
console.log('Local plantuml not found, using docker...');
245-
}
246-
247225
const uid = typeof process.getuid === 'function' ? process.getuid() : 1000;
248226
const gid = typeof process.getgid === 'function' ? process.getgid() : 1000;
249227

228+
console.log(`Using Docker PlantUML to render ${pumlFiles.length} diagram(s) to SVG...`);
229+
250230
execSync(
251-
`docker run --rm --user ${uid}:${gid} -v "${imgDir}:/data" -w /data plantuml/plantuml:sha-d2b2bcf -tsvg ${dockerRelativeQuoted}`,
231+
`docker run --rm --user ${uid}:${gid} -v "${imgDir}:/data" -w /data plantuml/plantuml:sha-d2b2bcf -verbose -tsvg ${dockerRelativeQuoted}`,
252232
{ stdio: 'inherit' }
253233
);
254234
}

0 commit comments

Comments
 (0)