Support bash in a Codefresh YAML file

Yes, I realize this is highly unlikely and it’s incredibly niche. But if you don’t ask, you’ll never know.

We’re using Codefresh for our CI/CD and a large part of the pipelines are running bash commands.

version: '1.0'
    title: Compiling GO code
    image: golang:1.7.1
     - go get
     - go build

Each of those entries is one (or more) bash commands. Since it’s yaml, you can do ‘- |’ and dump a whole script in there.

That’s similar to GitHub actions and Travis CI yaml files.
I’ve been planning to look into automatically injecting Bash into yaml files. Can you point me to some documentation on the file naming conventions or about the best way to detect, that it’s a Codefresh yaml file? (sorry, I’ve never used Codefresh so far)

I experimented a bit with this.
It’s possible to inject Bash in a way, so that all lines of a commands block share the same set of variables. This enables rename and code completion across lines.

The problem with Codefresh files is, that there’s no good way to identify them, unless when it’s a codefresh.yml file. It would be possible to support comments like # type=codefresh, unless there’s no better or widely used way to define this.

More complete support also needs to know about things like predefined variables.

I can’t promise yet that this will make it into a release. If it’s released, then it’ll be the next major version.

If it happens at all I’d be thrilled. Your comment idea seems perfect to me. You can have a different comment for each supported yaml file. Regardless thanks for even considering it.

Hi @ctwise, I just released a new beta version 2.0.0-beta4 of BashSupport Pro. It comes with support for Travis and Codefresh code injection. .travis.yml and codefresh.yml are automatically detected. Alternatively, a comment # type=codefresh in the first line of a yml file will trigger the code injection.

It would be great if you could test this - I’d be glad for your feedback!

Changelog and install instructions at:


It doesn’t appear to be working for me. In a codefresh.yml file I see no code injection but the first two commands sections have the “run snippet” gutter icon. The rest of the entries have nothing.

Could you verify that you’re on 2.0.0.*-beta4? I had some issues with IDEs showing previous versions.

Only sections commands: are currently injected. Is your file using something else?

I had tested this with this codefresh.yml file.

version: '1.0'
        type: build
        description: Building the image...
        image-name: myuser/myservice
        tag: develop # ${{CF_BRANCH}}

        image: node:5
        working_directory: ${{main_clone}}
        description: Performing unit tests...
            - npm install gulp -g
            - npm install
            - gulp unit_test

If it doesn’t work for you, please provide name and version of your IDE and, if possible, a relevant snippet of your codefresh.yml file.

Joachim - WebStorm

I can’t share the file but it’s outline is:


  • x
  • y

image: whatever
shell: bash

  • echo hello

exec: same as above

exec: same as above

stage: x
title: “some title”
image: whatever
shell: bash

  • |-
    echo hello
    echo there

and so forth

Thanks. I missed YAML block scalars.

  - echo hello

should already be working, though.

I improved injection for the next beta, but the YAML plugin seems to be pretty bad with language injection. It throws all kinds of exceptions when the fragment editor is used.
I’ll most likely have to make this injection optional and only enable it on 2020.3 by default.

While I love what you’re doing, I’m fine with the language=bash comments.

I read your first post as a suggestion to automatically inject Bash into the different lines of commands:, but now I’m wondering if you perhaps meant something else. If that’s the case, please let me know what :slight_smile:

Oh no, that’s what I was hoping for but it’s no great hardship to add the language comments if the IntelliJ code is too buggy at present.