runner icon indicating copy to clipboard operation
runner copied to clipboard

Empty env vars not being set in container jobs

Open jamesstonehill opened this issue 2 years ago • 3 comments

Describe the bug When you set container env vars, if the env var is an empty string, the env var doesn't get set. This is incorrect as for some purposes there is a logical difference between an env var not being set and an env var being set to an empty string.

To Reproduce

jobs:
  test_env_var_bug:
    name: Test Empty Env Var Bug
    runs-on: ubuntu-latest
    container:
      image: node:18
      env:
        FOO_ONE: ""
        FOO_TWO: "I show up!"
    steps:
    - name: TEST
      run: env | grep "FOO"

Console output: image

Expected behavior I'd expect that both env vars are set in the env and that when you run env you'd see something like this:=

Console output:

Run env | grep "FOO"
FOO_ONE=
FOO_TWO=I show up!

Runner Version and Platform

'2.311.0' ubuntu-latest

jamesstonehill avatar Dec 16 '23 11:12 jamesstonehill

I got the same bug

besides, in the below case, var is ""

export var="" 
echo $var
> ""

muncok avatar Jan 24 '24 17:01 muncok

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 15 days.

github-actions[bot] avatar Jan 27 '25 00:01 github-actions[bot]

Adding comment to remove stale tag.

jamesstonehill avatar Jan 27 '25 12:01 jamesstonehill