Remove deprecated "extra_instructions" option for containers (#40365)
This commit is contained in:
parent
0fd2427d9b
commit
3935e047c6
@ -212,18 +212,12 @@ under the ``container`` attribute of environments:
|
|||||||
final:
|
final:
|
||||||
- libgomp
|
- libgomp
|
||||||
|
|
||||||
# Extra instructions
|
|
||||||
extra_instructions:
|
|
||||||
final: |
|
|
||||||
RUN echo 'export PS1="\[$(tput bold)\]\[$(tput setaf 1)\][gromacs]\[$(tput setaf 2)\]\u\[$(tput sgr0)\]:\w $ "' >> ~/.bashrc
|
|
||||||
|
|
||||||
# Labels for the image
|
# Labels for the image
|
||||||
labels:
|
labels:
|
||||||
app: "gromacs"
|
app: "gromacs"
|
||||||
mpi: "mpich"
|
mpi: "mpich"
|
||||||
|
|
||||||
A detailed description of the options available can be found in the
|
A detailed description of the options available can be found in the :ref:`container_config_options` section.
|
||||||
:ref:`container_config_options` section.
|
|
||||||
|
|
||||||
-------------------
|
-------------------
|
||||||
Setting Base Images
|
Setting Base Images
|
||||||
|
@ -272,13 +272,6 @@ def _os_pkg_manager(self):
|
|||||||
raise spack.error.SpackError(msg)
|
raise spack.error.SpackError(msg)
|
||||||
return os_pkg_manager
|
return os_pkg_manager
|
||||||
|
|
||||||
@tengine.context_property
|
|
||||||
def extra_instructions(self):
|
|
||||||
Extras = namedtuple("Extra", ["build", "final"])
|
|
||||||
extras = self.container_config.get("extra_instructions", {})
|
|
||||||
build, final = extras.get("build", None), extras.get("final", None)
|
|
||||||
return Extras(build=build, final=final)
|
|
||||||
|
|
||||||
@tengine.context_property
|
@tengine.context_property
|
||||||
def labels(self):
|
def labels(self):
|
||||||
return self.container_config.get("labels", {})
|
return self.container_config.get("labels", {})
|
||||||
|
@ -68,12 +68,6 @@
|
|||||||
"labels": {"type": "object"},
|
"labels": {"type": "object"},
|
||||||
# Use a custom template to render the recipe
|
# Use a custom template to render the recipe
|
||||||
"template": {"type": "string", "default": None},
|
"template": {"type": "string", "default": None},
|
||||||
# Add a custom extra section at the bottom of a stage
|
|
||||||
"extra_instructions": {
|
|
||||||
"type": "object",
|
|
||||||
"additionalProperties": False,
|
|
||||||
"properties": {"build": {"type": "string"}, "final": {"type": "string"}},
|
|
||||||
},
|
|
||||||
# Reserved for properties that are specific to each format
|
# Reserved for properties that are specific to each format
|
||||||
"singularity": {
|
"singularity": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
@ -89,15 +83,6 @@
|
|||||||
"docker": {"type": "object", "additionalProperties": False, "default": {}},
|
"docker": {"type": "object", "additionalProperties": False, "default": {}},
|
||||||
"depfile": {"type": "boolean", "default": False},
|
"depfile": {"type": "boolean", "default": False},
|
||||||
},
|
},
|
||||||
"deprecatedProperties": {
|
|
||||||
"properties": ["extra_instructions"],
|
|
||||||
"message": (
|
|
||||||
"container:extra_instructions has been deprecated and will be removed "
|
|
||||||
"in Spack v0.21. Set container:template appropriately to use custom Jinja2 "
|
|
||||||
"templates instead."
|
|
||||||
),
|
|
||||||
"error": False,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
properties = {"container": container_schema}
|
properties = {"container": container_schema}
|
||||||
|
@ -82,23 +82,6 @@ def test_strip_is_set_from_config(minimal_configuration):
|
|||||||
assert writer.strip is False
|
assert writer.strip is False
|
||||||
|
|
||||||
|
|
||||||
def test_extra_instructions_is_set_from_config(minimal_configuration):
|
|
||||||
writer = writers.create(minimal_configuration)
|
|
||||||
assert writer.extra_instructions == (None, None)
|
|
||||||
|
|
||||||
test_line = "RUN echo Hello world!"
|
|
||||||
e = minimal_configuration["spack"]["container"]
|
|
||||||
e["extra_instructions"] = {}
|
|
||||||
e["extra_instructions"]["build"] = test_line
|
|
||||||
writer = writers.create(minimal_configuration)
|
|
||||||
assert writer.extra_instructions == (test_line, None)
|
|
||||||
|
|
||||||
e["extra_instructions"]["final"] = test_line
|
|
||||||
del e["extra_instructions"]["build"]
|
|
||||||
writer = writers.create(minimal_configuration)
|
|
||||||
assert writer.extra_instructions == (None, test_line)
|
|
||||||
|
|
||||||
|
|
||||||
def test_custom_base_images(minimal_configuration):
|
def test_custom_base_images(minimal_configuration):
|
||||||
"""Test setting custom base images from configuration file"""
|
"""Test setting custom base images from configuration file"""
|
||||||
minimal_configuration["spack"]["container"]["images"] = {
|
minimal_configuration["spack"]["container"]["images"] = {
|
||||||
|
@ -39,9 +39,6 @@ RUN find -L {{ paths.view }}/* -type f -exec readlink -f '{}' \; | \
|
|||||||
RUN cd {{ paths.environment }} && \
|
RUN cd {{ paths.environment }} && \
|
||||||
spack env activate --sh -d . > activate.sh
|
spack env activate --sh -d . > activate.sh
|
||||||
|
|
||||||
{% if extra_instructions.build %}
|
|
||||||
{{ extra_instructions.build }}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock build_stage %}
|
{% endblock build_stage %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@ -70,10 +67,6 @@ RUN {% if os_package_update %}{{ os_packages_final.update }} \
|
|||||||
&& {% endif %}{{ os_packages_final.install }} {{ os_packages_final.list | join | replace('\n', ' ') }} \
|
&& {% endif %}{{ os_packages_final.install }} {{ os_packages_final.list | join | replace('\n', ' ') }} \
|
||||||
&& {{ os_packages_final.clean }}
|
&& {{ os_packages_final.clean }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if extra_instructions.final %}
|
|
||||||
|
|
||||||
{{ extra_instructions.final }}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock final_stage %}
|
{% endblock final_stage %}
|
||||||
{% for label, value in labels.items() %}
|
{% for label, value in labels.items() %}
|
||||||
LABEL "{{ label }}"="{{ value }}"
|
LABEL "{{ label }}"="{{ value }}"
|
||||||
|
@ -39,9 +39,6 @@ EOF
|
|||||||
grep 'x-executable\|x-archive\|x-sharedlib' | \
|
grep 'x-executable\|x-archive\|x-sharedlib' | \
|
||||||
awk -F: '{print $1}' | xargs strip
|
awk -F: '{print $1}' | xargs strip
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if extra_instructions.build %}
|
|
||||||
{{ extra_instructions.build }}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock build_stage %}
|
{% endblock build_stage %}
|
||||||
{% if apps %}
|
{% if apps %}
|
||||||
{% for application, help_text in apps.items() %}
|
{% for application, help_text in apps.items() %}
|
||||||
@ -80,9 +77,6 @@ Stage: final
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
# Modify the environment without relying on sourcing shell specific files at startup
|
# Modify the environment without relying on sourcing shell specific files at startup
|
||||||
cat {{ paths.environment }}/environment_modifications.sh >> $SINGULARITY_ENVIRONMENT
|
cat {{ paths.environment }}/environment_modifications.sh >> $SINGULARITY_ENVIRONMENT
|
||||||
{% if extra_instructions.final %}
|
|
||||||
{{ extra_instructions.final }}
|
|
||||||
{% endif %}
|
|
||||||
{% endblock final_stage %}
|
{% endblock final_stage %}
|
||||||
{% if runscript %}
|
{% if runscript %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user