Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions snapcraft/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1858,6 +1858,18 @@ class Project(models.Project):
Environment variables are set at runtime for all apps. To set an
environment variable for a particular app, use the ``environment`` key for
that ``app`` entry.

With SnapD 2.77 and higher, this key supports Bash parameter expansions:

- Override the current value with ``${VAR:+override}``
- Fall back to a value with ``${VAR:-fallback}``
- Copy another variable's value with ``${VAR:+$OTHER_VAR}``
- Fall back to another variable's value with ``${VAR:-$OTHER_VAR}``

Nested braces such as ``${VAR:+${OTHER_VAR}}`` aren't supported.

To ensure this feature is available, use the ``assumes`` key to require a
minimum version of snapd, for example ``assumes: [snapd2.77]``.
Comment on lines +1871 to +1872

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To ensure this feature is available, use the ``assumes`` key to require a
minimum version of snapd, for example ``assumes: [snapd2.77]``.
For parameter expansion, the ``assumes`` key must be set to a
minimum version of SnapD, such as ``[snapd2.77]``.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe... "If parameter expansion is used, it is paramount to set the assumes key to version 2.77 or later (such as assumes: [snapd2.77])".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the word "paramount" feels a little too glittery. I don't like the "such as" in Michael's suggestion either, because it feels a suggestion that you can pin it to whatever version you want, so long as you're pinning it at all.

How about:

Suggested change
To ensure this feature is available, use the ``assumes`` key to require a
minimum version of snapd, for example ``assumes: [snapd2.77]``.
Since this feature requires a minimum version of SnapD, use the ``assumes`` key to
constrain your snap to a supported SnapD version with ``assumes: [snapd2.77]``.

"""

build_packages: Grammar[list[str]] | None = pydantic.Field(
Expand Down
Loading