Skip to content

Commit da75bcd

Browse files
cgwaltersopenshift-merge-robot
authored andcommittedOct 20, 2020
Write out a ref with the build ID
I'm not sure why we didn't do this from the start. The immediate motivation here is I was trying to diff two builds and the ostree commit previously was pruned while the cosa build still existed. Now yes I could import the ostree tarball but this seems clearly better. With this we can also drop the `tmpref-` hack we have for RHCOS and just use the build ID as a ref.
1 parent 5b4ef17 commit da75bcd

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
 

‎src/cmd-build

+2
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ echo "New image input checksum: ${image_input_checksum}"
346346
init_build_meta_json "${commit}" tmp/
347347
buildid=$(jq -r '.["buildid"]' < tmp/meta.json)
348348
echo "New build ID: ${buildid}"
349+
# Also write out a ref with the build ID
350+
ostree --repo="${tmprepo}" refs --create "${buildid}" "${commit}"
349351

350352
"${dn}"/write-commit-object "${tmprepo}" "${commit}" "$(pwd)"
351353

‎src/cmd-prune

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ error_during_pruning = False
176176
for build in builds_to_delete:
177177
print(f"Pruning build {build.id}")
178178
try:
179+
subprocess.check_call(['ostree', '--repo=tmp/repo', 'refs', '--delete', build.id])
179180
rmtree(os.path.join(builds_dir, build.id))
180181
except Exception as e:
181182
error_during_pruning = True

0 commit comments

Comments
 (0)