Skip to content

flash-script: avoid cleanup trap exit on iso/img runs#1855

Merged
brianmcgillion merged 1 commit intomainfrom
flash-script-cleanup-exit
Mar 26, 2026
Merged

flash-script: avoid cleanup trap exit on iso/img runs#1855
brianmcgillion merged 1 commit intomainfrom
flash-script-cleanup-exit

Conversation

@henrirosten
Copy link
Copy Markdown
Collaborator

@henrirosten henrirosten commented Mar 26, 2026

Nix writeShellApplication wraps flash-script with set -euo pipefail. After 71740ef (from #1848), cleanup() was added as:

[ -n "$TEMP_DIR" ] && rm -rf "$TEMP_DIR"

The .iso and .img paths never set TEMP_DIR, so the EXIT trap runs this test with an empty variable after the script has already printed Flashing complete. Under the strict wrapper, that status 1 becomes the script exit code.

In CI this makes installer flashing look successful, but Jenkins then reports exit code 1 and skips the next stage.

Use an explicit if block so cleanup() returns success when there is nothing to remove.

Description of Changes

Type of Change

  • New Feature
  • Bug Fix
  • Improvement / Refactor

Related Issues / Tickets

Checklist

  • Clear summary in PR description
  • Detailed and meaningful commit message(s)
  • Commits are logically organized and squashed if appropriate
  • Contribution guidelines followed
  • Ghaf documentation updated with the commit - https://tiiuae.github.io/ghaf/
  • Author has run make-checks and it passes
  • All automatic GitHub Action checks pass - see actions
  • Author has added reviewers and removed PR draft status

Testing Instructions

Applicable Targets

  • Orin AGX aarch64
  • Orin NX aarch64
  • Lenovo X1 x86_64
  • Dell Latitude x86_64
  • System 76 x86_64

Installation Method

  • Requires full re-installation
  • Can be updated with nixos-rebuild ... switch
  • Other:

Test Steps To Verify:

  1. ...

writeShellApplication wraps flash-script with
'set -euo pipefail'. After 71740ef,
cleanup() was added as:

  [ -n "" ] && rm -rf ""

The .iso and .img paths never set TEMP_DIR, so the EXIT trap runs
this test with an empty variable after the script has already
printed 'Flashing complete'. Under the strict wrapper, that status 1
becomes the script exit code.

In CI this makes installer flashing look successful, but Jenkins
then reports exit code 1 and skips the next stage.

Use an explicit if block so cleanup() returns success when there is
nothing to remove.

Signed-off-by: Henri Rosten <henri.rosten@unikie.com>
@henrirosten henrirosten marked this pull request as ready for review March 26, 2026 07:41
Copy link
Copy Markdown

@milva-unikie milva-unikie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested in Jenkins that flashing installer images works again. Thank you!

@brianmcgillion can we get this merged asap?

@milva-unikie milva-unikie added the Tested on Lenovo X1 Carbon This PR has been tested on Lenovo X1 Carbon label Mar 26, 2026
@brianmcgillion brianmcgillion merged commit b0e5d91 into main Mar 26, 2026
32 checks passed
@brianmcgillion brianmcgillion deleted the flash-script-cleanup-exit branch March 26, 2026 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tested on Lenovo X1 Carbon This PR has been tested on Lenovo X1 Carbon

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants