Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ jobs:
registry_username: ${{ secrets.QUAY_IMAGE_SCLORG_BUILDER_USERNAME }}
registry_token: ${{ secrets.QUAY_IMAGE_SCLORG_BUILDER_TOKEN }}
dockerfile: Dockerfile.daily-tests
tag: "0.6.3"
tag: "0.6.4"
image_name: "upstream-daily-tests"
quay_application_token: ${{ secrets.QUAY_IMAGE_SCLORG_UPDATE_DESC }}
2 changes: 1 addition & 1 deletion Dockerfile.daily-tests
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM quay.io/fedora/fedora:42

ENV SHARED_DIR="/var/ci-scripts" \
VERSION="42" \
RELEASE_UPSTREAM="0.6.3" \
RELEASE_UPSTREAM="0.6.4" \
UPSTREAM_TMT_REPO="https://github.com/sclorg/sclorg-testing-farm" \
UPSTREAM_TMT_DIR="sclorg-testing-farm" \
HOME="/home/nightly" \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ shellcheck:
./run-shellcheck.sh `git ls-files *.sh`

build_images:
podman build -t quay.io/sclorg/upstream-daily-tests:0.6.3 -f Dockerfile.daily-tests .
podman build -t quay.io/sclorg/upstream-daily-tests:0.6.4 -f Dockerfile.daily-tests .
78 changes: 23 additions & 55 deletions daily_tests/daily_nightly_tests_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,75 +64,43 @@

TEST_CASES = {
# Format is test for OS and king of test, what TMT Plan is used and MSG to mail
("fedora-test", "nightly-container-f", "Fedora test results:"),
("fedora-test-pytest", "nightly-container-f", "Fedora PyTest test results:"),
("c9s-test", "nightly-container-centos-stream-9", "CentOS Stream 9 test results:"),
(
"c9s-test-pytest",
"nightly-container-centos-stream-9",
"CentOS Stream 9 PyTest test results:",
),
(
"c10s-test",
"nightly-container-centos-stream-10",
"CentOS Stream 10 test results:",
),
(
"c10s-test-pytest",
"nightly-container-centos-stream-10",
"CentOS Stream 10 PyTest test results:",
),
("rhel8-test", "nightly-container-rhel8", "RHEL-8 test results:"),
("rhel8-test-pytest", "nightly-container-rhel8", "RHEL-8 PyTest test results:"),
(
"rhel8-test-openshift-4",
"nightly-container-rhel8",
"RHEL-8 OpenShift 4 test results:",
),
("fedora-test", "nightly-fedora", "Fedora test results:"),
("fedora-test-pytest", "nightly-fedora", "Fedora PyTest test results:"),
("c9s-test", "nightly-c9s", "CentOS Stream 9 test results:"),
("c9s-test-pytest", "nightly-c9s", "CentOS Stream 9 PyTest test results:"),
("c10s-test", "nightly-c10s", "CentOS Stream 10 test results:"),
("c10s-test-pytest", "nightly-c10s", "CentOS Stream 10 PyTest test results:"),
("rhel8-test", "nightly-rhel8", "RHEL-8 test results:"),
("rhel8-test-pytest", "nightly-rhel8", "RHEL-8 PyTest test results:"),
("rhel8-test-openshift-4", "nightly-rhel8", "RHEL-8 OpenShift 4 test results:"),
(
"rhel8-test-openshift-pytest",
"nightly-container-rhel8",
"nightly-rhel8",
"RHEL-8 PyTest in OpenShift 4 test results:",
),
("rhel9-test", "nightly-container-rhel9", "RHEL-9 test results:"),
("rhel9-test-pytest", "nightly-container-rhel8", "RHEL-9 PyTest test results:"),
(
"rhel9-test-openshift-4",
"nightly-container-rhel9",
"RHEL-9 OpenShift 4 test results:",
),
("rhel9-test", "nightly-rhel9", "RHEL-9 test results:"),
("rhel9-test-pytest", "nightly-rhel9", "RHEL-9 PyTest test results:"),
("rhel9-test-openshift-4", "nightly-rhel9", "RHEL-9 OpenShift 4 test results:"),
(
"rhel9-test-openshift-pytest",
"nightly-container-rhel9",
"nightly-rhel9",
"RHEL-9 PyTest in OpenShift 4 test results:",
),
(
"rhel9-helm-charts",
"nightly-container-rhel9",
"RHEL-9 Helm Charts test results:",
),
("rhel10-test", "nightly-container-rhel10", "RHEL-10 test results:"),
("rhel10-test-pytest", "nightly-container-rhel10", "RHEL-10 PyTest test results:"),
(
"rhel10-test-openshift-4",
"nightly-container-rhel10",
"RHEL-10 OpenShift 4 test results:",
),
("rhel9-helm-charts", "nightly-rhel9", "RHEL-9 Helm Charts test results:"),
("rhel10-test", "nightly-rhel10", "RHEL-10 test results:"),
("rhel10-test-pytest", "nightly-rhel10", "RHEL-10 PyTest test results:"),
("rhel10-test-openshift-4", "nightly-rhel10", "RHEL-10 OpenShift 4 test results:"),
(
"rhel10-test-openshift-pytest",
"nightly-container-rhel10",
"nightly-rhel10",
"RHEL-10 PyTest in OpenShift 4 test results:",
),
}

