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:
|
||||
- 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:
|
||||
app: "gromacs"
|
||||
mpi: "mpich"
|
||||
|
||||
A detailed description of the options available can be found in the
|
||||
:ref:`container_config_options` section.
|
||||
A detailed description of the options available can be found in the :ref:`container_config_options` section.
|
||||
|
||||
-------------------
|
||||
Setting Base Images
|
||||
|
@ -272,13 +272,6 @@ def _os_pkg_manager(self):
|
||||
raise spack.error.SpackError(msg)
|
||||
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
|
||||
def labels(self):
|
||||
return self.container_config.get("labels", {})
|
||||
|
@ -68,12 +68,6 @@
|
||||
"labels": {"type": "object"},
|
||||
# Use a custom template to render the recipe
|
||||
"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
|
||||
"singularity": {
|
||||
"type": "object",
|
||||
@ -89,15 +83,6 @@
|
||||
"docker": {"type": "object", "additionalProperties": False, "default": {}},
|
||||
"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}
|
||||
|
@ -82,23 +82,6 @@ def test_strip_is_set_from_config(minimal_configuration):
|
||||
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):
|
||||
"""Test setting custom base images from configuration file"""
|
||||
minimal_configuration["spack"]["container"]["images"] = {
|
||||
|
@ -39,9 +39,6 @@ RUN find -L {{ paths.view }}/* -type f -exec readlink -f '{}' \; | \
|
||||
RUN cd {{ paths.environment }} && \
|
||||
spack env activate --sh -d . > activate.sh
|
||||
|
||||
{% if extra_instructions.build %}
|
||||
{{ extra_instructions.build }}
|
||||
{% endif %}
|
||||
{% endblock build_stage %}
|
||||
{% 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', ' ') }} \
|
||||
&& {{ os_packages_final.clean }}
|
||||
{% endif %}
|
||||
{% if extra_instructions.final %}
|
||||
|
||||
{{ extra_instructions.final }}
|
||||
{% endif %}
|
||||
{% endblock final_stage %}
|
||||
{% for label, value in labels.items() %}
|
||||
LABEL "{{ label }}"="{{ value }}"
|
||||
|
@ -39,9 +39,6 @@ EOF
|
||||
grep 'x-executable\|x-archive\|x-sharedlib' | \
|
||||
awk -F: '{print $1}' | xargs strip
|
||||
{% endif %}
|
||||
{% if extra_instructions.build %}
|
||||
{{ extra_instructions.build }}
|
||||
{% endif %}
|
||||
{% endblock build_stage %}
|
||||
{% if apps %}
|
||||
{% for application, help_text in apps.items() %}
|
||||
@ -80,9 +77,6 @@ Stage: final
|
||||
{% endif %}
|
||||
# Modify the environment without relying on sourcing shell specific files at startup
|
||||
cat {{ paths.environment }}/environment_modifications.sh >> $SINGULARITY_ENVIRONMENT
|
||||
{% if extra_instructions.final %}
|
||||
{{ extra_instructions.final }}
|
||||
{% endif %}
|
||||
{% endblock final_stage %}
|
||||
{% if runscript %}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user