Run orb commands on fail

Trying to work out if something is possible with config version 2.1, any help would be appreciated.

We want to be able to use the aws s3 orb to transfer log files and artifacts to aws on all builds, including failed ones. Only problem is when a set of unit tests fail the store test results and store artifacts steps run but aws-s3 orb step does not run and “when: always” is not accepted argument. Any ideas?

      - store_test_results:
          path: build/workspace/test_results
      - store_artifacts:
          path: artifacts
      - aws-s3/copy:
          arguments: |
            --recursive \
          from: artifacts

Hello @jamie.armstrong

Orbs are a bit unique in that they contain often multiple “run” statements. It is possible to create what you are looking for but at the moment, to do this the AWS s3 orb would need to contain a new parameter which would feed into the “run” statements contained within.

I believe this functionality should likely be implemented so this parameter is inherently applied to all orb commands, so I have created this feature request in response to your post:

If you have the time, please considering voting for this feature here.

A shorter-term solution would be to add a parameter to the orb itself. We may actually be able to use the same name “when” for the parameter name as well, though I worry this could create compatibility issues in the future.

An issue has been created in the S3 orb repo for this concern:

Please feel free to fork or submit a PR. We will likely implement this feature in the orb after a short deliberation.

Hi @KyleTryon,

Thanks very much for your reply, I will keep an eye out for this enhancement or fork the aws-s3 orb code it if I have the chance.