update jenkins pipeline

This commit is contained in:
wsycarlos 2026-03-07 15:07:06 +08:00
parent c4eb554bae
commit 693c457d7b
11 changed files with 49 additions and 79 deletions

View File

@ -7,7 +7,6 @@
@Library("my-shared-lib") _
Pipeline_dev(
alwaysClearPackageCache: false, // always clear the Library/PackageCache before running Unity commands
winbakeLabel: "unity_2022_3_dev", // optional node labels. Valid entries: macbakeLabel, linuxbakeLabel, winbakeLabel, syncLabel
execUnityMethod:"MyBuildTool.StartBuildAndroid_dev",
)

View File

@ -7,7 +7,6 @@
@Library("my-shared-lib") _
Pipeline_prod(
alwaysClearPackageCache: false, // always clear the Library/PackageCache before running Unity commands
winbakeLabel: "unity_2022_3_prod", // optional node labels. Valid entries: macbakeLabel, linuxbakeLabel, winbakeLabel, syncLabel
execUnityMethod:"MyBuildTool.StartBuildAndroid_prod",
)

View File

@ -7,7 +7,6 @@
@Library("my-shared-lib") _
Pipeline_stable(
alwaysClearPackageCache: false, // always clear the Library/PackageCache before running Unity commands
winbakeLabel: "unity_2022_3_stable", // optional node labels. Valid entries: macbakeLabel, linuxbakeLabel, winbakeLabel, syncLabel
execUnityMethod:"MyBuildTool.StartBuildAndroid_stable",
)

View File

@ -2,7 +2,9 @@
// Byway Studios Inc. Confidential Information.
// Copyright Byway Studios Inc. All rights reserved
//=================================================================
def call(config){
def call(config)
{
echo("clear AB begin")
//Clean any previously build asset bundles
bat """
@ -10,9 +12,5 @@ def call(config){
"""
echo("execUnityMethod begin")
//Generate AssetBundle to AB //params: is Clean packageCache,Build Method
execUnityMethod_Windows(config.alwaysClearPackageCache, "${config.execUnityMethod}")
//stash in pipeline , maybe wait to make differents
//stash allowEmpty: true, includes: '**/AB/**', name:"${config.name}_bundles_android"
execUnityMethod_Windows("${config.execUnityMethod}")
}

View File

@ -11,6 +11,14 @@ def call(Map config)
{
label config.winbakeLabel
}
parameters
{
booleanParam(name: 'CleanBuild', defaultValue: false, description: 'Force Clean Build to Avoid Previous Build Cache')
booleanParam(name: 'DebugBuild', defaultValue: false, description: 'To Create Debug Build for Profiling')
booleanParam(name: 'CleanCache', defaultValue: false, description: 'Force Clean Script and Package Cache')
booleanParam(name: 'CleanLibrary', defaultValue: false, description: 'Force Clean the Whole Library Folder')
hidden(name: 'BuildNonTuyoo', defaultValue: true, description: 'Should We Build APK without Tuyoo SDK Login')
}
options
{
skipDefaultCheckout(true) // Jenkins checkout library
@ -59,7 +67,7 @@ def call(Map config)
}
steps
{
BuildBundlesAndroid(config)
BuildAndroid(config)
}
}
stage("AchiveArtifact")

View File

@ -11,6 +11,14 @@ def call(Map config)
{
label config.winbakeLabel
}
parameters
{
hidden(name: 'CleanBuild', defaultValue: true, description: 'Force Clean Build to Avoid Previous Build Cache')
hidden(name: 'DebugBuild', defaultValue: false, description: 'To Create Debug Build for Profiling')
hidden(name: 'CleanCache', defaultValue: true, description: 'Force Clean Script and Package Cache')
hidden(name: 'CleanLibrary', defaultValue: false, description: 'Force Clean the Whole Library Folder')
hidden(name: 'BuildNonTuyoo', defaultValue: false, description: 'Should We Build APK without Tuyoo SDK Login')
}
options
{
skipDefaultCheckout(true) // Jenkins checkout library
@ -57,7 +65,7 @@ def call(Map config)
}
steps
{
BuildBundlesAndroid(config)
BuildAndroid(config)
}
}
stage("AchiveArtifact")

View File

@ -11,6 +11,14 @@ def call(Map config)
{
label config.winbakeLabel
}
parameters
{
hidden(name: 'CleanBuild', defaultValue: true, description: 'Force Clean Build to Avoid Previous Build Cache')
hidden(name: 'DebugBuild', defaultValue: false, description: 'To Create Debug Build for Profiling')
hidden(name: 'CleanCache', defaultValue: true, description: 'Force Clean Script and Package Cache')
hidden(name: 'CleanLibrary', defaultValue: false, description: 'Force Clean the Whole Library Folder')
hidden(name: 'BuildNonTuyoo', defaultValue: false, description: 'Should We Build APK without Tuyoo SDK Login')
}
options
{
skipDefaultCheckout(true) // Jenkins checkout library
@ -57,7 +65,7 @@ def call(Map config)
}
steps
{
BuildBundlesAndroid(config)
BuildAndroid(config)
}
}
stage("AchiveArtifact")

View File

@ -5,7 +5,7 @@
def call(publishSubFolder)
{
// Move artifacts to an Android subdirectory and achive
// Move artifacts to an Android subdirectory and archive
bat """
if exist tmpPublish rmdir /S /Q tmpPublish
mkdir tmpPublish

View File

@ -2,6 +2,7 @@
// Byway Studios Inc. Confidential Information.
// Copyright Byway Studios Inc. All rights reserved
//=================================================================
def call(pathToProjectVersion)
{
echo("Detected Unity Version begin")

View File

@ -2,36 +2,33 @@
// Byway Studios Inc. Confidential Information.
// Copyright Byway Studios Inc. All rights reserved
//=================================================================
@groovy.transform.Field gUnityVersion_Windows = ""
def call(clearPackageCache,methodName)
def call(methodName)
{
if(gUnityVersion_Windows.isEmpty())
{
gUnityVersion_Windows = detectUnityVersion("${WORKSPACE}/ProjectSettings/ProjectVersion.txt")
}
// if (clearPackageCache || params.CLEAN)
// {
// bat label: 'Clearing Unity Cache', script: """
// if exist "${WORKSPACE}\\unity\\Library\\PackageCache" del /F /S /Q "${WORKSPACE}\\unity\\Library\\PackageCache"
// if exist "${WORKSPACE}\\unity\\Library\\ScriptAssemblies" del /F /S /Q "${WORKSPACE}\\unity\\Library\\ScriptAssemblies"
// if "%CLEAN%" == "true" (
// echo ">>> CLEAN ENABLED -- DELETING LIBRARY"
// del /S /Q "${WORKSPACE}\\unity\\Library"
// )
// """
// }
//def gitHash = env.GIT_COMMIT.take(7)
// def gitHash = bat(
// script: 'git rev-parse --short HEAD',
// returnStdout: true
// ).trim()
if (params.CleanCache)
{
bat label: 'Clearing Unity Package and Script Cache', script: """
if exist "${WORKSPACE}\\Library\\PackageCache" del /F /S /Q "${WORKSPACE}\\Library\\PackageCache"
if exist "${WORKSPACE}\\Library\\ScriptAssemblies" del /F /S /Q "${WORKSPACE}\\Library\\ScriptAssemblies"
if (params.CleanLibrary)
(
echo ">>> CLEAN ENABLED -- DELETING LIBRARY"
del /S /Q "${WORKSPACE}\\Library"
)
"""
}
//open unity and execute unity method
bat label: "Executing Unity method: ${methodName}", script: """
set UNITY_PATH=C:\\Program Files\\Unity\\Hub\\Editor\\${gUnityVersion_Windows}\\Editor\\Unity.exe
for /f %%i in ('git rev-parse --short HEAD') do set GIT_HASH=%%i
"%UNITY_PATH%" -quit -batchmode -nographics -projectPath "${WORKSPACE}" -executeMethod "${methodName}" -buildTarget Android -gitHash %GIT_HASH% -buildNumber %BUILD_NUMBER% -stackTraceLogType None -logFile -
"%UNITY_PATH%" -quit -batchmode -nographics -projectPath "${WORKSPACE}" -executeMethod "${methodName}" -buildTarget Android -gitHash %GIT_HASH% -buildNumber %BUILD_NUMBER% -cleanBuild params.CleanBuild -debugBuild params.DebugBuild -nonTuyoo params.BuildNonTuyoo -stackTraceLogType None -logFile -
"""
}

View File

@ -1,47 +0,0 @@
//=================================================================
// Byway Studios Inc. Confidential Information.
// Copyright Byway Studios Inc. All rights reserved
//=================================================================
def call(Map config)
{
pipeline
{
agent none
stages
{
stage("Build Android")
{
agent
{
label config.winbakeLabel
}
options
{
timeout{time: 2, unit: 'HOURS'}
}
steps
{
buildBundlesAndroid config
}
}
}
post
{
always
{
dingtalk(
robot:'dingtalk_unity_1',
type:'MARKDOWN',
title:'Build Notice',
text: [
"### ${currentBuild.currentResult}",
"- Project: ${env.JOB_NAME}",
"- BuildNumber: #${env.BUILD_NUMBER}",
"- Duration: ${currentBuild.durationString}",
"- LogUrl: ${env.BUILD_URL}"
]
}
}
}
}