Skip to content

Instantly share code, notes, and snippets.

@jeffyin1
Created August 4, 2020 08:02
Show Gist options
  • Save jeffyin1/15c92f45a3c6b317be585f238367d069 to your computer and use it in GitHub Desktop.
Save jeffyin1/15c92f45a3c6b317be585f238367d069 to your computer and use it in GitHub Desktop.
Jenkinsfile can execute specific unity in docker on node
def clientPath = ""
pipeline {
agent {
node {
label "${params.NODE_NAME}"
}
}
environment{
CLIENT_BRANCH = "${params.CLIENT_BRANCH}"
PLATFORM = "${params.PLATFORM}"
GIT_SSH_KEY = credentials('auth')
GIT_SSH_COMMAND = "ssh -i \"${env.GIT_SSH_KEY}\""
}
stages {
stage('Init') {
steps {
script {
clientPath = "client-${env.PLATFORM}"
}
}
}
stage('Checkout-Project') {
steps {
script {
// Implement Checkout repo by yourself
dir(clientPath) {
// ubuntu need to ignorecase
sh "git config --local core.ignorecase true"
}
}
}
}
stage('Build Assetbundle') {
agent {
docker {
reuseNode true
image "${params.DOCKER_FULLNAME}"
args '-u root --privileged'
}
}
steps {
dir(clientPath) {
sh "/opt/Unity/Editor/Unity -accept-apiupdate -nographics -quit -batchmode -silent-crashes -logFile -executeMethod MyProject.BuildAssetbundle -projectPath ./ -buildTarget ${env.PLATFORM}"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment