diff --git a/Jenkinsfile b/Jenkinsfile index 43db4bf998..4d1a8c4425 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -125,21 +125,27 @@ try { timestamps { sshagent(['github-auth-ssh']) { docker_image.inside(run_args) { - stage('Bitbake Build') { - if (is_pr) { - setGitHubPullRequestStatus state: 'PENDING', context: "${env.JOB_NAME}", message: "Bitbake Build" + try { + stage('Bitbake Build') { + if (is_pr) { + setGitHubPullRequestStatus state: 'PENDING', context: "${env.JOB_NAME}", message: "Bitbake Build" + } + params = ["${script_env}", + "docker/build-project.sh"].join("\n") + sh "${params}" } - params = ["${script_env}", - "docker/build-project.sh"].join("\n") - sh "${params}" - } - stage('Build publishing') { - if (is_pr) { - setGitHubPullRequestStatus state: 'PENDING', context: "${env.JOB_NAME}", message: "Build publishing" + } catch (Exception e) { + throw e + } finally { + // publish in finally-block so that detailed logs or any partial results get stored even in case of failed build + stage('Build publishing') { + if (is_pr) { + setGitHubPullRequestStatus state: 'PENDING', context: "${env.JOB_NAME}", message: "Build publishing" + } + params = ["${script_env}", + "docker/publish-project.sh"].join("\n") + sh "${params}" } - params = ["${script_env}", - "docker/publish-project.sh"].join("\n") - sh "${params}" } } } // sshagent diff --git a/docker/publish-project.sh b/docker/publish-project.sh index 8f23cd1266..84cffc89b9 100755 --- a/docker/publish-project.sh +++ b/docker/publish-project.sh @@ -132,8 +132,10 @@ fi # Copy detailed build logs # Include symlinks to avoid massive amount of "skipping non-regular file" # lines in the rsyncd server system-level log -create_remote_dirs ${_RSYNC_DEST} detailed-logs/${TARGET_MACHINE}/ -rsync -qzrl --prune-empty-dirs --include "log.*" --include "*/" --exclude "*" ${_BRESULT}/work*/* ${_RSYNC_DEST}/detailed-logs/${TARGET_MACHINE}/ +if [ -d ${_BRESULT}/work ]; then + create_remote_dirs ${_RSYNC_DEST} detailed-logs/${TARGET_MACHINE}/ + rsync -qzrl --prune-empty-dirs --include "log.do_*" --include "*/" --exclude "*" ${_BRESULT}/work*/* ${_RSYNC_DEST}/detailed-logs/${TARGET_MACHINE}/ +fi # Create latest symlink locally and rsync it to parent dir of publish dir ln -vsf ${CI_BUILD_ID} latest