E

Setting Secret Value with Comma Issue

Summary

The user is encountering difficulty setting a secret value with a comma using the --secret flag in an earthly command, with differences between zsh and bash shells. They seek guidance on correctly setting this value, which may be multi-line and is currently derived from the git commit message. The secret is used in CI to report a test run's commit message to Cypress Cloud successfully.

Status
open
Tags
    Source
    #earthly
      b

      brett.higgins

      7/24/2024

      I haven't yet been able to resolve this, so I'm just making do without that --secret value in that context; still interested if anyone has any ideas here

      b

      brett.higgins

      7/23/2024

      I also confirmed that the usage of the secret in CI (reporting a test run's commit message to Cypress Cloud) gets the full value of the secret (by looking in the Cypress UI for that test run)

      b

      brett.higgins

      7/23/2024

      Full info: the secret in question is also potentially multi-line; it's set to the value of $(git show -s --pretty=%B) - i.e. the current git commit message. (I'm doing this so I can use the commit message without impacting caching.)

      b

      brett.higgins

      7/23/2024

      I have an earthly invocation with --secret NAME="value" where value contains a comma. Earthly is getting confused and attempting to set a value with the name that comes after this comma, rather than including the comma and the text after it in the secret value: Error: failed to set secret "(text after comma)" via --secret flag without a value Oddly, this seems to fail when run locally in zsh, but when run in a different shell in CI (bash, via docker using earthly/earthly), I don't see this error from earthly. So this may be down to shell behavior rather than something to do with earthly.

      Nevertheless, I'll ask here anyway: what's the correct way to set a secret value that contains a comma? Can it reliably be done with the CLI option --secret?