CI: re-work / extend artifacts collection
v2 cover CI: re-work / extend artifacts collection
1: re-work Xen artifacts collection
2: collect certain intermediate files as artifacts
Pipeline (PPC intentionally broken):
https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/2515787945
Jan
PATCH v2 1/2 CI: re-work Xen artifacts collection
There's no need to do this separately from three places. Once moved to the bottom of the script, the need for this to be a function also disappears.
While there also make sure xen-syms is collected. This is rather more useful for analysis of possible problems than its stripped counterpart.
automation/scripts/build +11 -19
@@ -44,30 +44,15 @@ cp xen/.config xen-config # Directory for the artefacts to be dumped into mkdir -p binaries -collect_xen_artefacts() -{ - local f - - for f in xen/xen xen/xen.efi; do - if [[ -f $f ]]; then - cp $f binaries/ - fi - done -} - if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then # Cppcheck analysis invokes Xen-only build xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra -- -j$(nproc) # Preserve artefacts - collect_xen_artefacts cp xen/cppcheck-report/xen-cppcheck.txt xen-cppcheck.txt elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then # Xen-only build make -j$(nproc) xen - - # Preserve artefacts - collect_xen_artefacts else # Full build. Figure out our ./configure options cfgargs=("--prefix=/usr")
@@ -108,9 +93,16 @@ else make -j$(nproc) dist # Preserve artefacts - # Note: Some smoke tests depending on finding binaries/xen on a full build - # even though dist/ contains everything, while some containers don't even - # build Xen (cd dist/install; find | cpio -R 0:0 -o -H newc | gzip) > binaries/xen-tools.cpio.gz - collect_xen_artefacts fi + +# Preserve Xen artefacts +# +# Note: Some smoke tests depend on finding binaries/xen on a full build +# even though dist/ contains everything, while some containers don't even +# build Xen. +for f in xen/xen xen/xen-syms xen/xen.efi; do + if [[ -f $f ]]; then + cp $f binaries/ + fi +done
Re: [PATCH v2 1/2] CI: re-work Xen artifacts collection
Quoted 7 lines · Jan Beulich
There's no need to do this separately from three places. Once moved to the bottom of the script, the need for this to be a function also disappears.
While there also make sure xen-syms is collected. This is rather more useful for analysis of possible problems than its stripped counterpart.
Signed-off-by Jan Beulich <[email protected]>
Quoted 55 lines
automation/scripts/build +11
-19@@ -44,30 +44,15 @@ cp xen/.config xen-config # Directory for the artefacts to be dumped into mkdir -p binaries -collect_xen_artefacts() -{ - local f - - for f in xen/xen xen/xen.efi; do - if [[ -f $f ]]; then - cp $f binaries/ - fi - done -} - if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then # Cppcheck analysis invokes Xen-only build xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra -- -j$(nproc) # Preserve artefacts - collect_xen_artefacts cp xen/cppcheck-report/xen-cppcheck.txt xen-cppcheck.txt elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then # Xen-only build make -j$(nproc) xen - - # Preserve artefacts - collect_xen_artefacts else # Full build. Figure out our ./configure options cfgargs=("--prefix=/usr")@@ -108,9 +93,16 @@ else make -j$(nproc) dist # Preserve artefacts - # Note: Some smoke tests depending on finding binaries/xen on a full build - # even though dist/ contains everything, while some containers don't even - # build Xen (cd dist/install; find | cpio -R 0:0 -o -H newc | gzip) > binaries/xen-tools.cpio.gz - collect_xen_artefacts fi + +# Preserve Xen artefacts +# +# Note: Some smoke tests depend on finding binaries/xen on a full build +# even though dist/ contains everything, while some containers don't even +# build Xen. +for f in xen/xen xen/xen-syms xen/xen.efi; do + if [[ -f $f ]]; then + cp $f binaries/ + fi +done
PATCH v2 2/2 CI: collect certain intermediate files as artifacts
In reply to Jan BeulichWhen one of the linking passes fails, additional intermediate files are still in place. Having them available for analysis of the underlying problem can be pretty helpful. Collect some into a new intermediates/ directory. (Nothing new will be collected if linking succeeds.)
As the script is run with -e passed to bash, defer exit if the main "make" (or substituent script thereof) failed. This way more artifacts are collected, potentially making it easier to analyze the failure.
---
https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/2515787945
(with PPC forced to invoke the new logic, hence respective failures there)
---
v2: Different approach.
automation/gitlab-ci/build.yaml +1 -0
@@ -6,6 +6,7 @@ artifacts: paths: - binaries/ + - intermediates/ - xen-config - xen-cppcheck.txt - '*.log'
automation/scripts/build +18 -7
@@ -37,22 +37,24 @@ else make -j$(nproc) -C xen olddefconfig fi -# Save the config file before building because build failure causes the script -# to exit early -- bash is invoked with -e. +# Save the config file before building, just in case. cp xen/.config xen-config -# Directory for the artefacts to be dumped into -mkdir -p binaries +# Directories for artefacts to be dumped into +mkdir -p binaries intermediates + +# Script exit status, to be overridden by the main make's status below. +ret=0 if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then # Cppcheck analysis invokes Xen-only build - xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra -- -j$(nproc) + xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra -- -j$(nproc) || ret=$? # Preserve artefacts cp xen/cppcheck-report/xen-cppcheck.txt xen-cppcheck.txt elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then # Xen-only build - make -j$(nproc) xen + make -j$(nproc) xen || ret=$? else # Full build. Figure out our ./configure options cfgargs=("--prefix=/usr")
@@ -90,7 +92,7 @@ else fi ./configure "${cfgargs[@]}" - make -j$(nproc) dist + make -j$(nproc) dist || ret=$? # Preserve artefacts (cd dist/install; find | cpio -R 0:0 -o -H newc | gzip) > binaries/xen-tools.cpio.gz
@@ -106,3 +108,12 @@ for f in xen/xen xen/xen-syms xen/xen.ef cp $f binaries/ fi done + +# Preserve Xen intermediate files. Some may be there only upon build failure. +for f in xen/.xen-syms.* xen/.xen.efi.*; do + if [[ -f $f ]]; then + cp $f intermediates/ + fi +done + +exit $ret
Re: [PATCH v2 2/2] CI: collect certain intermediate files as artifacts
Quoted 10 lines · Jan Beulich
When one of the linking passes fails, additional intermediate files are still in place. Having them available for analysis of the underlying problem can be pretty helpful. Collect some into a new intermediates/ directory. (Nothing new will be collected if linking succeeds.)
As the script is run with -e passed to bash, defer exit if the main "make" (or substituent script thereof) failed. This way more artifacts are collected, potentially making it easier to analyze the failure.
Signed-off-by Jan Beulich <[email protected]>
Quoted 72 lines
---
https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/2515787945
(with PPC forced to invoke the new logic, hence respective failures there)
---
v2: Different approach.automation/gitlab-ci/build.yaml +1
-0@@ -6,6 +6,7 @@ artifacts: paths: - binaries/ + - intermediates/ - xen-config - xen-cppcheck.txt - '*.log'automation/scripts/build +18
-7@@ -37,22 +37,24 @@ else make -j$(nproc) -C xen olddefconfig fi -# Save the config file before building because build failure causes the script -# to exit early -- bash is invoked with -e. +# Save the config file before building, just in case. cp xen/.config xen-config -# Directory for the artefacts to be dumped into -mkdir -p binaries +# Directories for artefacts to be dumped into +mkdir -p binaries intermediates + +# Script exit status, to be overridden by the main make's status below. +ret=0 if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then # Cppcheck analysis invokes Xen-only build - xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra -- -j$(nproc) + xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra -- -j$(nproc) || ret=$? # Preserve artefacts cp xen/cppcheck-report/xen-cppcheck.txt xen-cppcheck.txt elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then # Xen-only build - make -j$(nproc) xen + make -j$(nproc) xen || ret=$? else # Full build. Figure out our ./configure options cfgargs=("--prefix=/usr")@@ -90,7 +92,7 @@ else fi ./configure "${cfgargs[@]}" - make -j$(nproc) dist + make -j$(nproc) dist || ret=$? # Preserve artefacts (cd dist/install; find | cpio -R 0:0 -o -H newc | gzip) > binaries/xen-tools.cpio.gz@@ -106,3 +108,12 @@ for f in xen/xen xen/xen-syms xen/xen.ef cp $f binaries/ fi done + +# Preserve Xen intermediate files. Some may be there only upon build failure. +for f in xen/.xen-syms.* xen/.xen.efi.*; do + if [[ -f $f ]]; then + cp $f intermediates/ + fi +done + +exit $ret