Skip to content

Not possible to set empty environment values #305

@robrat

Description

@robrat

Expected Behavior

aio cloudmanager:pipeline:set-variables <id> FOO "" results in creating an environment variable named FOO with empty value.

Actual Behavior

The variable FOO is deleted from the list of pipeline variables.

As long as you use Bash exclusively, this behavior is ok-ish, because most tests are done with -n, -z or -eq operators. But also in Bash v4.2+ there is a difference:

$ [[ -v FOO ]] && echo true || echo false
false

$ FOO=
$ [[ -v FOO ]] && echo true || echo false
true

This behavior becomes a problem for languages that distinguish between not existing and empty, e.g. Java. If you want to use (secret) variables to replace values in config files via Maven resources plugin during the Build you will end up with ${env.FOO} in the processed config file. This creates problems for the software that is using the software because "${env.FOO}" is obviously something different than "".

Therefore, the set-variables command should support something like an allow-empty parameter.

Reproduction Scenario, Platform, and Version

$ aio -v
@adobe/aio-cli/6.0.0 linux-x64 node-v12.20.1
$ aio plugins
@adobe/aio-cli-plugin-cloudmanager 1.5.0

Steps to Reproduce

Invoke aio cloudmanager:pipeline:set-variables with an arbitrary variable name and an empty value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions