test/cases: support weldr-client output structure
Using get_build_info() function in all scripts where both composer-cli and weldr-client need to be supported for consistency.
This commit is contained in:
parent
4e4f55b058
commit
8ef0cfe618
10 changed files with 112 additions and 76 deletions
|
|
@ -8,6 +8,15 @@ function greenprint {
|
|||
echo -e "\033[1;32m[$(date -Isecond)] ${1}\033[0m"
|
||||
}
|
||||
|
||||
function get_build_info() {
|
||||
key="$1"
|
||||
fname="$2"
|
||||
if rpm -q --quiet weldr-client; then
|
||||
key=".body${key}"
|
||||
fi
|
||||
jq -r "${key}" "${fname}"
|
||||
}
|
||||
|
||||
# Container image used for cloud provider CLI tools
|
||||
CONTAINER_IMAGE_CLOUD_TOOLS="quay.io/osbuild/cloud-tools:latest"
|
||||
|
||||
|
|
@ -164,21 +173,13 @@ trap 'sudo pkill -P ${WORKER_JOURNAL_PID}' EXIT
|
|||
# Start the compose and upload to AWS.
|
||||
greenprint "🚀 Starting compose"
|
||||
sudo composer-cli --json compose start bash ami "$IMAGE_KEY" "$AWS_CONFIG" | tee "$COMPOSE_START"
|
||||
if [ "$(is_weldr_client_installed)" == true ]; then
|
||||
COMPOSE_ID=$(jq -r '.body.build_id' "$COMPOSE_START")
|
||||
else
|
||||
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
|
||||
fi
|
||||
COMPOSE_ID=$(get_build_info ".build_id" "$COMPOSE_START")
|
||||
|
||||
# Wait for the compose to finish.
|
||||
greenprint "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
|
||||
while true; do
|
||||
sudo composer-cli --json compose info "${COMPOSE_ID}" | tee "$COMPOSE_INFO" > /dev/null
|
||||
if [ "$(is_weldr_client_installed)" == true ]; then
|
||||
COMPOSE_STATUS=$(jq -r '.body.queue_status' "$COMPOSE_INFO")
|
||||
else
|
||||
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
|
||||
fi
|
||||
COMPOSE_STATUS=$(get_build_info ".queue_status" "$COMPOSE_INFO")
|
||||
|
||||
# Is the compose finished?
|
||||
if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then
|
||||
|
|
|
|||
|
|
@ -12,6 +12,15 @@ function greenprint {
|
|||
echo -e "\033[1;32m[$(date -Isecond)] ${1}\033[0m"
|
||||
}
|
||||
|
||||
function get_build_info() {
|
||||
key="$1"
|
||||
fname="$2"
|
||||
if rpm -q --quiet weldr-client; then
|
||||
key=".body${key}"
|
||||
fi
|
||||
jq -r "${key}" "${fname}"
|
||||
}
|
||||
|
||||
# Container image used for cloud provider CLI tools
|
||||
CONTAINER_IMAGE_CLOUD_TOOLS="quay.io/osbuild/cloud-tools:latest"
|
||||
|
||||
|
|
@ -184,21 +193,13 @@ trap 'sudo pkill -P ${WORKER_JOURNAL_PID}' EXIT
|
|||
# Start the compose and upload to Azure.
|
||||
greenprint "🚀 Starting compose"
|
||||
sudo composer-cli --json compose start bash vhd "$IMAGE_KEY" "$AZURE_CONFIG" | tee "$COMPOSE_START"
|
||||
if [ "$(is_weldr_client_installed)" == true ]; then
|
||||
COMPOSE_ID=$(jq -r '.body.build_id' "$COMPOSE_START")
|
||||
else
|
||||
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
|
||||
fi
|
||||
COMPOSE_ID=$(get_build_info ".build_id" "$COMPOSE_START")
|
||||
|
||||
# Wait for the compose to finish.
|
||||
greenprint "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
|
||||
while true; do
|
||||
sudo composer-cli --json compose info "${COMPOSE_ID}" | tee "$COMPOSE_INFO" > /dev/null
|
||||
if [ "$(is_weldr_client_installed)" == true ]; then
|
||||
COMPOSE_STATUS=$(jq -r '.body.queue_status' "$COMPOSE_INFO")
|
||||
else
|
||||
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
|
||||
fi
|
||||
COMPOSE_STATUS=$(get_build_info ".queue_status" "$COMPOSE_INFO")
|
||||
|
||||
# Is the compose finished?
|
||||
if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then
|
||||
|
|
|
|||
|
|
@ -24,6 +24,15 @@ function greenprint {
|
|||
echo -e "\033[1;32m[$(date -Isecond)] ${1}\033[0m"
|
||||
}
|
||||
|
||||
function get_build_info() {
|
||||
key="$1"
|
||||
fname="$2"
|
||||
if rpm -q --quiet weldr-client; then
|
||||
key=".body${key}"
|
||||
fi
|
||||
jq -r "${key}" "${fname}"
|
||||
}
|
||||
|
||||
TEST_UUID=$(uuidgen)
|
||||
IMAGE_KEY="osbuild-composer-test-${TEST_UUID}"
|
||||
|
||||
|
|
@ -81,22 +90,14 @@ build_image() {
|
|||
fi
|
||||
return
|
||||
else
|
||||
if rpm -q --quiet weldr-client; then
|
||||
COMPOSE_ID=$(jq -r '.body.build_id' "$COMPOSE_START")
|
||||
else
|
||||
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
|
||||
fi
|
||||
COMPOSE_ID=$(get_build_info ".build_id" "$COMPOSE_START")
|
||||
fi
|
||||
|
||||
# Wait for the compose to finish.
|
||||
greenprint "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
|
||||
while true; do
|
||||
sudo composer-cli --json compose info "${COMPOSE_ID}" | tee "$COMPOSE_INFO" > /dev/null
|
||||
if rpm -q --quiet weldr-client; then
|
||||
COMPOSE_STATUS=$(jq -r '.body.queue_status' "$COMPOSE_INFO")
|
||||
else
|
||||
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
|
||||
fi
|
||||
COMPOSE_STATUS=$(get_build_info ".queue_status" "$COMPOSE_INFO")
|
||||
|
||||
# Is the compose finished?
|
||||
if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then
|
||||
|
|
|
|||
|
|
@ -12,6 +12,16 @@ function greenprint {
|
|||
echo -e "\033[1;32m[$(date -Isecond)] ${1}\033[0m"
|
||||
}
|
||||
|
||||
function get_build_info() {
|
||||
key="$1"
|
||||
fname="$2"
|
||||
if rpm -q --quiet weldr-client; then
|
||||
key=".body${key}"
|
||||
fi
|
||||
jq -r "${key}" "${fname}"
|
||||
}
|
||||
|
||||
|
||||
# Install openshift client
|
||||
greenprint "🔧 Installing oenshift client(oc)"
|
||||
curl https://osbuild-storage.s3.amazonaws.com/oc-4.9.0-linux.tar.gz | sudo tar -xz -C /usr/local/bin/
|
||||
|
|
@ -161,13 +171,13 @@ build_image() {
|
|||
else
|
||||
sudo composer-cli --json compose start-ostree --ref "$OSTREE_REF" "$blueprint_name" "$image_type" | tee "$COMPOSE_START"
|
||||
fi
|
||||
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
|
||||
COMPOSE_ID=$(get_build_info ".build_id" "$COMPOSE_START")
|
||||
|
||||
# Wait for the compose to finish.
|
||||
greenprint "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
|
||||
while true; do
|
||||
sudo composer-cli --json compose info "${COMPOSE_ID}" | tee "$COMPOSE_INFO" > /dev/null
|
||||
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
|
||||
COMPOSE_STATUS=$(get_build_info ".queue_status" "$COMPOSE_INFO")
|
||||
|
||||
# Is the compose finished?
|
||||
if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then
|
||||
|
|
|
|||
|
|
@ -13,6 +13,15 @@ function greenprint {
|
|||
echo -e "\033[1;32m[$(date -Isecond)] ${1}\033[0m"
|
||||
}
|
||||
|
||||
function get_build_info() {
|
||||
key="$1"
|
||||
fname="$2"
|
||||
if rpm -q --quiet weldr-client; then
|
||||
key=".body${key}"
|
||||
fi
|
||||
jq -r "${key}" "${fname}"
|
||||
}
|
||||
|
||||
# Start libvirtd and test it.
|
||||
greenprint "🚀 Starting libvirt daemon"
|
||||
sudo systemctl start libvirtd
|
||||
|
|
@ -143,13 +152,13 @@ build_image() {
|
|||
else
|
||||
sudo composer-cli --json compose start-ostree --ref "$OSTREE_REF" "$blueprint_name" "$image_type" | tee "$COMPOSE_START"
|
||||
fi
|
||||
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
|
||||
COMPOSE_ID=$(get_build_info ".build_id" "$COMPOSE_START")
|
||||
|
||||
# Wait for the compose to finish.
|
||||
greenprint "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
|
||||
while true; do
|
||||
sudo composer-cli --json compose info "${COMPOSE_ID}" | tee "$COMPOSE_INFO" > /dev/null
|
||||
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
|
||||
COMPOSE_STATUS=$(get_build_info ".queue_status" "$COMPOSE_INFO")
|
||||
|
||||
# Is the compose finished?
|
||||
if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then
|
||||
|
|
|
|||
|
|
@ -13,6 +13,15 @@ function greenprint {
|
|||
echo -e "\033[1;32m[$(date -Isecond)] ${1}\033[0m"
|
||||
}
|
||||
|
||||
function get_build_info() {
|
||||
key="$1"
|
||||
fname="$2"
|
||||
if rpm -q --quiet weldr-client; then
|
||||
key=".body${key}"
|
||||
fi
|
||||
jq -r "${key}" "${fname}"
|
||||
}
|
||||
|
||||
# Start firewalld
|
||||
sudo systemctl enable --now firewalld
|
||||
|
||||
|
|
@ -152,13 +161,13 @@ build_image() {
|
|||
else
|
||||
sudo composer-cli --json compose start-ostree --ref "$OSTREE_REF" "$blueprint_name" "$image_type" | tee "$COMPOSE_START"
|
||||
fi
|
||||
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
|
||||
COMPOSE_ID=$(get_build_info ".build_id" "$COMPOSE_START")
|
||||
|
||||
# Wait for the compose to finish.
|
||||
greenprint "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
|
||||
while true; do
|
||||
sudo composer-cli --json compose info "${COMPOSE_ID}" | tee "$COMPOSE_INFO" > /dev/null
|
||||
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
|
||||
COMPOSE_STATUS=$(get_build_info ".queue_status" "$COMPOSE_INFO")
|
||||
|
||||
# Is the compose finished?
|
||||
if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then
|
||||
|
|
|
|||
|
|
@ -6,6 +6,15 @@ function greenprint {
|
|||
echo -e "\033[1;32m[$(date -Isecond)] ${1}\033[0m"
|
||||
}
|
||||
|
||||
function get_build_info() {
|
||||
key="$1"
|
||||
fname="$2"
|
||||
if rpm -q --quiet weldr-client; then
|
||||
key=".body${key}"
|
||||
fi
|
||||
jq -r "${key}" "${fname}"
|
||||
}
|
||||
|
||||
function generate_certificates {
|
||||
# Generate CA root key
|
||||
sudo openssl genrsa -out ca.key
|
||||
|
|
@ -311,21 +320,13 @@ function try_image_build {
|
|||
sudo journalctl -xe --unit osbuild-worker
|
||||
exit 1
|
||||
fi
|
||||
if rpm -q --quiet weldr-client; then
|
||||
COMPOSE_ID=$(jq -r '.body.build_id' "$COMPOSE_START")
|
||||
else
|
||||
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
|
||||
fi
|
||||
COMPOSE_ID=$(get_build_info ".build_id" "$COMPOSE_START")
|
||||
|
||||
# Wait for the compose to finish.
|
||||
greenprint "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
|
||||
while true; do
|
||||
sudo composer-cli --json compose info "${COMPOSE_ID}" | tee "${COMPOSE_INFO}" > /dev/null
|
||||
if rpm -q --quiet weldr-client; then
|
||||
COMPOSE_STATUS=$(jq -r '.body.queue_status' "$COMPOSE_INFO")
|
||||
else
|
||||
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
|
||||
fi
|
||||
COMPOSE_STATUS=$(get_build_info ".queue_status" "$COMPOSE_INFO")
|
||||
|
||||
# Is the compose finished?
|
||||
if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then
|
||||
|
|
|
|||
|
|
@ -29,6 +29,15 @@ esac
|
|||
|
||||
set -xeuo pipefail
|
||||
|
||||
function get_build_info() {
|
||||
key="$1"
|
||||
fname="$2"
|
||||
if rpm -q --quiet weldr-client; then
|
||||
key=".body${key}"
|
||||
fi
|
||||
jq -r "${key}" "${fname}"
|
||||
}
|
||||
|
||||
# Provision the software under test.
|
||||
BLUEPRINT_FILE=/tmp/blueprint.toml
|
||||
COMPOSE_START=/tmp/compose-start.json
|
||||
|
|
@ -50,20 +59,12 @@ EOF
|
|||
sudo composer-cli blueprints push "$BLUEPRINT_FILE"
|
||||
sudo composer-cli blueprints depsolve nss-devel
|
||||
sudo composer-cli --json compose start nss-devel qcow2 | tee "${COMPOSE_START}"
|
||||
if rpm -q --quiet weldr-client; then
|
||||
COMPOSE_ID=$(jq -r '.body.build_id' "$COMPOSE_START")
|
||||
else
|
||||
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
|
||||
fi
|
||||
COMPOSE_ID=$(get_build_info ".build_id" "$COMPOSE_START")
|
||||
# Wait for the compose to finish.
|
||||
echo "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
|
||||
while true; do
|
||||
sudo composer-cli --json compose info "${COMPOSE_ID}" | tee "$COMPOSE_INFO" > /dev/null
|
||||
if rpm -q --quiet weldr-client; then
|
||||
COMPOSE_STATUS=$(jq -r '.body.queue_status' "$COMPOSE_INFO")
|
||||
else
|
||||
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
|
||||
fi
|
||||
COMPOSE_STATUS=$(get_build_info ".queue_status" "$COMPOSE_INFO")
|
||||
|
||||
# Is the compose finished?
|
||||
if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then
|
||||
|
|
|
|||
|
|
@ -7,6 +7,15 @@
|
|||
|
||||
set -exuo pipefail
|
||||
|
||||
function get_build_info() {
|
||||
key="$1"
|
||||
fname="$2"
|
||||
if rpm -q --quiet weldr-client; then
|
||||
key=".body${key}"
|
||||
fi
|
||||
jq -r "${key}" "${fname}"
|
||||
}
|
||||
|
||||
WORKER_VERSION=8f21f0b873420a38a261d78a7df130f28b8e2867
|
||||
WORKER_RPM=osbuild-composer-worker-33-1.20210830git8f21f0b.el8.x86_64
|
||||
|
||||
|
|
@ -92,21 +101,13 @@ EOF2
|
|||
sudo composer-cli -s "$WELDR_SOCK" blueprints push "$BLUEPRINT_FILE"
|
||||
sudo composer-cli -s "$WELDR_SOCK" blueprints depsolve simple
|
||||
sudo composer-cli -s "$WELDR_SOCK" --json compose start simple qcow2 | tee "${COMPOSE_START}"
|
||||
if rpm -q --quiet weldr-client; then
|
||||
COMPOSE_ID=$(jq -r '.body.build_id' "$COMPOSE_START")
|
||||
else
|
||||
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
|
||||
fi
|
||||
COMPOSE_ID=$(get_build_info ".build_id" "$COMPOSE_START")
|
||||
|
||||
# Wait for the compose to finish.
|
||||
echo "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
|
||||
while true; do
|
||||
sudo composer-cli -s "$WELDR_SOCK" --json compose info "${COMPOSE_ID}" | tee "$COMPOSE_INFO" > /dev/null
|
||||
if rpm -q --quiet weldr-client; then
|
||||
COMPOSE_STATUS=$(jq -r '.body.queue_status' "$COMPOSE_INFO")
|
||||
else
|
||||
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
|
||||
fi
|
||||
COMPOSE_STATUS=$(get_build_info ".queue_status" "$COMPOSE_INFO")
|
||||
|
||||
# Is the compose finished?
|
||||
if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then
|
||||
|
|
|
|||
|
|
@ -8,6 +8,16 @@ function greenprint {
|
|||
echo -e "\033[1;32m[$(date -Isecond)] ${1}\033[0m"
|
||||
}
|
||||
|
||||
function get_build_info() {
|
||||
key="$1"
|
||||
fname="$2"
|
||||
if rpm -q --quiet weldr-client; then
|
||||
key=".body${key}"
|
||||
fi
|
||||
jq -r "${key}" "${fname}"
|
||||
}
|
||||
|
||||
|
||||
if [ "$ID" != "rhel" ]; then
|
||||
greenprint "VMware test not supported on $ID"
|
||||
exit 0
|
||||
|
|
@ -139,21 +149,13 @@ trap 'sudo pkill -P ${WORKER_JOURNAL_PID}' EXIT
|
|||
# Start the compose and upload to VMWare.
|
||||
greenprint "🚀 Starting compose"
|
||||
sudo composer-cli --json compose start bash vmdk "$IMAGE_KEY" "$VMWARE_CONFIG" | tee "$COMPOSE_START"
|
||||
if rpm -q --quiet weldr-client; then
|
||||
COMPOSE_ID=$(jq -r '.body.build_id' "$COMPOSE_START")
|
||||
else
|
||||
COMPOSE_ID=$(jq -r '.build_id' "$COMPOSE_START")
|
||||
fi
|
||||
COMPOSE_ID=$(get_build_info ".build_id" "$COMPOSE_START")
|
||||
|
||||
# Wait for the compose to finish.
|
||||
greenprint "⏱ Waiting for compose to finish: ${COMPOSE_ID}"
|
||||
while true; do
|
||||
sudo composer-cli --json compose info "${COMPOSE_ID}" | tee "$COMPOSE_INFO" > /dev/null
|
||||
if rpm -q --quiet weldr-client; then
|
||||
COMPOSE_STATUS=$(jq -r '.body.queue_status' "$COMPOSE_INFO")
|
||||
else
|
||||
COMPOSE_STATUS=$(jq -r '.queue_status' "$COMPOSE_INFO")
|
||||
fi
|
||||
COMPOSE_STATUS=$(get_build_info ".queue_status" "$COMPOSE_INFO")
|
||||
|
||||
# Is the compose finished?
|
||||
if [[ $COMPOSE_STATUS != RUNNING ]] && [[ $COMPOSE_STATUS != WAITING ]]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue