atlantis icon indicating copy to clipboard operation
atlantis copied to clipboard

multienv output suppression breaks settings env vars

Open the-nando opened this issue 1 year ago • 1 comments

Overview of the Issue

https://github.com/runatlantis/atlantis/issues/4388 added the possibility to suppress the "Dynamic environment variables added:" output of multienv but it doesn't seem to be working as expected.

Reproduction Steps

# /data/dev.env
FOO="fuzz"
workflows:
  dev:
    plan:
      steps:
      - multienv:
          command: multienv /data/dev.env
          output: show
      - init
      - run: echo "${FOO}"

Correctly returns fuzz in the comment whereas the following doesn't:

      - multienv:
          command: multienv /data/dev.env
          output: hide

Additional Context

As far as I can tell the problem originates from here where postProcessOutput is passed to the runner which proceeds to discard the output here by returning "" when postProcessOutput is set to PostProcessRunOutputHide. This causes the caller not to receive any key=value to process and export.

the-nando avatar Jul 09 '24 08:07 the-nando

I have the same issue. Atlantis version is v0.28.5

maxvasylets avatar Aug 12 '24 14:08 maxvasylets

confirming on 0.32 as well

Vladyslav-Miletskyi avatar Jan 15 '25 11:01 Vladyslav-Miletskyi

This is still an issue for version 0.33, so we can't utilize it. Do you maybe have any plans to fix this?

bazilmarkov avatar Feb 11 '25 15:02 bazilmarkov

I honestly gave up. I wrote a script that pulls all of the info that I need to build my environment variables and put that into a json format. Then I just go through that using jq to pull out individual vars. It's stupid but it works.

e.g.

        # Set env variables for provider configs                                                                                   
        - env:                                                                                                                     
            name: VAULT_JSON                                                                                                       
            command: gather_vault_secrets.sh  
        - env:                                                                                                                     
            name: DD_API_KEY                                                                                                       
            command: 'echo $VAULT_JSON | jq -r .DD_API_KEY'                                                                        
        - env:                                                                                                                     
            name: DD_APP_KEY                                                                                                       
            command: 'echo $VAULT_JSON | jq -r .DD_APP_KEY'               

grimm26 avatar Feb 11 '25 16:02 grimm26