Skip to content
Snippets Groups Projects
Commit 62fb5fc6 authored by ale's avatar ale
Browse files

Expose test artifacts to the Gitlab CI interface

parent e5fbc06f
Branches
No related tags found
1 merge request!310Expose test artifacts to the Gitlab CI interface
...@@ -38,11 +38,16 @@ variables: ...@@ -38,11 +38,16 @@ variables:
CREATE_ENV_VARS: "" CREATE_ENV_VARS: ""
TEST_DIR: "" TEST_DIR: ""
tags: [ai3] tags: [ai3]
# Some artifacts may be missing, depending on the specific job.
artifacts: artifacts:
when: on_failure when: always
expire_in: 1 week expire_in: 1 week
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}" name: "${CI_JOB_NAME}_${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}"
reports:
dotenv: deploy.env
junit: pytest.xml
paths: paths:
- ".vmine_group_review*"
- "${BUILD_DIR}/ansible.log" - "${BUILD_DIR}/ansible.log"
- "${BUILD_DIR}/logs" - "${BUILD_DIR}/logs"
...@@ -72,11 +77,6 @@ full_test_review: ...@@ -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" 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" TEST_DIR: "test/full.ref"
allow_failure: true allow_failure: true
artifacts:
when: always
reports:
dotenv: deploy.env
paths: ['.vmine_group_review*']
environment: environment:
name: review/$CI_COMMIT_REF_SLUG name: review/$CI_COMMIT_REF_SLUG
url: $VMINE_GROUP_URL url: $VMINE_GROUP_URL
......
...@@ -131,7 +131,7 @@ do_provision() { ...@@ -131,7 +131,7 @@ do_provision() {
do_test() { do_test() {
for playbook in "${float_dir}/test/integration-test.yml" "$@"; do for playbook in "${float_dir}/test/integration-test.yml" "$@"; do
log Running test playbook ${playbook} 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" || die "test playbook failed"
done done
} }
......
...@@ -22,16 +22,23 @@ ...@@ -22,16 +22,23 @@
- name: Run tests - 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 }}" 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 - name: Retrieve test result
slurp: slurp:
src: "/artifacts/pytest.xml" src: "/artifacts/pytest.xml"
register: pytest_xml register: pytest_xml
when: "pytest_xml_stat.stat.exists"
- name: Store test results locally - name: Store test results locally
local_action: local_action:
module: copy module: copy
dest: "pytest.xml" dest: "{{ lookup('env', 'CI_PROJECT_DIR') | default('..') }}/pytest.xml"
content: "{{ pytest_xml['content'] | b64decode }}" content: "{{ pytest_xml['content'] | b64decode }}"
when: "pytest_xml_stat.stat.exists"
vars: vars:
test_image: "registry.git.autistici.org/ai3/float:integration-test" test_image: "registry.git.autistici.org/ai3/float:integration-test"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment