This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/trafficserver-ci.git


The following commit(s) were added to refs/heads/main by this push:
     new ce09ff3  Archive ATS logs on centos pipeline failure (#411)
ce09ff3 is described below

commit ce09ff3bc3d8e2f431b7c8fd4ef7660b4bb6505a
Author: Brian Neradt <[email protected]>
AuthorDate: Tue Dec 23 14:25:31 2025 -0600

    Archive ATS logs on centos pipeline failure (#411)
    
    When the centos pipeline build or test fails, copy the Traffic Server
    log directory (/tmp/ats/var/log/trafficserver) to the output directory.
    This includes traffic.out and any crash logs, making it easier to
    debug failures.
    
    Use a bash EXIT trap to ensure logs are archived even if the script
    is interrupted by a signal (e.g., SIGALRM from regression test timeout).
    
    The logs are archived using Jenkins archiveArtifacts and can be
    downloaded from the build job page.
    
    Also fix git commands to use -s instead of --no-patch for compatibility
    with the older git version on CentOS 7.
---
 jenkins/github/centos.pipeline | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/jenkins/github/centos.pipeline b/jenkins/github/centos.pipeline
index e42b11c..8cd59dd 100644
--- a/jenkins/github/centos.pipeline
+++ b/jenkins/github/centos.pipeline
@@ -44,11 +44,12 @@ pipeline {
                             cat /etc/*release*
 
                             echo
-                            git show HEAD^2 --no-patch
-                            git show HEAD^1 --no-patch
+                            # Use -s instead of --no-patch for compatibility 
with older git.
+                            git show HEAD^2 -s
+                            git show HEAD^1 -s
                             echo
 
-                            git show -n 10 --decorate --graph --oneline 
--no-patch
+                            git log -n 10 --decorate --graph --oneline
                             echo
                             echo
                     '''
@@ -68,6 +69,16 @@ pipeline {
 
                         export_dir="${WORKSPACE}/output/${GITHUB_PR_NUMBER}"
                         mkdir -p ${export_dir}
+
+                        # Set up a trap to archive logs on any exit, including 
signals.
+                        archive_logs() {
+                            if [ -d /tmp/ats/var/log/trafficserver ]; then
+                                cp -rf /tmp/ats/var/log/trafficserver 
"${export_dir}/logs"
+                            fi
+                            sudo chmod -R 777 ${WORKSPACE} || true
+                        }
+                        trap archive_logs EXIT
+
                         build_failed=0
 
                         if [ -d cmake ]
@@ -108,12 +119,8 @@ pipeline {
                             fi
                         fi
 
-                        # Archive logs on failure.
+                        # Exit with failure if build failed. The trap will 
archive logs.
                         if [ ${build_failed} -ne 0 ]; then
-                            if [ -d /tmp/ats/var/log/trafficserver ]; then
-                                cp -rf /tmp/ats/var/log/trafficserver 
"${export_dir}/logs"
-                            fi
-                            sudo chmod -R 777 ${WORKSPACE}
                             exit 1
                         fi
                         '''

Reply via email to