Merge pull request #10 from aws-lumberyard-dev/SPEC-6230

Pipeline fails when using a new empty ebs volume
main
Shirang Jia 5 years ago committed by GitHub
commit a25f5b1317
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -214,19 +214,17 @@ def CheckoutBootstrapScripts(String branchName) {
} }
def CheckoutRepo(boolean disableSubmodules = false) { def CheckoutRepo(boolean disableSubmodules = false) {
dir(ENGINE_REPOSITORY_NAME) { palSh('git lfs uninstall', 'Git LFS Uninstall') // Prevent git from pulling lfs objects during checkout
palSh('git lfs uninstall', 'Git LFS Uninstall') // Prevent git from pulling lfs objects during checkout
if(fileExists('.git')) {
if(fileExists('.git')) { // If the repository after checkout is locked, likely we took a snapshot while git was running,
// If the repository after checkout is locked, likely we took a snapshot while git was running, // to leave the repo in a usable state, garbagecollect. This also helps in situations where
// to leave the repo in a usable state, garbagecollect. This also helps in situations where def indexLockFile = '.git/index.lock'
def indexLockFile = '.git/index.lock' if(fileExists(indexLockFile)) {
if(fileExists(indexLockFile)) { palSh('git gc', 'Git GarbageCollect')
palSh('git gc', 'Git GarbageCollect') }
} if(fileExists(indexLockFile)) { // if it is still there, remove it
if(fileExists(indexLockFile)) { // if it is still there, remove it palRm(indexLockFile)
palRm(indexLockFile)
}
} }
} }
@ -237,38 +235,29 @@ def CheckoutRepo(boolean disableSubmodules = false) {
sleep random.nextInt(60 * retryAttempt) // Stagger checkouts to prevent HTTP 429 (Too Many Requests) response from CodeCommit sleep random.nextInt(60 * retryAttempt) // Stagger checkouts to prevent HTTP 429 (Too Many Requests) response from CodeCommit
} }
retryAttempt = retryAttempt + 1 retryAttempt = retryAttempt + 1
dir(ENGINE_REPOSITORY_NAME) { checkout scm: [
checkout scm: [ $class: 'GitSCM',
$class: 'GitSCM', branches: scm.branches,
branches: scm.branches, extensions: [
extensions: [ [$class: 'SubmoduleOption', disableSubmodules: disableSubmodules, recursiveSubmodules: true],
[$class: 'SubmoduleOption', disableSubmodules: disableSubmodules, recursiveSubmodules: true], [$class: 'CheckoutOption', timeout: 60]
[$class: 'CheckoutOption', timeout: 60] ],
], userRemoteConfigs: scm.userRemoteConfigs
userRemoteConfigs: scm.userRemoteConfigs ]
]
}
} }
// Add folder where we will store the 3rdParty downloads and packages // Run lfs in a separate step. Jenkins is unable to load the credentials for the custom LFS endpoint
if(!fileExists('3rdParty')) { withCredentials([usernamePassword(credentialsId: "${env.GITHUB_USER}", passwordVariable: 'accesstoken', usernameVariable: 'username')]) {
palMkdir('3rdParty') SetLfsCredentials("git config -f .lfsconfig lfs.url https://${username}:${accesstoken}@${env.LFS_URL}", 'Set credentials')
} }
palSh('git lfs install', 'Git LFS Install')
palSh('git lfs pull', 'Git LFS Pull')
dir(ENGINE_REPOSITORY_NAME) { // CHANGE_ID is used by some scripts to identify uniquely the current change (usually metric jobs)
// Run lfs in a separate step. Jenkins is unable to load the credentials for the custom LFS endpoint palSh('git rev-parse HEAD > commitid', 'Getting commit id')
withCredentials([usernamePassword(credentialsId: "${env.GITHUB_USER}", passwordVariable: 'accesstoken', usernameVariable: 'username')]) { env.CHANGE_ID = readFile file: 'commitid'
SetLfsCredentials("git config -f .lfsconfig lfs.url https://${username}:${accesstoken}@${env.LFS_URL}", 'Set credentials') env.CHANGE_ID = env.CHANGE_ID.trim()
} palRm('commitid')
palSh('git lfs install', 'Git LFS Install')
palSh('git lfs pull', 'Git LFS Pull')
// CHANGE_ID is used by some scripts to identify uniquely the current change (usually metric jobs)
palSh('git rev-parse HEAD > commitid', 'Getting commit id')
env.CHANGE_ID = readFile file: 'commitid'
env.CHANGE_ID = env.CHANGE_ID.trim()
palRm('commitid')
}
} }
def PreBuildCommonSteps(Map pipelineConfig, String projectName, String pipeline, String branchName, String platform, String buildType, String workspace, boolean mount = true, boolean disableSubmodules = false) { def PreBuildCommonSteps(Map pipelineConfig, String projectName, String pipeline, String branchName, String platform, String buildType, String workspace, boolean mount = true, boolean disableSubmodules = false) {
@ -309,28 +298,31 @@ def PreBuildCommonSteps(Map pipelineConfig, String projectName, String pipeline,
} }
dir(workspace) { dir(workspace) {
// Add folder where we will store the 3rdParty downloads and packages
if(!fileExists('3rdParty')) {
palMkdir('3rdParty')
}
}
dir("${workspace}/${ENGINE_REPOSITORY_NAME}") {
CheckoutRepo(disableSubmodules) CheckoutRepo(disableSubmodules)
// Get python // Get python
dir(ENGINE_REPOSITORY_NAME) { if(env.IS_UNIX) {
if(env.IS_UNIX) { sh label: 'Getting python',
sh label: 'Getting python', script: 'python/get_python.sh'
script: 'python/get_python.sh' } else {
} else { bat label: 'Getting python',
bat label: 'Getting python', script: 'python/get_python.bat'
script: 'python/get_python.bat' }
}
if(env.CLEAN_OUTPUT_DIRECTORY.toBoolean() || env.CLEAN_ASSETS.toBoolean()) { if(env.CLEAN_OUTPUT_DIRECTORY.toBoolean() || env.CLEAN_ASSETS.toBoolean()) {
def command = "${pipelineConfig.BUILD_ENTRY_POINT} --platform ${platform} --type clean" def command = "${pipelineConfig.BUILD_ENTRY_POINT} --platform ${platform} --type clean"
if (env.IS_UNIX) { if (env.IS_UNIX) {
sh label: "Running ${platform} clean", sh label: "Running ${platform} clean",
script: "${pipelineConfig.PYTHON_DIR}/python.sh -u ${command}" script: "${pipelineConfig.PYTHON_DIR}/python.sh -u ${command}"
} else { } else {
bat label: "Running ${platform} clean", bat label: "Running ${platform} clean",
script: "${pipelineConfig.PYTHON_DIR}/python.cmd -u ${command}".replace('/','\\') script: "${pipelineConfig.PYTHON_DIR}/python.cmd -u ${command}".replace('/','\\')
}
} }
} }
} }

Loading…
Cancel
Save