Compare commits

...

6 Commits
1.0.7 ... main

Author SHA1 Message Date
zpc
e0091af6ae 修改问题 2024-07-10 20:19:16 +08:00
zpc
70df39c4c8 提交代码 2024-07-10 20:07:43 +08:00
zpc
d44f364924 添加日志 2024-07-09 20:12:17 +08:00
zpc
4095c3c4a8 提交代码 2024-07-09 16:36:53 +08:00
zpc
1f94f028c6 执行代码 2024-07-09 16:34:40 +08:00
zpc
d34ba4e43a 提交代码 2024-07-09 16:31:34 +08:00
3 changed files with 19 additions and 8 deletions

View File

@ -28,6 +28,7 @@ namespace CodeRelease.BLL
int exitCode = 0;
try
{
Log.Logger.Information($"开始执行linux {command}");
// 创建一个新的进程
using (Process process = new Process())
{
@ -41,21 +42,24 @@ namespace CodeRelease.BLL
// 绑定输出和错误数据接收事件
process.OutputDataReceived += new DataReceivedEventHandler((sender, e) =>
{
Log.Logger.Information("linux执行出错OutputDataReceived命令{command},sender:{sender}Output:{e}", command, JsonConvert.SerializeObject(sender), JsonConvert.SerializeObject(e));
//Log.Logger.Information($"linux执行出错OutputDataReceived命令{command}");
//Log.Logger.Information($"linux执行出错OutputDataReceivedOutput{JsonConvert.SerializeObject(e)}");
if (!string.IsNullOrEmpty(e.Data))
{
Console.WriteLine($"Output: {e.Data}");
outputDataReceived = e.Data;
//Console.WriteLine($"Output: {e.Data}");
outputDataReceived += e.Data + "\n";
}
});
process.ErrorDataReceived += new DataReceivedEventHandler((sender, e) =>
{
Log.Logger.Information("linux执行出错ErrorDataReceived命令{command},sender:{sender}Output:{e}", command, JsonConvert.SerializeObject(sender), JsonConvert.SerializeObject(e));
// Log.Logger.Information($"linux执行出错ErrorDataReceived命令{command}");
//Log.Logger.Information($"linux执行出错ErrorDataReceivedOutput:{JsonConvert.SerializeObject(e)}");
if (!string.IsNullOrEmpty(e.Data))
{
Console.WriteLine($"Error: {e.Data}");
errorDataReceived = e.Data;
//Console.WriteLine($"Error: {e.Data}");
errorDataReceived += e.Data + "\n";
}
});
@ -71,7 +75,9 @@ namespace CodeRelease.BLL
// 输出退出代码
//Console.WriteLine($"Process exited with code {process.ExitCode}");
Log.Logger.Information($"执行结束 {process.ExitCode}");
Log.Logger.Information($"执行结束:{process.ExitCode}");
Log.Logger.Information($"{outputDataReceived}");
Log.Logger.Information($"{errorDataReceived}");
exitCode = process.ExitCode;
}
}

View File

@ -90,6 +90,11 @@ namespace CodeRelease.Controllers
var version = releaseAction.Release.TagName;
var mingling = giteaWebhookConfig.MakeFile
.Replace("{version}", version)
.Replace("{description}", releaseAction.Release.Body)
.Replace("{name}", version)
//.Replace("{version}", version)
//.Replace("{version}", version)
//.Replace("{version}", version)
//.Replace("{dir_file_path}", download + "/")
.Replace("{target_commitish}", releaseAction.Release.TargetCommitish);
Log.Logger.Information("执行linux命令{mingling}", mingling);

View File

@ -72,7 +72,7 @@ app.MapGet("/system", () =>
long memoryUsage = currentProcess.WorkingSet64;
return new
{
msg = $"系统版本:{InformationalVersion},启动时间:{startDateTime.ToString("yyyy-MM-dd HH:mm:ss")},已安全运行时间:{DateTime.Now.Subtract(startDateTime).TotalMinutes.ToString("#.##")}分钟",
msg = $"系统版本:{InformationalVersion},启动时间:{startDateTime.ToString("yyyy-MM-dd HH:mm:ss")},已安全运行时间:{DateTime.Now.Subtract(startDateTime).TotalMinutes.ToString("0.##")}分钟",
InformationalVersion,
startDateTime,
MemoryUsage = $"{memoryUsage / (1024.0 * 1024.0):F2}MB",