You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am pretty sure this behavior is inconsistent with the documentation. Two profiles, each with the same variables set to different values in individual env_files that are scoped to the correct profile are being loaded in the order in which they appear in the array, regardless of what profile is set on the command line. This seems to contradict the sentence here
Load global environment files defined in the env_files attribute.
> $ cargo make --profile local env-test
[cargo-make] INFO - cargo make 0.37.16
[cargo-make] INFO - Calling cargo metadata to extract project info
[cargo-make] INFO - Cargo metadata done
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: env-test
[cargo-make] INFO - Profile: local
[cargo-make] INFO - Running Task: env-test
local
postgres://asdf:asdf1234!@dockerhost:5438/my_db?sslmode=disable
postgres://asdf:asdf1234!@dockerhost:5438/my_db_1731714400?sslmode=disable
[cargo-make] INFO - Build Done in 2.25 seconds.
> $ cargo make --profile cicd env-test
[cargo-make] INFO - cargo make 0.37.16
[cargo-make] INFO - Calling cargo metadata to extract project info
[cargo-make] INFO - Cargo metadata done
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: env-test
[cargo-make] INFO - Profile: cicd
[cargo-make] INFO - Running Task: env-test
cicd
postgres://asdf:asdf1234!@dockerhost:5438/my_db?sslmode=disable
postgres://asdf:asdf1234!@dockerhost:5438/my_db_1731714628?sslmode=disable
[cargo-make] INFO - Build Done in 2.40 seconds.
The host:port is incorrect for the chosen profile; it should be postgres:5432.
If I change the order of how they appear in env_files, it echoes values from cicd.env. While the documentation does say,
Paths to environment files can also be defined globally in the env_files key of the Makefile.toml, which will be loaded in the order they are defined.
given the wording in the section below that on profile-scoped env_files, I expect that the presence of a --profile would make the ordering irrelevant, as it should only load something scoped to the profile specified or an env_file without a profile.
The text was updated successfully, but these errors were encountered:
Describe The Bug
I am pretty sure this behavior is inconsistent with the documentation. Two profiles, each with the same variables set to different values in individual
env_files
that are scoped to the correct profile are being loaded in the order in which they appear in the array, regardless of what profile is set on the command line. This seems to contradict the sentence herewhen taken together with the sentence here
To Reproduce
I have two profiles, say,
cicd
andlocal
. They have scoped env files:These declare the same environment variables but with different values:
Then I need to do some manipulation of these to define environment variables needed for some tasks that can run for either profile, e.g.,
where I've got these global blocks:
I have the task
Output:
The host:port is incorrect for the chosen profile; it should be
postgres:5432
.If I change the order of how they appear in
env_files
, it echoes values fromcicd.env
. While the documentation does say,given the wording in the section below that on profile-scoped
env_files
, I expect that the presence of a--profile
would make the ordering irrelevant, as it should only load something scoped to the profile specified or an env_file without a profile.The text was updated successfully, but these errors were encountered: