From 3291009d720f04cf040376f77dae2f9ab8f6027a Mon Sep 17 00:00:00 2001 From: Teake Nutma <t.a.nutma@rug.nl> Date: Tue, 14 Jun 2022 14:43:06 +0200 Subject: [PATCH] Add missing files to ci-tools and conditionally compare reports --- dockerfiles/ci-tools/Dockerfile | 2 ++ templates/report/changes.yml | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dockerfiles/ci-tools/Dockerfile b/dockerfiles/ci-tools/Dockerfile index 5a56838..b943026 100644 --- a/dockerfiles/ci-tools/Dockerfile +++ b/dockerfiles/ci-tools/Dockerfile @@ -35,6 +35,8 @@ RUN mkdir -p ~/.ssh RUN echo "Host *\n\tStrictHostKeyChecking no" > ~/.ssh/config COPY ssh-addkey.sh /usr/local/bin/ssh-addkey COPY python-gitlab-set-private-token.sh /usr/local/bin/python-gitlab-set-private-token +COPY report_badge.py /usr/local/bin/report_badge +COPY report_compare.py /usr/local/bin/report_compare COPY entrypoint.sh /usr/local/bin/entrypoint ENTRYPOINT [ "/bin/bash", "/usr/local/bin/entrypoint" ] diff --git a/templates/report/changes.yml b/templates/report/changes.yml index f3edf84..67f1bd2 100644 --- a/templates/report/changes.yml +++ b/templates/report/changes.yml @@ -11,9 +11,15 @@ report_changes: - if: $CI_AWE_RUN_REPORT_CHANGES - !reference [.primary_ref_jobs, rules] script: - - 'curl --output "$REPORT_CHANGES_FILE.old" --location --header "JOB-TOKEN: $CI_JOB_TOKEN" "$REPORT_CHANGES_ARTIFACT_URL"' - - report_compare "$REPORT_CHANGES_FILE.old" "$REPORT_CHANGES_ARTIFACT_FILE" report_changes.xml - - junitparser verify report_changes.xml + - | + if ! junitparser verify "$REPORT_CHANGES_ARTIFACT_FILE"; then + echo "Test report of this pipeline contains failures. Comparing it to the previous run." + # Download the report of the previous pipeline. + curl --output "$REPORT_CHANGES_FILE.old" --location --header "JOB-TOKEN: $CI_JOB_TOKEN" "$REPORT_CHANGES_ARTIFACT_URL" + # Compare it to the report of this pipeline. + report_compare "$REPORT_CHANGES_FILE.old" "$REPORT_CHANGES_ARTIFACT_FILE" report_changes.xml + junitparser verify report_changes.xml + fi artifacts: expire_in: 1 day reports: -- GitLab