- Issue created by @mondrake
- 🇪🇸Spain fjgarlin
Adding context as per why this issue is in core.
The environment variable is there and is defined, but it just seems to be ignored by "run-tests.sh" script. - 🇪🇸Spain fjgarlin
It might be related to the same reason why we need to pass the "mink" variables in GitLab CI (and DrupalCI).
sudo MINK_DRIVER_ARGS_WEBDRIVER="$MINK_DRIVER_ARGS_WEBDRIVER" ...
- 🇬🇧United Kingdom longwave UK
I think this is because we use
sudo
to run the tests aswww-data
and it doesn't pass on env vars by default. I think we have three options:- Add
SYMFONY_DEPRECATIONS_HELPER
to the sudo line alongsideMINK_DRIVER_ARGS_WEBDRIVER
- Switch to using
sudo -E
to pass all environment variables down - Stop using sudo entirely, we are in throwaway containers so does it matter if the tests run as root?
- Add
- 🇮🇹Italy mondrake 🇮🇹
- 🇪🇸Spain fjgarlin
Now that we know the exact reason for the issue, I think the fix actually belongs to the "GitLab Templates" project, so moving there where I can take care of it.
Thanks for creating the issue and for the quick response.
- @fjgarlin opened merge request.
- Status changed to Needs review
almost 2 years ago 5:27pm 8 November 2023 - 🇪🇸Spain fjgarlin
I went with option 2 suggested in #4, purely because it was easier. Ideally we can do 3 but I'd probably do it in a separate issue and make sure that both contrib and core use it this way.
MR is here for review: https://git.drupalcode.org/project/gitlab_templates/-/merge_requests/82/...
You can test adding this to your
.gitlab-ci.yml
file:- project: issue/gitlab_templates-3400218 ref: 3400218-env-variables-to-phpunit
- 🇬🇧United Kingdom longwave UK
Core has some separate jobs that use sudo so we will need a duplicate issue over there.
- 🇪🇸Spain fjgarlin
Tried option 3 from #4 but that somehow required the sudo password and didn't work: https://git.drupalcode.org/project/image_effects/-/pipelines/46377
I went with option 1 from #4 and that worked well:
- Non concurrent: https://git.drupalcode.org/issue/image_effects-3400245/-/pipelines/46587
- Concurrent: https://git.drupalcode.org/issue/image_effects-3400245/-/pipelines/46608So, for this issue, I’m going with the minimum changes to make it work and then I’ll create a follow-up issue to try to remove sudo altogether. Once we achieve that here we can do the same for core (one issue at a time).
This one is still ready for review.
- 🇪🇸Spain fjgarlin
Child issue ✨ Do not run commands as other user as we lose env variables Active
- Status changed to RTBC
almost 2 years ago 9:11am 9 November 2023 - 🇮🇹Italy mondrake 🇮🇹
Yep, it works, thanksa lot @fjgarlin!
Minimum change here, removal of sudo usage is bigger story.
-
fjgarlin →
committed a786721a on 1.0.x
Issue #3400218 by fjgarlin, mondrake, longwave: [GitlabCI] run-tests.sh...
-
fjgarlin →
committed a786721a on 1.0.x
- Status changed to Fixed
almost 2 years ago 9:20am 9 November 2023 - 🇪🇸Spain fjgarlin
Merged and marked as fixed! Thanks for reporting and for the suggestions.
- 🇧🇪Belgium wim leers Ghent 🇧🇪🇪🇺
AFAICT this did not actually work? See #3400979-11: Is SYMFONY_DEPRECATIONS_HELPER: weak correct for contrib deprecation testing needs? → .
- 🇪🇸Spain fjgarlin
I commented on the other issue. The fix here did work (see the line I linked where we see the command being run as an output line), but the value passed wasn't probably the right one "weak", which is exactly what the other issue is about.
Automatically closed - issue fixed for 2 weeks with no activity.