Plan environment file is not being sourced after `prepare` and `execute` in `tmt-try`
The documentation states file located at TMT_PLAN_ENVIRONMENT_FILE should be sourced after steps prepare and execute.
When running from tmt try, this doesn't happen.
Steps to reproduce:
/plan:
provision:
how: local
discover:
how: fmf
prepare:
how: shell
script: echo "VAR=hello" >> $TMT_PLAN_ENVIRONMENT_FILE
execute:
how: tmt
/test:
framework: shell
test: test "${VAR}" = "hello"
the plan succeeds when running tmt run plans -n plan,
but fails when running as tmt try -p plan
Thanks for the report and sorry for the late response. I've tried your reproducer but it seems to be working just fine:
> tmt --feeling-safe try --plan plan
/var/tmp/tmt/run-025
Let's try /test with /plan.
/plan
discover
how: fmf
order: 50
directory: /tmp/3315
summary: 1 test selected
/test
provision
queued provision.provision task #1: default-0
provision.provision task #1: default-0
how: local
order: 50
primary address: localhost
primary address: localhost
topology address
multihost name: default-0
arch: x86_64
distro: Fedora Linux 41 (Workstation Edition)
kernel: 6.16.7-100.fc41.x86_64
package manager: dnf5
selinux: yes
systemd: yes
rsync: yes
is superuser: no
is_container: no
summary: 1 guest provisioned
prepare
queued push task #1: push to default-0
push task #1: push to default-0
queued prepare task #1: essential-requires on default-0
queued prepare task #2: default-0 on default-0
prepare task #1: essential-requires on default-0
how: install
summary: Install essential required packages
name: essential-requires
order: 30
where: default-0
package: 1 package requested
/usr/bin/flock
cmd: rpm -q --whatprovides /usr/bin/flock || sudo dnf5 install -y /usr/bin/flock
out: util-linux-core-2.40.4-1.fc41.x86_64
prepare task #2: default-0 on default-0
how: shell
order: 50
overview: 1 script found
script: echo "VAR=hello" >> /var/tmp/tmt/run-025/plan/data/variables.env
cmd: /var/tmp/tmt/run-025/plan/tree/tmt-prepare-wrapper.sh-default-0-default-0
queued pull task #1: pull from default-0
pull task #1: pull from default-0
summary: 2 preparations applied
execute
queued execute task #1: default-0 on default-0
execute task #1: default-0 on default-0
how: tmt
order: 50
ignore-duration: false
exit-first: false
test: /test
warn: Ignoring requested duration, not supported in interactive mode.
duration limit: None
cmd: test "${VAR}" = "hello"
00:00:00 pass /test (on default-0) [1/1]
summary: 1 test executed
The tmt try command by uses by default the user plan from the config or the "default plan" if no user plan is defined. @xduda, could you try running tmt try --plan plan? It should pick your plan from the local repository.
Seems that the documentation should be extended to explicitly mention this. A new section about the tmt try command should also be added to the guide.
@xduda Could you look into this please?
@therazix It's pretty old, might not be relevant anymore. Can look into it at the end of the week
@xduda Please take a look if you have time.
@xduda we are closing this issue for now, but do let us know if you managed to look into this again. Also let us know about the status of #3316