TEST_UPSTREAM_CASES = {
("rhel8-test-upstream", "nightly-container-rhel8", "RHEL-8 Upstream test results:"),
("rhel9-test-upstream", "nightly-container-rhel9", "RHEL-9 Upstream test results:"),
(
"rhel10-test-upstream",
"nightly-container-rhel10",
"RHEL-10 Upstream test results:",
),
("rhel8-test-upstream", "nightly-rhel8", "RHEL-8 Upstream test results:"),
("rhel9-test-upstream", "nightly-rhel9", "RHEL-9 Upstream test results:"),
("rhel10-test-upstream", "nightly-rhel10", "RHEL-10 Upstream test results:"),
}

# The default directory used for nightly build
Expand Down Expand Up @@ -273,7 +241,7 @@ def collect_data(self):
self.data_dict["SUCCESS_DATA"] = []
failed_tests = False
for test_case, plan, _ in self.available_test_case:
path_dir = Path(RESULTS_DIR) / test_case
path_dir = Path(RESULTS_DIR) / test_case / "nightly"
if not path_dir.is_dir():
print(f"The test case {path_dir} does not exists that is weird")
continue
Expand Down
15 changes: 15 additions & 0 deletions run_in_container.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

set -x

TARGET=$1
TESTS=$2
TEST_TYPE=$3

podman run --rm -it \
-v /var/tmp/:/var/tmp/:Z \
-e SHARED_DIR=/var/tmp/ \
-e TARGET=$TARGET \
-e TESTS=$TESTS \
-e TEST_TYPE=$TEST_TYPE \
quay.io/sclorg/daily-tests:latest
72 changes: 40 additions & 32 deletions run_nightly_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,45 @@

set -x

[[ -z "$TARGET" ]] && { echo "You have to specify target to build SCL images. rhel9, rhel8, or fedora" && exit 1 ; }
[[ -z "$TESTS" ]] && { echo "You have to specify type of the test to run. test, test-pytest, test-openshift, test-openshift-pytest" && exit 1 ; }
if [[ -n "$TARGET" ]]; then
echo "Target is set to $TARGET"
else
echo "TARGET variable is not set. Please set it to rhel9, rhel8, rhel10, fedora, c9s or c10s."
exit 1
fi
if [[ -n "$TESTS" ]]; then
echo "Test is set to $TESTS"
else
echo "TESTS variable is not set. Please set it to test, test-pytest, test-openshift, or test-openshift-pytest."
exit 1
fi

SET_TEST=""
if [[ "${TESTS}" != "test-upstream" ]]; then
[[ -z "$TEST_TYPE" ]] && { echo "You have to specify type of images S2I or NOS2I" && exit 1 ; }
if [[ -n "$TEST_TYPE" ]]; then
echo "Test type is set to $TEST_TYPE"
else
echo "TEST_TYPE variable is not set. Please set it to S2I or NOS2I."
exit 1
fi
SET_TEST="$TEST_TYPE"
fi

# Local working directories
CUR_DATE=$(date +%Y-%m-%d)
WORK_DIR="${HOME}/ci-scripts/"
LOCAL_LOGS_DIR="${HOME}/logs/"

# Shared directories between runs
DAILY_REPORTS_DIR="${SHARED_DIR}/daily_reports_dir"
TFT_PLAN="nightly-container-$TARGET"
DAILY_REPORTS_TESTS_DIR="${DAILY_REPORTS_DIR}/${TARGET}-${TESTS}"
DAILY_SCLORG_TESTS_DIR="${SHARED_DIR}/daily_scl_tests"
DAILY_REPORTS_DIR="${SHARED_DIR}/daily_reports_dir/${CUR_DATE}"
TFT_PLAN="nightly/nightly-$TARGET"
DAILY_REPORTS_TESTS_DIR="${DAILY_REPORTS_DIR}/${CUR_DATE}/${TARGET}-${TESTS}"
DAILY_SCLORG_TESTS_DIR="${SHARED_DIR}/daily_scl_tests/${CUR_DATE}/${TARGET}-${TESTS}-${SET_TEST}"

DIR="${WORK_DIR}/${TARGET}-${TESTS}-${SET_TEST}"
DIR="${WORK_DIR}/${CUR_DATE}/${TARGET}-${TESTS}-${SET_TEST}"
if [[ "$TESTS" == "test-upstream" ]]; then
DIR="${WORK_DIR}/${TARGET}-${TESTS}"
DIR="${WORK_DIR}/${CUR_DATE}/${TARGET}-${TESTS}"
DAILY_SCLORG_TESTS_DIR="${SHARED_DIR}/daily_scl_tests/${CUR_DATE}/${TARGET}-${TESTS}"
fi
LOG_FILE="${LOCAL_LOGS_DIR}/${TARGET}-${TESTS}.log"

