Skip to content

Commit

Permalink
publish without zip
Browse files Browse the repository at this point in the history
  • Loading branch information
ragavareddychalapala committed Jul 23, 2024
1 parent 792fd85 commit 55e9053
Showing 1 changed file with 45 additions and 45 deletions.
90 changes: 45 additions & 45 deletions src/LCT.PackageIdentifier/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ static async Task Main(string[] args)
}
Logger.Logger.Log(null, Level.Notice, $"End of Package Identifier execution : {DateTime.Now}\n", null);
string logFilePath = Path.GetFullPath(Path.Combine(FolderPath, FileConstant.BomCreatorLog));
//PublishLogfiles(logFilePath);
PublishSampleZipFolder();
PublishLogfiles(logFilePath);
//PublishSampleZipFolder();
}

public static void PublishSampleZipFolder()
Expand Down Expand Up @@ -142,49 +142,49 @@ public static void PublishSampleZipFolder()
Console.WriteLine($"##vso[artifact.upload containerfolder={containerFolder};artifactname={artifactName}]{Path.GetFullPath(sampleZipFilePath)}");
}

//public static void PublishLogfiles(string logFolderPath)
//{
// try
// {
// // Ensure the log file exists
// if (!File.Exists(logFolderPath))
// {
// throw new FileNotFoundException($"Log file not found: {logFolderPath}");
// }

// // Create a temporary folder for the zip file
// string tempFolderPath = Path.Combine(Path.GetTempPath(), "LogTemp");
// Directory.CreateDirectory(tempFolderPath);

// // Prepare zip file path
// string zipFilePath = Path.Combine(tempFolderPath, "Log.zip");

// // Delete existing zip file if it exists
// if (File.Exists(zipFilePath))
// {
// File.Delete(zipFilePath);
// }

// // Create a new zip archive
// using (ZipArchive archive = ZipFile.Open(zipFilePath, ZipArchiveMode.Create))
// {
// // Add the log file to the zip archive
// archive.CreateEntryFromFile(logFolderPath, Path.GetFileName(logFolderPath));
// }

// // Define Azure DevOps/VSTS artifact upload parameters
// string containerFolder = "Container"; // Replace with your desired container folder
// string artifactName = "MyArtifact"; // Replace with your artifact name

// // Output the artifact upload command
// Console.WriteLine($"##vso[artifact.upload containerfolder={containerFolder};artifactname={artifactName}]{Path.GetFullPath(zipFilePath)}");

// }
// catch (Exception ex)
// {
// Console.WriteLine(ex.ToString());
// }
//}
public static void PublishLogfiles(string logFolderPath)
{
try
{
//// Ensure the log file exists
//if (!File.Exists(logFolderPath))
//{
// throw new FileNotFoundException($"Log file not found: {logFolderPath}");
//}

//// Create a temporary folder for the zip file
//string tempFolderPath = Path.Combine(Path.GetTempPath(), "LogTemp");
//Directory.CreateDirectory(tempFolderPath);

//// Prepare zip file path
//string zipFilePath = Path.Combine(tempFolderPath, "Log.zip");

//// Delete existing zip file if it exists
//if (File.Exists(zipFilePath))
//{
// File.Delete(zipFilePath);
//}

//// Create a new zip archive
//using (ZipArchive archive = ZipFile.Open(zipFilePath, ZipArchiveMode.Create))
//{
// // Add the log file to the zip archive
// archive.CreateEntryFromFile(logFolderPath, Path.GetFileName(logFolderPath));
//}

// Define Azure DevOps/VSTS artifact upload parameters
string containerFolder = "Container"; // Replace with your desired container folder
string artifactName = "MyArtifact"; // Replace with your artifact name

// Output the artifact upload command
Console.WriteLine($"##vso[artifact.upload containerfolder={containerFolder};artifactname={artifactName}]{Path.GetFullPath(logFolderPath)}");

}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
public static string GetZipFolderPath()
{
string localPathforSourceRepo = string.Empty;
Expand Down

0 comments on commit 55e9053

Please sign in to comment.