CircleCI-Public/slack-orb

Access to bash environment variables

McCo0L opened this issue · 4 comments

Orb version:

4.12.1

What happened:

Trying to pass some bash environment variable as part of the message string but receiving an error. The variables are a string with multiple values in a file.
This is the code I'm trying to run:

      - run:
          name: ENV variables
          command: |
            echo "export UNMANAGED=$(cat unmanaged.txt)" >> $BASH_ENV
            source $BASH_ENV
      - slack/notify:
          event: always
          custom: |
            {
              "blocks": [
                {
                  "type": "section",
                  "fields": [
                    {
                      "type": "plain_text",
                      "text": "NOT managed: $UNMANAGED",
                      "emoji": true
                    }
                  ]
                }
              ]
            }

and receiving this error:

Posting Status
BASH_ENV file: /tmp/.bash_env-641b44263241ae241b61a641-0-build
Exists. Sourcing into ENV
Checking For JQ + CURL
Sanitizing UNMANAGED...
Sanitizing NOT_IGNORED...
parse error: Expected another array element at line 23, column 3
parse error: Expected another array element at line 23, column 3

Exited with code exit status 4

Hello @McCo0L, Can you share what image you were using the orb in? Additionally, is it possible to know the contents of unmanaged.txt or know if changing the contents matters at all?

Hey @KyleTryon ,
Image is "cimg/python:3.10.2"
contents of unmanaged.txt is just a comma separated list with this content for reference: ObjectPath,tt-recipes,chacaf-sam, org-service,tt-db,evidence-playground

accessing BASH_ENV file the contents of the variable look right.
Was thinking in testing with custom template instead of using custom notify.

solved it, there was an extra comma in the slack block.

Hey @McCo0L - where was the exact extra comma that was removed to resolve the problem? :)