Skip to content

Change the task compiler logic to allow resolving of environment variables.#1177

Merged
veewee merged 1 commit into
phpro:v2.xfrom
veewee:env-aware-task-compiler
Jul 25, 2025
Merged

Change the task compiler logic to allow resolving of environment variables.#1177
veewee merged 1 commit into
phpro:v2.xfrom
veewee:env-aware-task-compiler

Conversation

@veewee

@veewee veewee commented Jul 16, 2025

Copy link
Copy Markdown
Contributor
Q A
Branch master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Documented? no
Fixed tickets #1146

Fixes #1146

This allows for task configurations to resolve environment variables.
Example:

grumphp:
    tasks:
        phpunit:
          testsuite: "%env(string:PHPUNIT_TESTSUITE)%"
          metadata:
            enabled: '%env(bool:PHPUNIT_ENABLED)%'
PHPUNIT_TESTSUITE=Foo PHPUNIT_ENABLED=1 ./bin/grumphp run

or, you can make it work with environment configurations:

grumphp:
  environment:
    variables:
      PHPUNIT_ENABLED: "1"
      PHPUNIT_TESTSUITE: "Foo"

@veewee veewee marked this pull request as draft July 16, 2025 19:40
@veewee veewee force-pushed the env-aware-task-compiler branch from 662f7c3 to f3181d0 Compare July 16, 2025 19:47
Comment thread src/Configuration/ContainerFactory.php Outdated
Comment thread src/Configuration/Resolver/TaskConfigResolver.php Outdated
Comment thread src/Configuration/Resolver/TaskConfigResolver.php Outdated
@veewee veewee force-pushed the env-aware-task-compiler branch from f3181d0 to d604cc2 Compare July 25, 2025 07:18
@veewee veewee force-pushed the env-aware-task-compiler branch from d604cc2 to a0202ce Compare July 25, 2025 07:24
@veewee

veewee commented Jul 25, 2025

Copy link
Copy Markdown
Contributor Author

@kira0269, Thanks for your comments;

In this PR, I focused on getting the environment variables working inside the task configurations.
I agree that some parts during bootstrapping Grumphp or configuring the tasks could be improved.
Since it works right now and I don't want to reinvent the wheel with no real gain, I'm not sure it's worth the time or trouble to work on this.

Anyways, thanks for your feedback and for figuring out how to solve the issue :)

@veewee veewee marked this pull request as ready for review July 25, 2025 08:28
@veewee veewee changed the title [WIP] Change the task compiler logic to allow resolving of environment variables. Change the task compiler logic to allow resolving of environment variables. Jul 25, 2025
@veewee veewee merged commit 786544b into phpro:v2.x Jul 25, 2025
26 checks passed
@oallain

oallain commented Jul 25, 2025

Copy link
Copy Markdown
Contributor

Thanks for that @veewee 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Env variables don't get expanded in task definitions

3 participants