Skip to content

Commit 14ae316

Browse files
ci: temp rootfs rpm integration test (#924)
Signed-off-by: ashnamehrotra <ashnamehrotra@gmail.com> Co-authored-by: Sertaç Özercan <852750+sozercan@users.noreply.github.com>
1 parent 532e528 commit 14ae316

File tree

5 files changed

+66
-7
lines changed

5 files changed

+66
-7
lines changed

.github/workflows/build.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,60 @@ jobs:
191191
run: |
192192
set -eu -o pipefail
193193
. .github/workflows/scripts/buildkitenvs/${{ matrix.buildkit_mode}}
194+
echo "COPA_BUILDKIT_ADDR=${COPA_BUILDKIT_ADDR}" >> "$GITHUB_ENV"
194195
go test -v ./integration --addr="${COPA_BUILDKIT_ADDR}" --copa="$(pwd)/copa" -timeout 0
196+
- name: Test RPM validation - noreplace files
197+
shell: bash
198+
run: |
199+
set -eux -o pipefail
200+
201+
if [[ -n "${COPA_BUILDKIT_ADDR}" && "${COPA_BUILDKIT_ADDR}" == docker://* ]]; then
202+
export DOCKER_HOST="${COPA_BUILDKIT_ADDR#docker://}"
203+
fi
204+
205+
docker create --name test ghcr.io/project-copacetic/copacetic/test/openssl:test-patched /bin/sh
206+
tmp="$(mktemp)"
207+
docker cp test:/etc/pki/tls/openssl.cnf "${tmp}"
208+
209+
if ! grep -q foo "${tmp}"; then
210+
echo "Error: openssl.cnf content replaced" >&2
211+
rm "${tmp}"
212+
docker rm -f test
213+
exit 1
214+
fi
215+
216+
rm "${tmp}"
217+
docker rm -f test
218+
- name: Test RPM validation - symlink
219+
shell: bash
220+
run: |
221+
set -eux -o pipefail
222+
223+
_cleanup() {
224+
docker rm -f "$DOCKER_CUSTOM_UNIX_ID"
225+
sudo rm -rf "$SOCK_DIR"
226+
}
227+
228+
if [[ -n "${COPA_BUILDKIT_ADDR}" && "${COPA_BUILDKIT_ADDR}" == docker://* ]]; then
229+
export DOCKER_HOST="${COPA_BUILDKIT_ADDR#docker://}"
230+
trap '_cleanup' EXIT
231+
fi
232+
233+
docker create --name test ghcr.io/project-copacetic/copacetic/test/openssl:test-patched /bin/sh
234+
tmp="$(mktemp)"
235+
236+
symlink_path="/sbin"
237+
docker cp test:"$symlink_path" "${tmp}_symlink"
238+
239+
if [ ! -L "${tmp}_symlink" ]; then
240+
echo "Error: The path $symlink_path is not a symlink."
241+
rm "${tmp}" "${tmp}_symlink"
242+
docker rm -f test
243+
exit 1
244+
fi
245+
246+
rm "${tmp}" "${tmp}_symlink"
247+
docker rm -f test
195248
196249
test-plugin:
197250
needs: build

.github/workflows/scripts/buildkitenvs/docker/custom-unix

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ EOF
1212
sock_dir="$(mktemp -d)"
1313

1414
docker_custom_unix_id="$(docker run -d --privileged --mount=type=bind,source="${sock_dir}",target=/run --mount=type=volume,source="${DOCKER_DIND_VOLUME}",target=/var/lib/docker dind --group "$(id -g)")"
15+
echo "DOCKER_CUSTOM_UNIX_ID=$docker_custom_unix_id" >> $GITHUB_ENV
16+
echo "SOCK_DIR=$sock_dir" >> $GITHUB_ENV
1517

1618

1719
timeout 5m bash -c '
@@ -21,13 +23,6 @@ until [ "$(docker inspect -f "{{.State.Status}}" $docker_custom_unix_id)" == "ru
2123
done
2224
' -- "$docker_custom_unix_id"
2325

24-
_cleanup() {
25-
docker rm -f "$docker_custom_unix_id"
26-
sudo rm -rf "${sock_dir}"
27-
}
28-
29-
trap '_cleanup' EXIT
30-
3126
_check_docker_dind() {
3227
docker -H "unix://${sock_dir}/docker.sock" info
3328
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM mcr.microsoft.com/cbl-mariner/distroless/base:2.0.20240112
2+
COPY openssl.cnf /etc/pki/tls/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
foo

integration/fixtures/test-images.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,13 @@
184184
"distro": "AlmaLinux",
185185
"description": "Valid rpm DB, microdnf & rpm present",
186186
"ignoreErrors": false
187+
},
188+
{
189+
"image": "ghcr.io/project-copacetic/copacetic/test/openssl",
190+
"tag": "test",
191+
"digest": "sha256:164dbe64a682513e341b6262646c8bee2fb72fca3801aedd9f720765704af995",
192+
"distro": "Mariner Distroless",
193+
"description": "Custom rpmmanifest files, no yum/tdnf/dnf/microdnf/rpm, custom openssl.cnf",
194+
"ignoreErrors": false
187195
}
188196
]

0 commit comments

Comments
 (0)