From bcbd3452cfc84e4345c14ca0445454915976b9af Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Thu, 2 Jan 2025 18:22:04 +0100
Subject: [PATCH 01/12] Only fetch junit xml if it exists

---
 test/integration-test.yml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/test/integration-test.yml b/test/integration-test.yml
index bff929ae..11878109 100644
--- a/test/integration-test.yml
+++ b/test/integration-test.yml
@@ -22,16 +22,22 @@
     - 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 }}"
 
+    - 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 and pytest_xml_stat.exists"
 
     - name: Store test results locally
       local_action:
         module: copy
         dest: "pytest.xml"
         content: "{{ pytest_xml['content'] | b64decode }}"
+      when: "pytest_xml_stat and pytest_xml_stat.exists"
 
   vars:
     test_image: "registry.git.autistici.org/ai3/float:integration-test"
-- 
GitLab


From c7bd0dc22aa25738e94aed42a5d70fb706e59ebe Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Thu, 2 Jan 2025 18:28:19 +0100
Subject: [PATCH 02/12] Fix

---
 test/integration-test.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/integration-test.yml b/test/integration-test.yml
index 11878109..8a403fd0 100644
--- a/test/integration-test.yml
+++ b/test/integration-test.yml
@@ -30,14 +30,14 @@
       slurp:
         src: "/artifacts/pytest.xml"
       register: pytest_xml
-      when: "pytest_xml_stat and pytest_xml_stat.exists"
+      when: "pytest_xml_stat.exists | default(False)"
 
     - name: Store test results locally
       local_action:
         module: copy
         dest: "pytest.xml"
         content: "{{ pytest_xml['content'] | b64decode }}"
-      when: "pytest_xml_stat and pytest_xml_stat.exists"
+      when: "pytest_xml_stat.exists | default(False)"
 
   vars:
     test_image: "registry.git.autistici.org/ai3/float:integration-test"
-- 
GitLab


From c55715c50ba9ff6435443099b5791ad3f96c10a8 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Thu, 2 Jan 2025 18:42:48 +0100
Subject: [PATCH 03/12] Register test artifact with CI

---
 .gitlab-ci.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a1441637..6c8d366b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -42,6 +42,8 @@ variables:
     when: on_failure
     expire_in: 1 week
     name: "${CI_JOB_NAME}_${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}"
+    reports:
+      junit: pytest.xml
     paths:
       - "${BUILD_DIR}/ansible.log"
       - "${BUILD_DIR}/logs"
-- 
GitLab


From ac5d24d631bd1d75465b4aca442884ac1e4b9c24 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Thu, 2 Jan 2025 19:25:38 +0100
Subject: [PATCH 04/12] Always collect ci artifacts

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6c8d366b..39d568a3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -39,7 +39,7 @@ variables:
     TEST_DIR: ""
   tags: [ai3]
   artifacts:
-    when: on_failure
+    when: always
     expire_in: 1 week
     name: "${CI_JOB_NAME}_${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}"
     reports:
-- 
GitLab


From ad4e4d5def3b477868922b73058da5c2ffc753da Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Thu, 2 Jan 2025 19:41:33 +0100
Subject: [PATCH 05/12] Store pytest.xml in CI_PROJECT_DIR

---
 test/integration-test.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/integration-test.yml b/test/integration-test.yml
index 8a403fd0..e6a5723f 100644
--- a/test/integration-test.yml
+++ b/test/integration-test.yml
@@ -35,7 +35,7 @@
     - 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.exists | default(False)"
 
-- 
GitLab


From e19bb54cdc81ba36f20a566651a3ebc0aac3e9f5 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Thu, 2 Jan 2025 19:48:36 +0100
Subject: [PATCH 06/12] Run test playbook with -v

---
 test-driver | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test-driver b/test-driver
index 863c7176..715bf5c2 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} \
+        ${float_dir}/float run -v ${playbook} \
             || die "test playbook failed"
     done
 }
-- 
GitLab


