Conversation
Gu1nness
left a comment
There was a problem hiding this comment.
All good.
Suggestion for the craft_sd_env to make it better but approving already on the current implementation that does the job.
| 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 |
There was a problem hiding this comment.
I would use the type choice here to limit the available environments.
There are only 3 possible values so let's enforce it.
| 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 || '' }} |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
https://chat.canonical.com/canonical/pl/ozg9sf9up3g88ysrw39jqgppay (moved to Mattermost since discussion contains some non-public information)
|
We chose a different approach. Check valkey-artifacts for details. |
Adds optional sd build support to the
build_snap.yamlreusable workflow. When enabled, the workflow installscraft-sdandbldand exposes theCI/CRAFT_SD_ENVenvironment variables to the snapcraft pack step so artifacts can be pulled from the correct environment.Context
sd-buildinput (defaultfalse), so existing consumers of the workflow are unaffected.Changes
.github/workflows/build_snap.yaml:sd-build(boolean, defaultfalse) — installs the required build tools (craft-sdfromlatest/beta,bldfromedge) whentrue.craft_sd_env(string, defaultproduction) — the environment to pull artifacts from. Only used whensd-buildistrue.Set up sd build environment(gated oninputs.sd-build) that installs thecraft-sdandbldsnaps.CIto1whensd-buildis enabled (empty otherwise) (hack to make arm builds work as well).CRAFT_SD_ENVtoinputs.craft_sd_envwhensd-buildis enabled (empty otherwise).Backward compatibility
Fully backward compatible: the new inputs default to
false/production, so workflows that do not setsd-buildbehave exactly as before — no SD tools are installed and no extra env vars are passed to snapcraft.Testing
Tested here.