pr_crictl: enhance CI/CD error handling
Fixes:
@@ -31,16 +31,18 @@ jobs:
echo "rune_test=$rune_test" >> $GITHUB_ENV
- name: Build and install packages
- run: docker exec $rune_test bash -c "cp -r /root/inclavare-containers /root/inclavare-containers-$RUNE_VERSION;
- tar zcf v$RUNE_VERSION.tar.gz inclavare-containers-$RUNE_VERSION;
- cd /root/inclavare-containers-$RUNE_VERSION;
+ run: docker exec $rune_test bash -c 'trap "error_handler $?" ERR;
+ error_handler() { local err=$?; printf "Cleaning up with exit code $err ...\n"; exit $err; };
+ cp -r /root/inclavare-containers /root/inclavare-containers-${{ env.RUNE_VERSION }};
+ tar zcf v${{ env.RUNE_VERSION }}.tar.gz inclavare-containers-${{ env.RUNE_VERSION }};
+ cd /root/inclavare-containers-${{ env.RUNE_VERSION }};
mkdir -p /root/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS};
- cp /root/v$RUNE_VERSION.tar.gz /root/rpmbuild/SOURCES/;
- echo "$RUNE_VERSION" > VERSION;
- find ./ -path "*dist/Makefile" | xargs -I files sed -i '16 d' files;
- make package RPMBUILD_DIR=/root/rpmbuild RELEASE_TARBALL_FILE=/root/rpmbuild/SOURCES/v$RUNE_VERSION.tar.gz RELEASE_TARBALL_EXIST=y -j${CPU_NUM};
- rpm -ivh rune-$RUNE_VERSION-1.el8.x86_64.rpm;
- rpm -ivh shim-rune-$RUNE_VERSION-1.el8.x86_64.rpm"
+ cp /root/v${{ env.RUNE_VERSION }}.tar.gz /root/rpmbuild/SOURCES/;
+ echo "${{ env.RUNE_VERSION }}" > VERSION;
+ find ./ -path "*dist/Makefile" | xargs -I files sed -i "16 d" files;
+ make package RPMBUILD_DIR=/root/rpmbuild RELEASE_TARBALL_FILE=/root/rpmbuild/SOURCES/v${{ env.RUNE_VERSION }}.tar.gz RELEASE_TARBALL_EXIST=y -j${{ env.CPU_NUM }};
+ rpm -ivh rune-${{ env.RUNE_VERSION }}-1.el8.x86_64.rpm;
+ rpm -ivh shim-rune-${{ env.RUNE_VERSION }}-1.el8.x86_64.rpm'
- name: Run occlum-hello pod
if: always()
