Skip to content

patch: add bld support in snap builds - #380

Closed
skourta wants to merge 1 commit into
canonical:mainfrom
skourta:sd-snap-builds
Closed

skourta wants to merge 1 commit into
canonical:mainfrom
skourta:sd-snap-builds

Conversation

@skourta

@skourta skourta commented Aug 10, 2026

Copy link
Copy Markdown

Adds optional sd build support to the build_snap.yaml reusable workflow. When enabled, the workflow installs craft-sd and bld and exposes the CI / CRAFT_SD_ENV environment variables to the snapcraft pack step so artifacts can be pulled from the correct environment.

Context

  • This support is opt-in via a new sd-build input (default false), so existing consumers of the workflow are unaffected.

Changes

  • New inputs in .github/workflows/build_snap.yaml:
    • sd-build (boolean, default false) — installs the required build tools (craft-sd from latest/beta, bld from edge) when true.
    • craft_sd_env (string, default production) — the environment to pull artifacts from. Only used when sd-build is true.
  • New step Set up sd build environment (gated on inputs.sd-build) that installs the craft-sd and bld snaps.
  • Pack step env now sets:
    • CI to 1 when sd-build is enabled (empty otherwise) (hack to make arm builds work as well).
    • CRAFT_SD_ENV to inputs.craft_sd_env when sd-build is enabled (empty otherwise).
  • Minor whitespace/quote style cleanups in the same file (trailing-space removal, single→double quotes for the matrix job name, comment alignment).

Backward compatibility

Fully backward compatible: the new inputs default to false / production, so workflows that do not set sd-build behave exactly as before — no SD tools are installed and no extra env vars are passed to snapcraft.

Testing

Tested here.

@Gu1nness Gu1nness left a comment

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.

All good.
Suggestion for the craft_sd_env to make it better but approving already on the current implementation that does the job.

Comment on lines +62 to +67
craft_sd_env:
description: |
the env to use to pull artifacts from
This is only used if `sd-build` is true.
default: production
type: string

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.

I would use the type choice here to limit the available environments.
There are only 3 possible values so let's enforce it.

Suggested change
craft_sd_env:
description: |
the env to use to pull artifacts from
This is only used if `sd-build` is true.
default: production
type: string
craft_sd_env:
description: |
the env to use to pull artifacts from
This is only used if `sd-build` is true.
default: production
type: choice
options:
- prod
- production
- staging

SNAPCRAFT_BUILD_INFO: 1
VAR_PLATFORM: ${{ matrix.platform.name }}
CI: ${{ inputs.sd-build && 1 || '' }}
CRAFT_SD_ENV: ${{ inputs.sd-build && inputs.craft_sd_env || '' }}

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.

Nit / Non blocking: Although this works, I think this is not easy to understand that it does.
Any idea to make it more understandable ?

@carlcsaposs-canonical carlcsaposs-canonical left a comment

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.

https://chat.canonical.com/canonical/pl/ozg9sf9up3g88ysrw39jqgppay (moved to Mattermost since discussion contains some non-public information)

@skourta

skourta commented Sep 3, 2026

Copy link
Copy Markdown
Author

We chose a different approach. Check valkey-artifacts for details.

@skourta skourta closed this Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants