diff --git a/doc/source/admin/jobs.md b/doc/source/admin/jobs.md
index dcb7f75a3f74..e9eec349f53b 100644
--- a/doc/source/admin/jobs.md
+++ b/doc/source/admin/jobs.md
@@ -85,6 +85,14 @@ exec
raw
: Disable auto-quoting of values when setting up environment variables.
+For containerized execution the environment setup done by ``file`` and ``exec`` ``env`` tags will
+not be available in the container, but only to the pre-and-post-tool-execution job environment.
+Instead, for containerized destinations variables that should only be available in the container
+can be set with ``VALUE`` and
+``VALUE``, respectively.
+
+### Job resubmission
+
Destinations may also specify other destinations (which may be dynamic destinations) that jobs should be resubmitted to if they fail to complete at the first destination for certain reasons. This is done with the `` tag contained within a ``.
condition
diff --git a/test/functional/tools/job_environment_default.xml b/test/functional/tools/job_environment_default.xml
index f901e9c273ae..868a3a07c540 100644
--- a/test/functional/tools/job_environment_default.xml
+++ b/test/functional/tools/job_environment_default.xml
@@ -12,6 +12,8 @@ echo \$(pwd) > '$pwd' &&
echo "\$HOME" > '$home' &&
echo "\$TMP" > '$tmp' &&
echo "\$SOME_ENV_VAR" > '$some_env_var' &&
+echo "\${JOBCONF_ENV_VAR:-UNSET}" > '$jobconf_env_var' &&
+echo "\${CONTAINER_ENV_VAR:-UNSET}" > '$container_env_var' &&
touch "\$_GALAXY_JOB_TMP_DIR/tmp_test" &&
touch "\$HOME/home_test" &&
@@ -28,6 +30,8 @@ touch "\${TMPDIR:-/tmp}/job_tmpdir"
+
+
diff --git a/test/functional/tools/job_environment_default_legacy.xml b/test/functional/tools/job_environment_default_legacy.xml
index 2e2782d52944..c446b5682c21 100644
--- a/test/functional/tools/job_environment_default_legacy.xml
+++ b/test/functional/tools/job_environment_default_legacy.xml
@@ -10,6 +10,8 @@ echo \$(pwd) > '$pwd' &&
echo "\$HOME" > '$home' &&
echo "\$TMP" > '$tmp' &&
echo "\$SOME_ENV_VAR" > '$some_env_var' &&
+echo "\${JOBCONF_ENV_VAR:-UNSET}" > '$jobconf_env_var' &&
+echo "\${CONTAINER_ENV_VAR:-UNSET}" > '$container_env_var' &&
touch "\${TMP:-/tmp}/job_tmp" &&
touch "\${TEMP:-/tmp}/job_temp" &&
@@ -24,6 +26,8 @@ touch "\${TMPDIR:-/tmp}/job_tmpdir"
+
+
diff --git a/test/functional/tools/job_environment_explicit_isolated_home.xml b/test/functional/tools/job_environment_explicit_isolated_home.xml
index 906a8cfdd62b..db0d045a9748 100644
--- a/test/functional/tools/job_environment_explicit_isolated_home.xml
+++ b/test/functional/tools/job_environment_explicit_isolated_home.xml
@@ -10,6 +10,8 @@ echo \$(pwd) > '$pwd' &&
echo "\$HOME" > '$home' &&
echo "\$TMP" > '$tmp' &&
echo "\$SOME_ENV_VAR" > '$some_env_var' &&
+echo "\${JOBCONF_ENV_VAR:-UNSET}" > '$jobconf_env_var' &&
+echo "\${CONTAINER_ENV_VAR:-UNSET}" > '$container_env_var' &&
touch "\${TMP:-/tmp}/job_tmp" &&
touch "\${TEMP:-/tmp}/job_temp" &&
@@ -24,6 +26,8 @@ touch "\${TMPDIR:-/tmp}/job_tmpdir"
+
+
diff --git a/test/functional/tools/job_environment_explicit_shared_home.xml b/test/functional/tools/job_environment_explicit_shared_home.xml
index 9b24267df664..537a0d73ab84 100644
--- a/test/functional/tools/job_environment_explicit_shared_home.xml
+++ b/test/functional/tools/job_environment_explicit_shared_home.xml
@@ -10,6 +10,8 @@ echo \$(pwd) > '$pwd' &&
echo "\$HOME" > '$home' &&
echo "\$TMP" > '$tmp' &&
echo "\$SOME_ENV_VAR" > '$some_env_var' &&
+echo "\${JOBCONF_ENV_VAR:-UNSET}" > '$jobconf_env_var' &&
+echo "\${CONTAINER_ENV_VAR:-UNSET}" > '$container_env_var' &&
touch "\${TMP:-/tmp}/job_tmp" &&
touch "\${TEMP:-/tmp}/job_temp" &&
@@ -24,6 +26,8 @@ touch "\${TMPDIR:-/tmp}/job_tmpdir"
+
+
diff --git a/test/integration/dockerized_job_conf.yml b/test/integration/dockerized_job_conf.yml
index 4138f4a2f056..5b17eb57ae51 100644
--- a/test/integration/dockerized_job_conf.yml
+++ b/test/integration/dockerized_job_conf.yml
@@ -9,11 +9,19 @@ execution:
environments:
local_docker:
runner: local
+ env:
+ - name: 'JOBCONF_ENV_VAR'
+ value: 'YEAH'
+ - execute: 'true' # just check that this does not confuse env setup
docker_enabled: true
+ docker_env_CONTAINER_ENV_VAR: "CONTAINER_VAR_VALUE"
require_container: true
tmp_dir: '$(mktemp -d)'
local_docker_inline_container_resolvers:
runner: local
+ env:
+ - name: 'JOBCONF_ENV_VAR'
+ value: 'YEAH'
docker_enabled: true
container_resolvers:
- type: fallback
diff --git a/test/integration/simple_job_conf.xml b/test/integration/simple_job_conf.xml
index 032c2b0fec16..649170f2ff64 100644
--- a/test/integration/simple_job_conf.xml
+++ b/test/integration/simple_job_conf.xml
@@ -10,6 +10,9 @@
+ YEAH
+ CONTAINER_VAR_VALUE
+ CONTAINER_VAR_VALUE
diff --git a/test/integration/singularity_job_conf.yml b/test/integration/singularity_job_conf.yml
index 8b2a4910ac09..6f5e4f182c86 100644
--- a/test/integration/singularity_job_conf.yml
+++ b/test/integration/singularity_job_conf.yml
@@ -9,7 +9,11 @@ execution:
environments:
local_singularity:
runner: local
+ env:
+ - name: 'JOBCONF_ENV_VAR'
+ value: 'YEAH'
singularity_enabled: true
+ singularity_env_CONTAINER_ENV_VAR: "CONTAINER_VAR_VALUE"
# Since tests run in /tmp/ , we apparently need to forbid the default mounting of /tmp
singularity_run_extra_arguments: '--no-mount tmp'
require_container: true
diff --git a/test/integration/test_containerized_jobs.py b/test/integration/test_containerized_jobs.py
index 2254b79a8a5a..75d324ee1a0e 100644
--- a/test/integration/test_containerized_jobs.py
+++ b/test/integration/test_containerized_jobs.py
@@ -137,6 +137,8 @@ def test_container_job_environment(self) -> None:
assert job_env.pwd.endswith("/working")
assert job_env.home.startswith(self.jobs_directory)
assert job_env.home.endswith("/home")
+ assert job_env.jobconf_env_var == "UNSET"
+ assert job_env.container_env_var == "CONTAINER_VAR_VALUE"
def test_container_job_environment_legacy(self) -> None:
"""
@@ -154,6 +156,8 @@ def test_container_job_environment_legacy(self) -> None:
assert job_env.pwd.endswith("/working")
assert not job_env.home.startswith(self.jobs_directory)
assert not job_env.home.endswith("/home")
+ assert job_env.jobconf_env_var == "UNSET"
+ assert job_env.container_env_var == "CONTAINER_VAR_VALUE"
def test_container_job_environment_explicit_shared_home(self) -> None:
"""
@@ -166,6 +170,8 @@ def test_container_job_environment_explicit_shared_home(self) -> None:
assert job_env.pwd.endswith("/working")
assert not job_env.home.startswith(self.jobs_directory)
assert not job_env.home.endswith("/home"), job_env.home
+ assert job_env.jobconf_env_var == "UNSET"
+ assert job_env.container_env_var == "CONTAINER_VAR_VALUE"
def test_container_job_environment_explicit_isolated_home(self) -> None:
"""
@@ -178,6 +184,8 @@ def test_container_job_environment_explicit_isolated_home(self) -> None:
assert job_env.pwd.endswith("/working")
assert job_env.home.startswith(self.jobs_directory)
assert job_env.home.endswith("/home"), job_env.home
+ assert job_env.jobconf_env_var == "UNSET"
+ assert job_env.container_env_var == "CONTAINER_VAR_VALUE"
def test_build_mulled(self) -> None:
"""
diff --git a/test/integration/test_job_environments.py b/test/integration/test_job_environments.py
index 1de561d8239c..ecd6563ecda8 100644
--- a/test/integration/test_job_environments.py
+++ b/test/integration/test_job_environments.py
@@ -26,6 +26,8 @@
"home",
"tmp",
"some_env",
+ "jobconf_env_var",
+ "container_env_var",
],
)
@@ -60,7 +62,9 @@ def _environment_properties(self, history_id):
home = self.dataset_populator.get_history_dataset_content(history_id, hid=4).strip()
tmp = self.dataset_populator.get_history_dataset_content(history_id, hid=5).strip()
some_env = self.dataset_populator.get_history_dataset_content(history_id, hid=6).strip()
- return JobEnvironmentProperties(user_id, group_id, pwd, home, tmp, some_env)
+ jobconf_env_var = self.dataset_populator.get_history_dataset_content(history_id, hid=7).strip()
+ container_env_var = self.dataset_populator.get_history_dataset_content(history_id, hid=8).strip()
+ return JobEnvironmentProperties(user_id, group_id, pwd, home, tmp, some_env, jobconf_env_var, container_env_var)
def _check_completed_history(self, history_id):
"""Extension point that lets subclasses investigate the completed job."""
@@ -88,6 +92,12 @@ def test_default_environment_1801(self):
assert job_env.pwd.startswith(self.jobs_directory)
assert job_env.pwd.endswith("/working")
+ # check that env variables job
+ # - variables defined via env in job_conf are set
+ # - container specific vars via are not
+ assert job_env.jobconf_env_var == "YEAH"
+ assert job_env.container_env_var == "UNSET"
+
# Newer tools get isolated home directories in job_directory/home
job_directory = os.path.dirname(job_env.pwd)
assert job_env.home == os.path.join(job_directory, "home"), job_env.home