From f76e4e38e3b79fa522dbb2d79d1fa8ae679283a8 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Thu, 2 Jan 2025 19:53:55 +0100
Subject: [PATCH 07/12] More verbosity

---
 test-driver | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test-driver b/test-driver
index 715bf5c2..b203f6b8 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 -v ${playbook} \
+        ${float_dir}/float run -e stdout_callback=default -v ${playbook} \
             || die "test playbook failed"
     done
 }
-- 
GitLab


From 13f0385bcaa1c7bd429bd66f757d1d1ccf07bd20 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Thu, 2 Jan 2025 19:56:23 +0100
Subject: [PATCH 08/12] Revert "More verbosity"

This reverts commit 17735986d474595e6fff17e12f542ea7f12c00c7.
---
 test-driver | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test-driver b/test-driver
index b203f6b8..715bf5c2 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 -e stdout_callback=default -v ${playbook} \
+        ${float_dir}/float run -v ${playbook} \
             || die "test playbook failed"
     done
 }
-- 
GitLab


From c80d8c24149430055a3ae3af49f359ef9be5a43f Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Thu, 2 Jan 2025 19:57:24 +0100
Subject: [PATCH 09/12] More verbosity / 2

---
 test-driver | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test-driver b/test-driver
index 715bf5c2..1e20cd33 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 -v ${playbook} \
+        ANSIBLE_STDOUT_CALLBACK=default ${float_dir}/float run ${playbook} \
             || die "test playbook failed"
     done
 }
-- 
GitLab


From 1a304a502d2c3dced8155b62579186e569f5c345 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Fri, 3 Jan 2025 17:06:45 +0100
Subject: [PATCH 10/12] Increase verbosity in test playbook

---
 test-driver | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test-driver b/test-driver
index 1e20cd33..671d8e6a 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}
-        ANSIBLE_STDOUT_CALLBACK=default ${float_dir}/float run ${playbook} \
+        ANSIBLE_STDOUT_CALLBACK=default ANSIBLE_CALLBACKS_ENABLED=default ${float_dir}/float run -vv ${playbook} \
             || die "test playbook failed"
     done
 }
-- 
GitLab


From c5623f9afc648918f5c9c7e66079cac34133dbfe Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Fri, 3 Jan 2025 17:12:46 +0100
Subject: [PATCH 11/12] Fix Ansible fetch of pytest.xml

---
 test/integration-test.yml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/test/integration-test.yml b/test/integration-test.yml
index e6a5723f..3000cd1e 100644
--- a/test/integration-test.yml
+++ b/test/integration-test.yml
@@ -22,7 +22,8 @@
     - 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 }}"
 
-    - stat:
+    - name: Check existence of pytest.xml
+      stat:
         path: "/artifacts/pytest.xml"
       register: pytest_xml_stat
 
@@ -30,14 +31,14 @@
       slurp:
         src: "/artifacts/pytest.xml"
       register: pytest_xml
-      when: "pytest_xml_stat.exists | default(False)"
+      when: "pytest_xml_stat.stat.exists"
 
     - name: Store test results locally
       local_action:
         module: copy
         dest: "{{ lookup('env', 'CI_PROJECT_DIR') | default('..') }}/pytest.xml"
         content: "{{ pytest_xml['content'] | b64decode }}"
-      when: "pytest_xml_stat.exists | default(False)"
+      when: "pytest_xml_stat.stat.exists"
 
   vars:
     test_image: "registry.git.autistici.org/ai3/float:integration-test"
-- 
GitLab


From b67991e69cef954ccbfb0a0a03c000dc73d9248e Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Fri, 3 Jan 2025 17:43:01 +0100
Subject: [PATCH 12/12] Do not shadow artifacts in full_review job

---
 .gitlab-ci.yml | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 39d568a3..533f48d3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -38,13 +38,16 @@ variables:
     CREATE_ENV_VARS: ""
     TEST_DIR: ""
   tags: [ai3]
+  # Some artifacts may be missing, depending on the specific job.
   artifacts:
     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"
 
@@ -74,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
-- 
GitLab