Skip to content

Commit 532225d

Browse files
committed
cmdlib.sh: support manifest.yaml build_with_buildah key
We want to make sure that all of developers, CI and pipelines default to the same buildah vs legacy path. Let's make the config repo itself drive this. Support a new `.metadata.build_with_buildah` key in `manifest.yaml` which, if set to true, will make `cosa build` automatically use the buildah path. Note the `COSA_BUILD_WITH_BUILDAH` env var is still supported and can be used to override the default either way (i.e., set to `0`, it will force the legacy path).
1 parent bb7443a commit 532225d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/cmdlib.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,24 @@ yaml2json() {
149149
}
150150

151151
should_build_with_buildah() {
152+
local variant manifest
152153
if [ -n "${COSA_BUILD_WITH_BUILDAH:-}" ]; then
153154
if [ "${COSA_BUILD_WITH_BUILDAH:-}" = 1 ]; then
154155
return 0
155156
else
156157
return 1
157158
fi
158159
fi
160+
# this slightly duplicates some logic in `prepare_build`, but meh...
161+
if [[ -f "src/config.json" ]]; then
162+
variant="$(jq --raw-output '."coreos-assembler.config-variant"' src/config.json)"
163+
manifest="src/config/manifest-${variant}.yaml"
164+
else
165+
manifest="src/config/manifest.yaml"
166+
fi
167+
if [ "$(yq .metadata.build_with_buildah "${manifest}")" = true ]; then
168+
return 0
169+
fi
159170
return 1
160171
}
161172

0 commit comments

Comments
 (0)