Expand All @@ -38,12 +56,6 @@ function generate_passwd_file() {
export NSS_WRAPPER_GROUP=/etc/group
}

function move_logs_to_old() {
echo "Moving logs to old directory"
mv "${DAILY_REPORTS_DIR}/*" "${DAILY_REPORTS_DIR}_old/"
echo "Logs moved to old directory"
}

function prepare_environment() {
mkdir -p "${LOCAL_LOGS_DIR}"
mkdir -p "${WORK_DIR}"
Expand All @@ -65,15 +77,15 @@ function get_compose() {
elif [[ "$TARGET" == "fedora" ]]; then
COMPOSE="1MT-Fedora-${VERSION}"
TMT_PLAN_DIR="$UPSTREAM_TMT_DIR"
TFT_PLAN="nightly-container-fedora"
TFT_PLAN="nightly/nightly-fedora"
elif [[ "$TARGET" == "c9s" ]]; then
COMPOSE="1MT-CentOS-Stream-9"
TMT_PLAN_DIR="$UPSTREAM_TMT_DIR"
TFT_PLAN="nightly-container-c9s"
TFT_PLAN="nightly/nightly-c9s"
elif [[ "$TARGET" == "c10s" ]]; then
COMPOSE="1MT-CentOS-Stream-10"
TMT_PLAN_DIR="$UPSTREAM_TMT_DIR"
TFT_PLAN="nightly-container-c10s"
TFT_PLAN="nightly/nightly-c10s"
else
echo "This target is not supported"
exit 1
Expand All @@ -91,31 +103,26 @@ function run_tests() {
fi
TMT_COMMAND="tmt run -v -v -d -d --all ${ENV_VARIABLES} --id ${DIR} plan --name $TFT_PLAN provision -v -v --how minute --auto-select-network --image ${COMPOSE}"
echo "TMT command is: $TMT_COMMAND" | tee -a "${LOG_FILE}"
touch "${RESULTS_TARGET_DIR}/tmt_running"
touch "${DAILY_SCLORG_TESTS_DIR}/tmt_running"
set -o pipefail
$TMT_COMMAND | tee -a "${LOG_FILE}"
if [[ $? -ne 0 ]]; then
ret_code=$?
set +o pipefail
rm -f "${DAILY_SCLORG_TESTS_DIR}/tmt_running"
if [[ $ret_code -ne 0 ]]; then
echo "TMT command $TMT_COMMAND has failed."
if [[ -f "${DAILY_REPORTS_TESTS_DIR}/tmt_success" ]]; then
rm -f "${DAILY_REPORTS_TESTS_DIR}/tmt_success"
fi
touch "${DAILY_REPORTS_TESTS_DIR}/tmt_failed"
else
if [[ -f "${DAILY_REPORTS_TESTS_DIR}/tmt_failed" ]]; then
echo "Previous test run has failed but this one has passed."
else
touch "${DAILY_REPORTS_TESTS_DIR}/tmt_success"
fi
touch "${DAILY_REPORTS_TESTS_DIR}/tmt_success"
fi
ls -laR "${DIR}/plans/${TFT_PLAN}/data/" > "$DAILY_SCLORG_TESTS_DIR/all_files_${TARGET}_${TESTS}.txt"
cp "${LOG_FILE}" "${DAILY_SCLORG_TESTS_DIR}/log_${TARGET}_${TESTS}.txt"
if [[ -d "${DIR}/plans/${TFT_PLAN}/data" ]]; then
ls -laR "${DIR}/plans/${TFT_PLAN}/data/" > "$DAILY_SCLORG_TESTS_DIR/all_files_${TARGET}_${TESTS}.txt"
ls -la "${DIR}/plans/${TFT_PLAN}/data/results/"
cp -rv "${DIR}/plans/${TFT_PLAN}/data/results" "${DAILY_REPORTS_TESTS_DIR}/plans/${TFT_PLAN}/data/"
cp -v "${DIR}/plans/${TFT_PLAN}/data/*.log" "${DAILY_REPORTS_TESTS_DIR}/plans/${TFT_PLAN}/data/"
fi
cp "${DIR}/log.txt" "${DAILY_REPORTS_TESTS_DIR}/"
set +o pipefail
rm -f "${DAILY_REPORTS_TESTS_DIR}/tmt_running"
}

if [[ "$TESTS" != "test" ]] && [[ "$TESTS" != "test-pytest" ]] && [[ "$TESTS" != "test-upstream" ]] && [[ "$TESTS" != "test-openshift-pytest" ]] && [[ "$TESTS" != "test-openshift-4" ]]; then
Expand All @@ -130,10 +137,11 @@ generate_passwd_file
# chown -R "${USER_ID}":0 $HOME/
# chown -R "${USER_ID}":0 $WORK_DIR/

move_logs_to_old

prepare_environment
get_compose

# move_logs_to_old

date > "${LOG_FILE}"
curl --insecure -L https://url.corp.redhat.com/fmf-data > "/tmp/fmf_data"
Expand Down
Loading