git pull작업 완료

This commit is contained in:
김판돌 2023-11-19 17:30:48 +09:00
parent eb1da46328
commit bf6f27051e
29 changed files with 52 additions and 322 deletions

View File

@ -1,4 +1,8 @@
namespace Server.Git using LibGit2Sharp;
using Server.System;
using System.Diagnostics;
namespace Server.Git
{ {
public abstract class AbstractGit public abstract class AbstractGit
{ {
@ -8,30 +12,17 @@
/// </summary> /// </summary>
public void Init() public void Init()
{ {
isRestart = false;
restart: restart:
isRestart = false;
Pull(); Pull();
if (isRestart) if (isRestart)
{
isRestart = !isRestart;
goto restart; goto restart;
}
ChangeScript(); ChangeScript();
if (isRestart) if (isRestart)
{
isRestart = !isRestart;
goto restart; goto restart;
}
Push(); Push();
if (isRestart) if (isRestart)
{
isRestart = !isRestart;
goto restart; goto restart;
}
} }
/// <summary> /// <summary>
@ -41,7 +32,45 @@
private void Pull() private void Pull()
{ {
string repositoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "excel");
if (!Directory.Exists(repositoryPath))
{
Directory.CreateDirectory(repositoryPath);
RepositorySet($"clone {STATICS.remoteUrl} {repositoryPath}", null);
//main브렌치로 세팅
RepositorySet("branch -m main", repositoryPath);
RepositorySet("branch --set-upstream-to=origin/main main", repositoryPath);
}
// pull 명령어 실행
RepositorySet("pull", repositoryPath);
}
private static void RepositorySet(string command, string workingDirectory)
{
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = "git",
Arguments = command,
WorkingDirectory = workingDirectory,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
CreateNoWindow = true
};
using (Process process = new Process { StartInfo = psi })
{
process.Start();
process.WaitForExit();
// Git 명령 실행 결과 출력
Console.WriteLine(process.StandardOutput.ReadToEnd());
// 오류 메시지 출력
Console.WriteLine(process.StandardError.ReadToEnd());
}
} }
private void Push() private void Push()

View File

@ -4,15 +4,7 @@
{ {
public override void ChangeScript() public override void ChangeScript()
{ {
for(int n = 0; n < 100; n++) Console.WriteLine("영차영차 작업됨");
{
if (isRestart)
{
return;
}
Console.WriteLine("뭔가를 작업하세요" + n);
Thread.Sleep(1000);
}
} }
} }
} }

View File

@ -1,7 +1,5 @@
using NLog; using NLog;
using Server.Git; using Server.Git;
using System.Threading;
using System.Threading.Tasks;
namespace Server.System namespace Server.System
{ {
@ -29,9 +27,7 @@ namespace Server.System
Console.WriteLine($"X-Gitea-Event-Type : {eaEventType}"); Console.WriteLine($"X-Gitea-Event-Type : {eaEventType}");
Console.WriteLine($"X-Gitea-Signature : {eaSignature}"); Console.WriteLine($"X-Gitea-Signature : {eaSignature}");
Console.WriteLine(thread.ThreadState); //task를 쓰면 멈출수가 없기에 thread를 사용
//Unstarted
if (thread.ThreadState == ThreadState.Unstarted) if (thread.ThreadState == ThreadState.Unstarted)
{ {
thread.Start(); thread.Start();

View File

@ -4,10 +4,15 @@
{ {
#region Dev #region Dev
#if DEBUG #if DEBUG
public static readonly string SQL_URL = "Server=myServerAddress;Port=myPort;Database=myDatabase;Uid=myUsername;Pwd=myPassword;"; public static readonly string SQL_URL = "Server=myServerAddress;Port=myPort;Database=myDatabase;Uid=myUsername;Pwd=myPassword;";
#endif #endif
#endregion #endregion
//비공계 프로젝트의 경우 아래와같이 작성해주세요
//"https://username:password@gitea.pandoli365.com/pandoli365/gittest.git";
public static readonly string remoteUrl = "https://gitea.pandoli365.com/pandoli365/gittest.git";
public static readonly string PATTERN = "[^a-zA-Z0-9가-힣 ]"; public static readonly string PATTERN = "[^a-zA-Z0-9가-힣 ]";
} }

View File

@ -1,18 +0,0 @@
2023-11-18 21:28:18.7273|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-18 21:47:53.5657|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-18 21:49:59.4784|INFO|Server.System.ProtocolProcessor|GetRequst : {
"test":"test"
}
2023-11-18 21:49:59.5825|INFO|Server.System.ProtocolProcessor|GetResponse : {"status":200}
2023-11-18 23:09:10.0313|INFO|Server.System.ProtocolProcessor|GetRequst : {
"aaa":"aa"
}
2023-11-18 23:09:10.0313|INFO|Server.System.ProtocolProcessor|GetResponse : {"status":200}
2023-11-18 23:30:18.5940|ERROR|Server.System.ProtocolProcessor|GetErrorResponse : System.ArgumentNullException: Value cannot be null. (Parameter 's')
at System.Int32.Parse(String s)
at Server.System.ProtocolProcessor.Process(HttpContext context) in E:\git\CsServer\Server\System\SystemMain.cs:line 40
2023-11-18 23:30:27.6377|ERROR|Server.System.ProtocolProcessor|GetErrorResponse : System.ArgumentNullException: Value cannot be null. (Parameter 's')
at System.Int32.Parse(String s)
at Server.System.ProtocolProcessor.Process(HttpContext context) in E:\git\CsServer\Server\System\SystemMain.cs:line 40
2023-11-18 23:43:39.7529|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-18 23:46:45.0069|INFO|Server.System.ProtocolProcessor|Server Start

View File

@ -1,76 +0,0 @@
2023-11-19 14:56:20.0361|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 14:56:37.1023|ERROR|Server.System.GItWebhook|GetErrorResponse : System.Threading.ThreadStateException: Thread is running or terminated; it cannot restart.
at System.Threading.Thread.StartInternal(ThreadHandle t, Int32 stackSize, Int32 priority, Char* pThreadName)
at System.Threading.Thread.StartCore()
at System.Threading.Thread.Start(Boolean captureContext)
at System.Threading.Thread.Start()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 32
2023-11-19 14:56:40.9259|ERROR|Server.System.GItWebhook|GetErrorResponse : System.Threading.ThreadStateException: Thread is running or terminated; it cannot restart.
at System.Threading.Thread.StartInternal(ThreadHandle t, Int32 stackSize, Int32 priority, Char* pThreadName)
at System.Threading.Thread.StartCore()
at System.Threading.Thread.Start(Boolean captureContext)
at System.Threading.Thread.Start()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 32
2023-11-19 14:56:42.2523|ERROR|Server.System.GItWebhook|GetErrorResponse : System.Threading.ThreadStateException: Thread is running or terminated; it cannot restart.
at System.Threading.Thread.StartInternal(ThreadHandle t, Int32 stackSize, Int32 priority, Char* pThreadName)
at System.Threading.Thread.StartCore()
at System.Threading.Thread.Start(Boolean captureContext)
at System.Threading.Thread.Start()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 32
2023-11-19 14:56:45.5190|ERROR|Server.System.GItWebhook|GetErrorResponse : System.Threading.ThreadStateException: Thread is running or terminated; it cannot restart.
at System.Threading.Thread.StartInternal(ThreadHandle t, Int32 stackSize, Int32 priority, Char* pThreadName)
at System.Threading.Thread.StartCore()
at System.Threading.Thread.Start(Boolean captureContext)
at System.Threading.Thread.Start()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 32
2023-11-19 14:59:45.3242|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 14:59:54.7574|ERROR|Server.System.GItWebhook|GetErrorResponse : System.PlatformNotSupportedException: Thread abort is not supported on this platform.
at System.Threading.Thread.Abort()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 35
2023-11-19 15:00:11.3099|ERROR|Server.System.GItWebhook|GetErrorResponse : System.PlatformNotSupportedException: Thread abort is not supported on this platform.
at System.Threading.Thread.Abort()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 35
2023-11-19 15:00:42.1291|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 15:00:47.7832|ERROR|Server.System.GItWebhook|GetErrorResponse : System.PlatformNotSupportedException: Thread abort is not supported on this platform.
at System.Threading.Thread.Abort()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 36
2023-11-19 15:18:57.1278|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 15:22:14.6405|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 15:22:38.6975|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 15:23:07.2232|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 15:24:13.9673|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 15:25:46.4718|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 15:27:21.7466|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 15:27:26.4967|ERROR|Server.System.GItWebhook|GetErrorResponse : System.PlatformNotSupportedException: Thread abort is not supported on this platform.
at System.Threading.Thread.Abort()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 34
2023-11-19 15:27:28.6315|ERROR|Server.System.GItWebhook|GetErrorResponse : System.PlatformNotSupportedException: Thread abort is not supported on this platform.
at System.Threading.Thread.Abort()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 34
2023-11-19 15:28:46.7554|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 15:28:53.2138|ERROR|Server.System.GItWebhook|GetErrorResponse : System.PlatformNotSupportedException: Thread abort is not supported on this platform.
at System.Threading.Thread.Abort()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 34
2023-11-19 15:53:52.3423|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 15:53:57.1433|ERROR|Server.System.GItWebhook|GetErrorResponse : System.PlatformNotSupportedException: Thread abort is not supported on this platform.
at System.Threading.Thread.Abort()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 35
2023-11-19 15:53:59.5704|ERROR|Server.System.GItWebhook|GetErrorResponse : System.PlatformNotSupportedException: Thread abort is not supported on this platform.
at System.Threading.Thread.Abort()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 35
2023-11-19 15:54:02.7564|ERROR|Server.System.GItWebhook|GetErrorResponse : System.PlatformNotSupportedException: Thread abort is not supported on this platform.
at System.Threading.Thread.Abort()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 35
2023-11-19 15:54:03.8472|ERROR|Server.System.GItWebhook|GetErrorResponse : System.PlatformNotSupportedException: Thread abort is not supported on this platform.
at System.Threading.Thread.Abort()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 35
2023-11-19 15:54:04.6437|ERROR|Server.System.GItWebhook|GetErrorResponse : System.PlatformNotSupportedException: Thread abort is not supported on this platform.
at System.Threading.Thread.Abort()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 35
2023-11-19 15:54:05.7834|ERROR|Server.System.GItWebhook|GetErrorResponse : System.PlatformNotSupportedException: Thread abort is not supported on this platform.
at System.Threading.Thread.Abort()
at Server.System.GItWebhook.Process(HttpContext context) in E:\git\CsServer\Server\System\GItWebhook.cs:line 35
2023-11-19 16:00:22.8126|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 16:05:38.2708|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 16:08:18.6752|INFO|Server.System.ProtocolProcessor|Server Start
2023-11-19 16:12:50.9169|INFO|Server.System.ProtocolProcessor|Server Start

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target
name="logfile"
xsi:type="File"
fileName="Log/${date:format=yyyy-MM-dd}.txt"
archiveAboveSize="10485760"
archiveNumbering="Sequence"
archiveEvery="Day"
maxArchiveFiles="1000"
/>
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="logfile" />
</rules>
</nlog>

Binary file not shown.

View File

@ -1,142 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"Server/1.0.0": {
"dependencies": {
"LibGit2Sharp": "0.28.0",
"NLog": "5.2.5",
"Newtonsoft.Json": "13.0.3"
},
"runtime": {
"Server.dll": {}
}
},
"LibGit2Sharp/0.28.0": {
"dependencies": {
"LibGit2Sharp.NativeBinaries": "2.0.320"
},
"runtime": {
"lib/net6.0/LibGit2Sharp.dll": {
"assemblyVersion": "0.28.0.0",
"fileVersion": "0.28.0.0"
}
}
},
"LibGit2Sharp.NativeBinaries/2.0.320": {
"runtimeTargets": {
"runtimes/linux-arm/native/libgit2-e632535.so": {
"rid": "linux-arm",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-arm64/native/libgit2-e632535.so": {
"rid": "linux-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-musl-arm/native/libgit2-e632535.so": {
"rid": "linux-musl-arm",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-musl-arm64/native/libgit2-e632535.so": {
"rid": "linux-musl-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-musl-x64/native/libgit2-e632535.so": {
"rid": "linux-musl-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-x64/native/libgit2-e632535.so": {
"rid": "linux-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/osx-arm64/native/libgit2-e632535.dylib": {
"rid": "osx-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/osx-x64/native/libgit2-e632535.dylib": {
"rid": "osx-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-arm64/native/git2-e632535.dll": {
"rid": "win-arm64",
"assetType": "native",
"fileVersion": "1.6.4.0"
},
"runtimes/win-x64/native/git2-e632535.dll": {
"rid": "win-x64",
"assetType": "native",
"fileVersion": "1.6.4.0"
},
"runtimes/win-x86/native/git2-e632535.dll": {
"rid": "win-x86",
"assetType": "native",
"fileVersion": "1.6.4.0"
}
}
},
"Newtonsoft.Json/13.0.3": {
"runtime": {
"lib/net6.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.3.27908"
}
}
},
"NLog/5.2.5": {
"runtime": {
"lib/netstandard2.0/NLog.dll": {
"assemblyVersion": "5.0.0.0",
"fileVersion": "5.2.5.2160"
}
}
}
}
},
"libraries": {
"Server/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"LibGit2Sharp/0.28.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-+VGXLAQovtTc41EkUXBKSuu40XcyuWUmQrslpd0CPMGkpnLTgQwoRLSSCRxLSPjYSi9SskyRUOLa9tjg/L108A==",
"path": "libgit2sharp/0.28.0",
"hashPath": "libgit2sharp.0.28.0.nupkg.sha512"
},
"LibGit2Sharp.NativeBinaries/2.0.320": {
"type": "package",
"serviceable": true,
"sha512": "sha512-7vIqOhB+5LOi9arXi8IdlkWURpQEiMtnwVP//djA7cQvIVfpC4bZSnQIDe4kwwvsU/w1oH0YkBTgMmpkVndNbg==",
"path": "libgit2sharp.nativebinaries/2.0.320",
"hashPath": "libgit2sharp.nativebinaries.2.0.320.nupkg.sha512"
},
"Newtonsoft.Json/13.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==",
"path": "newtonsoft.json/13.0.3",
"hashPath": "newtonsoft.json.13.0.3.nupkg.sha512"
},
"NLog/5.2.5": {
"type": "package",
"serviceable": true,
"sha512": "sha512-mMXtbAxfNzqkXcBjhJ3wN3rH7kwUZ0JL0GrUBI/lso7+tQ/HC4e5SnlmR3R5qQ9zWbqMbjxeH37rIf0yQGWTiA==",
"path": "nlog/5.2.5",
"hashPath": "nlog.5.2.5.nupkg.sha512"
}
}
}

Binary file not shown.

Binary file not shown.

View File

@ -1,19 +0,0 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "6.0.0"
}
],
"configProperties": {
"System.GC.Server": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

View File

@ -1,8 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -1,9 +0,0 @@
{
"Logging": {
"LogLevel": {
"Default": "Trace",
"Microsoft.AspNetCore": "Trace"
}
},
"AllowedHosts": "0.0.0.0;localhost"
}

Binary file not shown.

Binary file not shown.