สำหรับคนที่ยังใช้ Jenkin Pipeline และกับการ Build .NET(Windows Base App) ทำให้ต้องมาวาง CI Server บน Windows พอบิ้วสำเร็จแล้ว เราอยากให้ตัว Pipeline จัดการ Tag Build ให้เลย ผมมี Code Snippet โดยลองดูตัวอย่าง Code Grovvy ได้เลยครับ
node {
def SVN_PATH = "C:\\Program Files\\TortoiseSVN\\bin"
def SVN_Tag = "http://svn.ds.local/svn/invs/tags-build"
def App_Tag = "C:\\Users\\agent_vm_10\\Documents\\Build"
def SVNUSER = "yourusername"
def SVNPASS = "yourpassword"
//Do Something before
//...
//TAGtoSVN
bat("\"${SVN_PATH}\\svn.exe\" copy https://svn.ds.local/svn/invs/trunk/dotnet/MyApp/ https://svn.ds.local/svn/invs/tags-build/NET9905 -m \"Auto Tagging the 1.0 by Pipeline\" --non-interactive --trust-server-cert --username ${SVNUSER} --password ${SVNUSER} --no-auth-cache")
}จาก Code ด้านบน Code ชุดนี้ใช้ลูกเล่น 2 แบบ
- คำสั่ง bat เพื่อให้มันไป execute bat command
- svn copy เพื่อทำคำสั่ง Tag ครับ
ซึ่งผลลัพธ์ที่ได้เป็นลักษณะ ดังรูปครับ

Reference
Discover more from naiwaen@DebuggingSoft
Subscribe to get the latest posts sent to your email.



