From 14f91f9d7a2b2bd9ca17cc1a89b5a48191e46d1f Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Fri, 16 Sep 2022 10:36:08 +0200 Subject: [PATCH] build_utils: fix collect_ceph_logs function typical error from ceph-volume tests: ``` ERROR! the playbook: /home/jenkins-build/build/workspace/ceph-volume-prs-lvm-centos8-bluestore-dmcrypt/tests/functional/collect-logs.yml could not be found ``` Since `collect-logs.yml` is maintained in ceph-ansible repository, when `collect_ceph_logs` is called from a job different from ceph-ansible, the path is incorrect. The idea is to make ceph-volume jobs override this path. Signed-off-by: Guillaume Abrioux --- ceph-volume-ansible-prs/build/teardown | 6 ++++-- ceph-volume-nightly/build/teardown | 6 ++++-- ceph-volume-scenario/build/teardown | 6 ++++-- scripts/build_utils.sh | 16 +++++++++++----- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/ceph-volume-ansible-prs/build/teardown b/ceph-volume-ansible-prs/build/teardown index 11e3bbcf..b817bee8 100644 --- a/ceph-volume-ansible-prs/build/teardown +++ b/ceph-volume-ansible-prs/build/teardown @@ -10,7 +10,9 @@ install_python_packages $TEMPVENV "pkgs[@]" GITHUB_STATUS_STATE="failure" $VENV/github-status create -cd $WORKSPACE/src/ceph-volume/ceph_volume/tests/functional +CEPH_VOLUME_FUNCTIONAL_TESTS_PATH=$WORKSPACE/src/ceph-volume/ceph_volume/tests/functional +COLLECT_LOGS_PLAYBOOK_PATH="$CEPH_VOLUME_FUNCTIONAL_TESTS_PATH/$SUBCOMMAND/.tox/${DISTRO}-${OBJECTSTORE}-${SCENARIO}/tmp/ceph-ansible/tests/functional/collect-logs.yml" +cd "$CEPH_VOLUME_FUNCTIONAL_TESTS_PATH" # the method exists in scripts/build_utils.sh -teardown_vagrant_tests $VENV +teardown_vagrant_tests "$VENV" "$COLLECT_LOGS_PLAYBOOK_PATH" diff --git a/ceph-volume-nightly/build/teardown b/ceph-volume-nightly/build/teardown index 4735815d..205bd349 100644 --- a/ceph-volume-nightly/build/teardown +++ b/ceph-volume-nightly/build/teardown @@ -3,9 +3,11 @@ # for every Vagrantfile in scenarios and then just destroys whatever is left. -cd $WORKSPACE/src/ceph-volume/ceph_volume/tests/functional +CEPH_VOLUME_FUNCTIONAL_TESTS_PATH=$WORKSPACE/src/ceph-volume/ceph_volume/tests/functional +COLLECT_LOGS_PLAYBOOK_PATH="$CEPH_VOLUME_FUNCTIONAL_TESTS_PATH/$SUBCOMMAND/.tox/${DISTRO}-${OBJECTSTORE}-${SCENARIO}/tmp/ceph-ansible/tests/functional/collect-logs.yml" +cd "$CEPH_VOLUME_FUNCTIONAL_TESTS_PATH" TEMPVENV=$(create_venv_dir) VENV=${TEMPVENV}/bin # the method exists in scripts/build_utils.sh -teardown_vagrant_tests $VENV +teardown_vagrant_tests "$VENV" "$COLLECT_LOGS_PLAYBOOK_PATH" \ No newline at end of file diff --git a/ceph-volume-scenario/build/teardown b/ceph-volume-scenario/build/teardown index 793b3aab..dbd8c494 100644 --- a/ceph-volume-scenario/build/teardown +++ b/ceph-volume-scenario/build/teardown @@ -1,8 +1,10 @@ #!/bin/bash -cd $WORKSPACE/src/ceph-volume/ceph_volume/tests/functional +CEPH_VOLUME_FUNCTIONAL_TESTS_PATH=$WORKSPACE/src/ceph-volume/ceph_volume/tests/functional +COLLECT_LOGS_PLAYBOOK_PATH="$CEPH_VOLUME_FUNCTIONAL_TESTS_PATH/$SUBCOMMAND/.tox/${DISTRO}-${OBJECTSTORE}-${SCENARIO}/tmp/ceph-ansible/tests/functional/collect-logs.yml" +cd "$CEPH_VOLUME_FUNCTIONAL_TESTS_PATH" TEMPVENV=$(create_venv_dir) VENV=${TEMPVENV}/bin # the method exists in scripts/build_utils.sh -teardown_vagrant_tests $VENV +teardown_vagrant_tests "$VENV" "$COLLECT_LOGS_PLAYBOOK_PATH" diff --git a/scripts/build_utils.sh b/scripts/build_utils.sh index 3b5b9085..39156818 100755 --- a/scripts/build_utils.sh +++ b/scripts/build_utils.sh @@ -1280,13 +1280,19 @@ github_status_setup() { collect_ceph_logs() { local venv=$1 - shift # this is meant to be run in a testing scenario directory # with running vagrant vms. the ansible playbook will connect # to your test nodes and fetch any ceph logs that are present # in /var/log/ceph and store them on the jenkins builder. # these logs can then be archived using the JJB archive publisher - limit=$1 + + if [ -n "$2" ]; then + # set playbook path to overridden path + COLLECT_LOGS_PLAYBOOK_PATH="$2" + else + # set playbook path to default path + COLLECT_LOGS_PLAYBOOK_PATH="$WORKSPACE/tests/functional/collect-logs.yml" + fi if [ -f "./vagrant_ssh_config" ]; then mkdir -p $WORKSPACE/logs @@ -1297,13 +1303,13 @@ collect_ceph_logs() { export ANSIBLE_SSH_ARGS='-F ./vagrant_ssh_config' export ANSIBLE_STDOUT_CALLBACK='debug' export ANSIBLE_ROLES_PATH=$WORKSPACE/roles - $venv/ansible-playbook -vv -i hosts --limit $limit --extra-vars "archive_path=$WORKSPACE/logs" "$WORKSPACE/tests/functional/collect-logs.yml" || true + $venv/ansible-playbook -vv -i hosts --limit all --extra-vars "archive_path=$WORKSPACE/logs" "${COLLECT_LOGS_PLAYBOOK_PATH}" || true fi } teardown_vagrant_tests() { local venv=$1 - shift + local collect_logs_playbook_path=$2 # collect ceph logs and teardown any running vagrant vms # this also cleans up any lingering livirt networks @@ -1312,7 +1318,7 @@ teardown_vagrant_tests() { for scenario in $scenarios; do cd $scenario # collect all ceph logs from all test nodes - collect_ceph_logs $venv all + collect_ceph_logs "$venv" "$collect_logs_playbook_path" vagrant destroy -f stat ./fetch > /dev/null 2>&1 && rm -rf ./fetch cd - -- 2.39.5