#[SOLVED] OS variable not replaced in .with_exec()

1 messages · Page 1 of 1 (latest)

tiny vault
#

Good morning

I've created an OS variable called DAGGER_STEP_CONF_FILE in my container and I try to run this command:

.with_exec(
    [
        "phpstan",
        "analyse",
        "--no-progress",
        "--memory-limit=2G",
        "--configuration=${DAGGER_STEP_CONF_FILE}",
    ]
)

and I got an error Project config file at path /app/src/${DAGGER_STEP_CONF_FILE} does not exist.

It was expected that ${DAGGER_STEP_CONF_FILE} was replaced by the value.

If I run a terminal (using .terminal()) then copy / paste the command phpstan analyse --no-progress --memory-limit=2G --configuration=${DAGGER_STEP_CONF_FILE} in the console, the program works fine i.e. phpstan is using my variable.

(Note: running printenv shows me the variable so, for sure, the variable exists and is correctly assigned)

My use case:
I'm using tools like phpstan, phan, rector, mypy, ... and I've a global folder where I put standard configuration files (let's say /global/.config/.phpstan.neon)
In each project I've, I can "override" the global configuration by creating a file .config/.phpstan.neonin my project.
So, when running a tool, I should check:

  1. Is there a .config/.phpstan.neon file in my project? If so, I use it
  2. If not, I use the global /global/.config/.phpstan.neon
    I've a Bash script for this. The Bash will make the check and will create an OS variable called DAGGER_STEP_CONF_FILE with the path to the configuration file.
    If someone has a better approach, I'll be happy to read it.

Thanks

teal minnow
tiny vault
#

Oh, so simple. Sorry, didn't know about expand=True (language was Python)