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

Merge branch 'test-artifacts' into 'master'

Expose test artifacts to the Gitlab CI interface

See merge request !310
parents e5fbc06f 62fb5fc6
No related branches found
No related tags found
1 merge request!310Expose test artifacts to the Gitlab CI interface
Pipeline #84125 passed
......@@ -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
......
......@@ -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
}
......
......@@ -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"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment