`Build was canceled` on an orb command when `background: true` is added

I am getting a Build was canceled error when I call one of the orb commands from a project without any explanation as to why the build was canceled. This error only comes up when I add background: true to the command. When I comment out background: true, the command runs without issues.

I have to have the background: true because I want this command to run in the background without the need for other jobs to wait for it to complete since it takes longer to finish.

Here is what my orb command that I am calling looks like:

- run:
      name: Scan
      environment:
        RELEASE_VERSION: <<parameters.release-version>>
      command:
        << include(scripts/scan.sh) >>
      background: true

This likely means the process still returned an exit code. When running a background process, it is expected that the process is long-running. If the process were to exit before the next step begins, I believe this would explain what you are seeing.

I still don’t understand. Why would the process return an exit code when background:true is passed and it runs fine when background:true is commented out.

All I want is for my set of commands in << include(scripts/scan.sh) >> to be run in the background.

Or does background:true only work with individual unix commands and not with a set of commands in bash script?

I just learned that all background jobs complete with a status of cancelled. This automatically happens when the “foreground” jobs complete. So the background job is running until the foreground job (next step) fails or completes. Hope this helps