containers/osbuild-composer: Allow dnf-json to accept http connections

Revert 83e16afda4: With dnf-json running
in a container it's easy to run it standalone.
This commit is contained in:
sanne 2022-01-14 16:03:21 +01:00 committed by Sanne Raymaekers
parent 7c52db1ae1
commit fe00e1efd3
3 changed files with 89 additions and 20 deletions

View file

@ -52,6 +52,8 @@ rpm -q "$WORKER_RPM"
# run container
WELDR_DIR="$(mktemp -d)"
WELDR_SOCK="$WELDR_DIR/api.socket"
DNF_DIR="$(mktemp -d)"
DNF_SOCK="$DNF_DIR/api.sock"
sudo podman pull --creds "${V2_QUAY_USERNAME}":"${V2_QUAY_PASSWORD}" \
"quay.io/osbuild/osbuild-composer-ubi-pr:${CI_COMMIT_SHA}"
@ -66,6 +68,8 @@ sudo podman run \
-v /etc/pki/entitlement:/etc/pki/entitlement:Z \
-v "$REPOS/repositories":/usr/share/osbuild-composer/repositories:Z \
-v "$WELDR_DIR:/run/weldr/":Z \
-v "$DNF_DIR:/run/osbuild-dnf-json/":Z \
-e OVERWRITE_CACHE_DIR="/var/cache/dnf-json" \
-p 8700:8700 \
"quay.io/osbuild/osbuild-composer-ubi-pr:${CI_COMMIT_SHA}" \
--weldr-api --dnf-json --remote-worker-api \
@ -130,3 +134,28 @@ if [[ $COMPOSE_STATUS != FINISHED ]]; then
echo "Something went wrong with the compose. 😢"
exit 1
fi
tee "dnf-json-request.json" <<EOF
{
"command": "dump",
"arguments": {
"repos": [
{
"name": "fedora",
"id": "blep-2",
"metalink": "https://mirrors.fedoraproject.org/metalink?repo=fedora-35&arch=x86_64",
"check_gpg": true
}
],
"arch": "x86_64",
"module_platform_id": "platform:f35"
}
}
EOF
DNF_JSON_OUT=$(curl -d"@dnf-json-request.json" --unix-socket "$DNF_SOCK" http:/dump | jq '.packages | length')
# expect more than 1 package
if [ ! "$DNF_JSON_OUT" -gt "1" ]; then
echo "dnf-json endpoint didn't return list of packages"
exit 1
fi