Skip to content

Commit b687e51

Browse files
committed
cmd-build-with-buildah: update meta.json with pkg/advisory diffs
This used to be done in the cmd-build path and some things depend on it, so let's add it back here. This also prints a diff so we'll see it in the logs in the pipeline, which can be useful.
1 parent aafbc3c commit b687e51

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/cmd-build-with-buildah

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ Usage: coreos-assembler build-with-buildah
2222
non-strict build.
2323
--skip-prune Skip pruning previous builds.
2424
--strict Only allow installing locked packages when using lockfiles.
25-
--parent-build=VERSION This option does nothing and is provided for backwards compatibility.
25+
--parent-build=VERSION The version that represents the parent to this build. Used for RPM diffs
26+
that get added to the meta.json
2627
--force Import a new build even if inputhash has not changed.
2728
EOF
2829
}
@@ -69,6 +70,7 @@ while true; do
6970
;;
7071
--parent-build)
7172
shift
73+
PARENT_BUILD=$1
7274
;;
7375
--force)
7476
FORCE=1
@@ -232,6 +234,19 @@ build_with_buildah() {
232234
/usr/lib/coreos-assembler/cmd-import "${final_ref}" ${SKIP_PRUNE:+--skip-prune}
233235
fi
234236

237+
# For the logs, print the RPM diff
238+
/usr/lib/coreos-assembler/cmd-diff \
239+
--rpms ${PARENT_BUILD:+--from=$PARENT_BUILD}
240+
241+
# For meta.json let's record the RPM diff and advisory diff information
242+
/usr/lib/coreos-assembler/cmd-diff \
243+
--rpms-json ${PARENT_BUILD:+--from=$PARENT_BUILD} |
244+
jq '{"pkgdiff": .pkgdiff, "advisories-diff": .advisories}' > ${tempdir}/diff.json
245+
/usr/lib/coreos-assembler/cmd-meta --build=${VERSION} \
246+
--skip-validation --artifact-json ${tempdir}/diff.json
247+
# Run a 'dump' now to perform schema validation since we skipped it above.
248+
/usr/lib/coreos-assembler/cmd-meta --dump --build=${VERSION} > /dev/null
249+
235250
rm -rf "${tempdir}"
236251
}
237252

0 commit comments

Comments
 (0)