diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a144163709ebbfc70770a022bb9b425ea58df874..533f48d30e30a1a7acfc8f9e49d6e420309f2597 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,11 +38,16 @@ variables: CREATE_ENV_VARS: "" TEST_DIR: "" tags: [ai3] + # Some artifacts may be missing, depending on the specific job. artifacts: - when: on_failure + when: always expire_in: 1 week name: "${CI_JOB_NAME}_${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}" + reports: + dotenv: deploy.env + junit: pytest.xml paths: + - ".vmine_group_review*" - "${BUILD_DIR}/ansible.log" - "${BUILD_DIR}/logs" @@ -72,11 +77,6 @@ full_test_review: FLOATUP_ARGS: "--state-file .vmine_group_review_$CI_MERGE_REQUEST_ID --ttl 6h --env deploy.env --dashboard-url https://vm.investici.org" TEST_DIR: "test/full.ref" allow_failure: true - artifacts: - when: always - reports: - dotenv: deploy.env - paths: ['.vmine_group_review*'] environment: name: review/$CI_COMMIT_REF_SLUG url: $VMINE_GROUP_URL diff --git a/test-driver b/test-driver index 863c71768276eac96af1cb3d2487981c076bf6ff..671d8e6a4f00448ca28605b881c4238e22c8c45b 100755 --- a/test-driver +++ b/test-driver @@ -131,7 +131,7 @@ do_provision() { do_test() { for playbook in "${float_dir}/test/integration-test.yml" "$@"; do log Running test playbook ${playbook} - ${float_dir}/float run ${playbook} \ + ANSIBLE_STDOUT_CALLBACK=default ANSIBLE_CALLBACKS_ENABLED=default ${float_dir}/float run -vv ${playbook} \ || die "test playbook failed" done } diff --git a/test/integration-test.yml b/test/integration-test.yml index bff929ae0f60c2d160a9932eb25c083e346e7b21..3000cd1e45551b36db3a6de11852de8861d8ad38 100644 --- a/test/integration-test.yml +++ b/test/integration-test.yml @@ -22,16 +22,23 @@ - name: Run tests command: "podman run --rm --network host --mount type=bind,source=/tmp/test-config.yml,destination=/test-config.yml --mount type=bind,source=/artifacts,destination=/artifacts {{ test_image }}" + - name: Check existence of pytest.xml + stat: + path: "/artifacts/pytest.xml" + register: pytest_xml_stat + - name: Retrieve test result slurp: src: "/artifacts/pytest.xml" register: pytest_xml + when: "pytest_xml_stat.stat.exists" - name: Store test results locally local_action: module: copy - dest: "pytest.xml" + dest: "{{ lookup('env', 'CI_PROJECT_DIR') | default('..') }}/pytest.xml" content: "{{ pytest_xml['content'] | b64decode }}" + when: "pytest_xml_stat.stat.exists" vars: test_image: "registry.git.autistici.org/ai3/float:integration-test"