Skip to content

Commit 66ed17f

Browse files
committed
Make output file name more unique to reduce risk of future collisions with syft image contents
1 parent c9095df commit 66ed17f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/Microsoft.DotNet.Docker.Tests/SyftHelper.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ namespace Microsoft.DotNet.Docker.Tests;
1616

1717
public sealed class SyftHelper(DockerHelper dockerHelper, ITestOutputHelper outputHelper)
1818
{
19+
private const string OutputFileName = "syft-output.json";
20+
1921
private static readonly Lazy<string> s_syftImageTag = new(() =>
2022
$"{Config.GetVariableValue("syft|repo")}:{Config.GetVariableValue("syft|tag")}"
2123
);
@@ -58,7 +60,7 @@ public JsonNode Scan(
5860
// Run docker build with --output to write syft.json to the output directory
5961
_dockerHelper.Build(dockerfile: dockerfilePath, contextDir: tempDirPath, output: tempDirPath);
6062

61-
string syftOutputPath = Path.Combine(tempDirPath, "syft.json");
63+
string syftOutputPath = Path.Combine(tempDirPath, OutputFileName);
6264
if (!File.Exists(syftOutputPath))
6365
{
6466
throw new FileNotFoundException($"Expected syft output file was not produced: {syftOutputPath}");
@@ -98,11 +100,10 @@ private static string CreateDockerfileContents(
98100
IEnumerable<string> excludePaths
99101
)
100102
{
101-
const string OutputFileName = "syft.json";
102103

103104
IEnumerable<string> syftCommand =
104105
[
105-
"/syft/syft",
106+
"/syft",
106107
"scan",
107108
"/rootfs/",
108109
"--source-name",

0 commit comments

Comments
 (0)