singularity icon indicating copy to clipboard operation
singularity copied to clipboard

Environment not set for tests during build

Open Flamefire opened this issue 5 years ago • 8 comments

Version of Singularity:

3.2.1

Expected behavior

Tests run after build behave the same as tests run with singularity test

Actual behavior

Environment as defined by %environment is not defined so test commands fail due to e.g. PATH not set

Steps to reproduce behavior

Bootstrap: docker
From: ubuntu
%environment
export FOO=bar
%test
[ "${FOO}" = "bar" ]

singularity build test.sif test.def -- fails
singulart build -T test.sif test.def && singularity test test.sif -- passes

Flamefire avatar May 29 '19 08:05 Flamefire

This seems like a bug to me as well.

jscook2345 avatar May 30 '19 19:05 jscook2345

I opened (https://github.com/sylabs/singularity-userdocs/issues/184) to help better determine the ordering of this as well. Thanks for the report @Flamefire !

jscook2345 avatar May 30 '19 19:05 jscook2345

@Flamefire @jscook2345 This is intended behavior, environment scripts are not sourced during the build, but are sourced when singularity test is executed

ikaneshiro avatar May 31 '19 16:05 ikaneshiro

This is intended behavior, environment scripts are not sourced during the build, but are sourced when singularity test is executed

I can't believe this is fully thought through. Why would it be wanted, that the tests run at the end of a build are executed in a different environment than when executed with singularity test? This would mean that for reliable tests one would need to do sudo singularity build [...] && singularity test [...]

Flamefire avatar Jun 03 '19 07:06 Flamefire

Hello,

This is a templated response that is being sent out to all open issues. We are working hard on 'rebuilding' the Singularity community, and a major task on the agenda is finding out what issues are still outstanding.

Please consider the following:

  1. Is this issue a duplicate, or has it been fixed/implemented since being added?
  2. Is the issue still relevant to the current state of Singularity's functionality?
  3. Would you like to continue discussing this issue or feature request?

Thanks, Carter

carterpeel avatar May 15 '21 16:05 carterpeel

This issue has been automatically marked as stale because it has not had activity in over 60 days. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 14 '21 16:07 stale[bot]

@Flamefire Still getting this problem ? Have this been solved already ? If yes, what work around have you followed and applied ?

We're looking into the issue carefully, soon will bring to community and discuss ways to better solve as well address this. Thankyou for keeping the interest in the subject.

pedroalvesbatista avatar Jul 15 '21 23:07 pedroalvesbatista

I don't really use this anymore, so I can't tell. But there is a reproducer in the OP, so it is easy to check.

Flamefire avatar Jul 16 '21 06:07 Flamefire

Singularity repo is now retired as the code base is now moved to Apptainer. We are closing all the old issues under the old Singularity repo. For further assistance please open a new issue under the new Apptainer repo. Thanks for your support.

kmuriki avatar Oct 17 '22 03:10 kmuriki