Including non bash files while authoring an orb

I see it’s possible to include bash scripts while authoring an orb (Orbs Concepts - CircleCI and Orb Authoring Process - CircleCI). Using this feature results in the script source code being pasted into the run step along with a #!/bin/bash header, i.e. a containing echo "bash script" when included in a run script via `<<include(scripts/>> would be generated as the following:

echo "bash script"

Is it possible to run non bash scripts in a similar fashion? Including a python script, for example including a containing print ("python script") using <<include(scripts/>> results in the following:

print ("bash script")

which of course throws an error. I tried creating a proxy bash script that contains python but it looks like this doesn’t work as the contents aren’t extracted at compile time, thus failing as doesn’t exist in the project using the orb.

Any simple solutions here or is dynamic config the only solution?

Hi @swarajrao,

This is possible if you set the shell at step level as well. Here is an example from one of our orbs:

path-filtering-orb/set-parameters.yml at main · CircleCI-Public/path-filtering-orb · GitHub

  - run:
        BASE_REVISION: << parameters.base-revision >>
        MAPPING: << parameters.mapping >>
        OUTPUT_PATH: << parameters.output-path >>
      name: Set parameters
      shell: /usr/bin/env python3
      command: <<include(scripts/>>

Could you try to adapt this to your orb, and let us know if it works for you?

Thank you!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.

The platform has been updated to support additional shells out-of-the-box: Orb Author FAQ - CircleCI