Skip to content

Commit 3f5eb52

Browse files
authored
Merge pull request #950 from cgwalters/ci-ostree-deploy
Cover ostree-ext in ci
2 parents c895c61 + 6429eeb commit 3f5eb52

File tree

5 files changed

+30
-108
lines changed

5 files changed

+30
-108
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ jobs:
6767
steps:
6868
- name: Checkout repository
6969
uses: actions/checkout@v4
70-
- name: Ensure host skopeo is disabled
71-
run: sudo rm -f /bin/skopeo /usr/bin/skopeo
7270
- name: Free up disk space on runner
7371
run: sudo ./ci/clean-gha-runner.sh
7472
- name: Integration tests
@@ -81,6 +79,9 @@ jobs:
8179
sudo install -m 0755 target/release/tests-integration /usr/bin/bootc-integration-tests
8280
rm target -rf
8381
df -h /
82+
# The ostree-container tests
83+
sudo podman run --privileged --pid=host -v /:/run/host -v $(pwd):/src:ro -v /var/tmp:/var/tmp \
84+
-v /run/dbus:/run/dbus -v /run/systemd:/run/systemd localhost/bootc /src/ostree-ext/ci/priv-integration.sh
8485
# Nondestructive but privileged tests
8586
sudo bootc-integration-tests host-privileged localhost/bootc
8687
# Finally the install-alongside suite

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,15 @@ install-ostree-hooks:
3434
ln -sf ../../../bin/bootc $(DESTDIR)$(prefix)/libexec/libostree/ext/$$x; \
3535
done
3636

37-
install-with-tests: install
37+
# Install the main binary, the ostree hooks, and the integration test suite.
38+
install-all: install install-ostree-hooks
3839
install -D -m 0755 target/release/tests-integration $(DESTDIR)$(prefix)/bin/bootc-integration-tests
3940

4041
bin-archive: all
4142
$(MAKE) install DESTDIR=tmp-install && $(TAR_REPRODUCIBLE) --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf
4243

4344
test-bin-archive: all
44-
$(MAKE) install-with-tests DESTDIR=tmp-install && $(TAR_REPRODUCIBLE) --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf
45+
$(MAKE) install-all DESTDIR=tmp-install && $(TAR_REPRODUCIBLE) --zstd -C tmp-install -cf target/bootc.tar.zst . && rm tmp-install -rf
4546

4647
test-tmt:
4748
cargo xtask test-tmt

ostree-ext/.github/workflows/bootc.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.

ostree-ext/.github/workflows/rust.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -128,24 +128,6 @@ jobs:
128128
run: install ostree-ext-cli /usr/bin && rm -v ostree-ext-cli
129129
- name: Integration tests
130130
run: ./ci/ima.sh
131-
privtest:
132-
name: "Privileged testing"
133-
needs: build
134-
runs-on: ubuntu-latest
135-
container:
136-
image: quay.io/fedora/fedora-coreos:testing-devel
137-
options: "--privileged --pid=host -v /var/tmp:/var/tmp -v /run/dbus:/run/dbus -v /run/systemd:/run/systemd -v /:/run/host"
138-
steps:
139-
- name: Checkout repository
140-
uses: actions/checkout@v3
141-
- name: Download
142-
uses: actions/[email protected]
143-
with:
144-
name: ostree-ext-cli
145-
- name: Install
146-
run: install ostree-ext-cli /usr/bin && rm -v ostree-ext-cli
147-
- name: Integration tests
148-
run: ./ci/priv-integration.sh
149131
privtest-cockpit:
150132
name: "Privileged testing (cockpit)"
151133
needs: build

ostree-ext/ci/priv-integration.sh

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@ if test '!' -d "${sysroot}/ostree/deploy/${stateroot}"; then
2828
ostree admin os-init "${stateroot}" --sysroot "${sysroot}"
2929
fi
3030
# Should be no images pruned
31-
ostree-ext-cli container image prune-images --sysroot "${sysroot}"
31+
ostree container image prune-images --sysroot "${sysroot}"
3232
# Test the syntax which uses full imgrefs.
33-
ostree-ext-cli container image deploy --sysroot "${sysroot}" \
33+
ostree container image deploy --sysroot "${sysroot}" \
3434
--stateroot "${stateroot}" --imgref "${imgref}"
3535
ostree admin --sysroot="${sysroot}" status
36-
ostree-ext-cli container image metadata --repo "${sysroot}/ostree/repo" registry:"${image}" > manifest.json
36+
ostree container image metadata --repo "${sysroot}/ostree/repo" registry:"${image}" > manifest.json
3737
jq '.schemaVersion' < manifest.json
38-
ostree-ext-cli container image remove --repo "${sysroot}/ostree/repo" registry:"${image}"
38+
ostree container image remove --repo "${sysroot}/ostree/repo" registry:"${image}"
3939
ostree admin --sysroot="${sysroot}" undeploy 0
4040
# Now test the new syntax which has a nicer --image that defaults to registry.
41-
ostree-ext-cli container image deploy --transport registry --sysroot "${sysroot}" \
41+
ostree container image deploy --transport registry --sysroot "${sysroot}" \
4242
--stateroot "${stateroot}" --image "${image}"
4343
ostree admin --sysroot="${sysroot}" status
4444
ostree admin --sysroot="${sysroot}" undeploy 0
45-
if ostree-ext-cli container image deploy --transport registry --sysroot "${sysroot}" \
45+
if ostree container image deploy --transport registry --sysroot "${sysroot}" \
4646
--stateroot "${stateroot}" --image "${image}" --enforce-container-sigpolicy 2>err.txt; then
4747
echo "Deployment with enforced verification succeeded unexpectedly" 1>&2
4848
exit 1
@@ -52,16 +52,16 @@ if ! grep -Ee 'insecureAcceptAnything.*refusing usage' err.txt; then
5252
cat err.txt
5353
fi
5454
# Now we should prune it
55-
ostree-ext-cli container image prune-images --sysroot "${sysroot}"
56-
ostree-ext-cli container image list --repo "${sysroot}/ostree/repo" > out.txt
55+
ostree container image prune-images --sysroot "${sysroot}"
56+
ostree container image list --repo "${sysroot}/ostree/repo" > out.txt
5757
test $(stat -c '%s' out.txt) = 0
5858

5959
for img in "${image}"; do
60-
ostree-ext-cli container image deploy --sysroot "${sysroot}" \
60+
ostree container image deploy --sysroot "${sysroot}" \
6161
--stateroot "${stateroot}" --imgref ostree-unverified-registry:"${img}"
6262
ostree admin --sysroot="${sysroot}" status
6363
initial_refs=$(ostree --repo="${sysroot}/ostree/repo" refs | wc -l)
64-
ostree-ext-cli container image remove --repo "${sysroot}/ostree/repo" registry:"${img}"
64+
ostree container image remove --repo "${sysroot}/ostree/repo" registry:"${img}"
6565
pruned_refs=$(ostree --repo="${sysroot}/ostree/repo" refs | wc -l)
6666
# Removing the image should only drop the image reference, not its layers
6767
test "$(($initial_refs - 1))" = "$pruned_refs"
@@ -70,29 +70,32 @@ for img in "${image}"; do
7070
n_commits=$(find ${sysroot}/ostree/repo -name '*.commit' | wc -l)
7171
test "${n_commits}" -gt 0
7272
# But right now this still doesn't prune *content*
73-
ostree-ext-cli container image prune-layers --repo="${sysroot}/ostree/repo"
73+
ostree container image prune-layers --repo="${sysroot}/ostree/repo"
7474
ostree --repo="${sysroot}/ostree/repo" refs > refs.txt
7575
if test "$(wc -l < refs.txt)" -ne 0; then
7676
echo "found refs"
7777
cat refs.txt
7878
exit 1
7979
fi
8080
# And this one should GC the objects too
81-
ostree-ext-cli container image prune-images --full --sysroot="${sysroot}" > out.txt
81+
ostree container image prune-images --full --sysroot="${sysroot}" > out.txt
8282
n_commits=$(find ${sysroot}/ostree/repo -name '*.commit' | wc -l)
8383
test "${n_commits}" -eq 0
8484
done
8585

8686
# Verify we have systemd journal messages
87-
nsenter -m -t 1 journalctl _COMM=ostree-ext-cli > logs.txt
88-
grep 'layers already present: ' logs.txt
87+
nsenter -m -t 1 journalctl _COMM=bootc > logs.txt
88+
if ! grep 'layers already present: ' logs.txt; then
89+
cat logs.txt
90+
exit 1
91+
fi
8992

9093
podman pull ${image}
9194
ostree --repo="${sysroot}/ostree/repo" init --mode=bare-user
92-
ostree-ext-cli container image pull ${sysroot}/ostree/repo ostree-unverified-image:containers-storage:${image}
95+
ostree container image pull ${sysroot}/ostree/repo ostree-unverified-image:containers-storage:${image}
9396
echo "ok pulled from containers storage"
9497

95-
ostree-ext-cli container compare ${imgref} ${imgref} > compare.txt
98+
ostree container compare ${imgref} ${imgref} > compare.txt
9699
grep "Removed layers: *0 *Size: 0 bytes" compare.txt
97100
grep "Added layers: *0 *Size: 0 bytes" compare.txt
98101

@@ -114,22 +117,22 @@ ostree refs ostree/container/image --delete
114117
repo="${sysroot}/ostree/repo"
115118
images=$(ostree container image list --repo "${repo}" | wc -l)
116119
test "${images}" -eq 1
117-
ostree-ext-cli container image deploy --sysroot "${sysroot}" \
120+
ostree container image deploy --sysroot "${sysroot}" \
118121
--stateroot "${stateroot}" --imgref ostree-unverified-image:"${derived_img}"
119122
imgref=$(ostree refs --repo=${repo} ostree/container/image | head -1)
120123
img_commit=$(ostree --repo=${repo} rev-parse ostree/container/image/${imgref})
121-
ostree-ext-cli container image remove --repo "${repo}" "${derived_img}"
124+
ostree container image remove --repo "${repo}" "${derived_img}"
122125

123-
ostree-ext-cli container image deploy --sysroot "${sysroot}" \
126+
ostree container image deploy --sysroot "${sysroot}" \
124127
--stateroot "${stateroot}" --imgref ostree-unverified-image:"${derived_img}"
125128
img_commit2=$(ostree --repo=${repo} rev-parse ostree/container/image/${imgref})
126129
test "${img_commit}" = "${img_commit2}"
127130
echo "ok deploy derived container identical revs"
128131

129-
ostree-ext-cli container image deploy --sysroot "${sysroot}" \
132+
ostree container image deploy --sysroot "${sysroot}" \
130133
--stateroot "${stateroot}" --imgref ostree-unverified-image:"${derived_img_dir}"
131134
echo "ok deploy derived container from local dir"
132-
ostree-ext-cli container image remove --repo "${repo}" "${derived_img_dir}"
135+
ostree container image remove --repo "${repo}" "${derived_img_dir}"
133136
rm -rf /var/tmp/derived.dir
134137

135138
# Verify policy

0 commit comments

Comments
 (0)