The import directive in stacker.yaml files is deprecated. It is replaced by imports (plural).
Support for import will not be present in any stacker release made after 2025-01-01.
The import directive contained all the functionality of the imports directive in stacker releases up until 0.4.0 and initial release of the 1.0 branch. 1.0 pre-releases contain a warning on use of import. Users must migrate to imports directive.
Migration path
In order to change from import to imports the user will:
change use of import in stacker.yaml files to imports
change reference to imported items from within a run section from /stacker/<path> to /stacker/imports/<path>.
As an example, consider this old stacker-old.yaml file:
The reason behind the change from import to imports was to be consistent with other stacker top level directives that contained a dictionary or list (binds, labels).
The more invasive change of /stacker to /stacker/imports was necessary to provide a clean namespace for stacker inside a container during layer build. As stacker grew more functionality, it needed to be able to utilize the /stacker namespace safely without colliding with user-provided input. With user provided paths in /stacker, this was not possible.
As an example of this, stacker now creates /stacker/bin/ directory for its own use. If a user's stacker.yaml file included an import of bin/, then stacker would collide on that namespace. Rather than put restrictions on filenames or paths that a user could import, stacker confines those imports to /stacker/imports and gives the user full control of that namespace.
Deprecation of
import
directiveThe
import
directive instacker.yaml
files is deprecated. It is replaced byimports
(plural).Support for
import
will not be present in any stacker release made after 2025-01-01.The
import
directive contained all the functionality of theimports
directive in stacker releases up until 0.4.0 and initial release of the 1.0 branch. 1.0 pre-releases contain a warning on use ofimport
. Users must migrate toimports
directive.Migration path
In order to change from
import
toimports
the user will:import
in stacker.yaml files toimports
run
section from/stacker/<path>
to/stacker/imports/<path>
.As an example, consider this old
stacker-old.yaml
file:Building the above
stacker-old.yaml
file will give a deprecation warning. To useimports
, the newstacker.yaml
would look like this:The changes are highlighted in this diff:
Reason for change
The reason behind the change from
import
toimports
was to be consistent with other stacker top level directives that contained a dictionary or list (binds
,labels
).The more invasive change of
/stacker
to/stacker/imports
was necessary to provide a clean namespace forstacker
inside a container during layer build. Asstacker
grew more functionality, it needed to be able to utilize the/stacker
namespace safely without colliding with user-provided input. With user provided paths in/stacker
, this was not possible.As an example of this,
stacker
now creates/stacker/bin/
directory for its own use. If a user's stacker.yaml file included animport
ofbin/
, then stacker would collide on that namespace. Rather than put restrictions on filenames or paths that a user could import, stacker confines those imports to/stacker/imports
and gives the user full control of that namespace.