From c30b9545ef013b4c3083a4c251ebd3db505180d0 Mon Sep 17 00:00:00 2001 From: Ryan Emerson Date: Fri, 16 Feb 2024 10:57:56 +0000 Subject: [PATCH] Aurora Postgres IT: Upload flaky and surefire test reports Closes #26967 Signed-off-by: Ryan Emerson Signed-off-by: Alexander Schwartz Co-authored-by: Alexander Schwartz --- .../roles/mvn_ec2_runner/tasks/run.yml | 33 +++++++++++++++++-- .github/workflows/ci.yml | 13 +++++--- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/.github/scripts/ansible/roles/mvn_ec2_runner/tasks/run.yml b/.github/scripts/ansible/roles/mvn_ec2_runner/tasks/run.yml index 13a0ac2aa03..dbeb5e508d1 100644 --- a/.github/scripts/ansible/roles/mvn_ec2_runner/tasks/run.yml +++ b/.github/scripts/ansible/roles/mvn_ec2_runner/tasks/run.yml @@ -13,13 +13,40 @@ ignore_errors: yes - name: Run mvn command on the remote hosts - # Kill any currently running Java process from a previous (possibly aborted) run before starting the next. - shell: | + ansible.builtin.shell: | + set -o pipefail cd {{ kc_home }} ./mvnw {{ mvn_params }} - # Executing load run can be scheduled for hours. To prevent the test from failing when the SSH connection breaks, use asynchronous polling. + executable: /usr/bin/bash + # Tests can run for hours. To prevent the test from failing when the SSH connection breaks, use asynchronous polling. async: 86400 poll: 10 register: result - debug: var=result + +- name: Recursively find surefire-report directories + ansible.builtin.find: + file_type: directory + paths: "{{ kc_home }}" + patterns: "surefire-reports*" + recurse: true + register: output + +- debug: var=output + +- name: Create local results directories + delegate_to: localhost + file: + path: "{{ local_results_dir }}/{{ item.path | replace(kc_home, '') }}" + state: directory + with_items: + - "{{ output.files }}" + +- name: Copy surefire-report directories to localhost + synchronize: + src: "{{ item.path }}/" + dest: "{{ local_results_dir }}/{{ item.path | replace(kc_home, '') }}" + mode: pull + with_items: + - "{{ output.files }}" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fdf99bef4d4..c5fa9dcd698 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: - id: conditional-stores run: | STORES="postgres, mysql, oracle, mssql, mariadb" - if [ $GITHUB_EVENT_NAME != "pull_request" ]; then + if [[ $GITHUB_EVENT_NAME != "pull_request" && -n "${{ secrets.AWS_SECRET_ACCESS_KEY }}" ]]; then STORES+=", aurora-postgres" fi echo "matrix=$(echo $STORES | jq -Rc 'split(", ")')" >> $GITHUB_OUTPUT @@ -371,9 +371,14 @@ jobs: ./aws_ec2.sh requirements ./aws_ec2.sh create ${REGION} ./keycloak_ec2_installer.sh ${REGION} /tmp/keycloak.zip - ./mvn_ec2_runner.sh ${REGION} "clean install -DskipTests -Pdistribution" - ./mvn_ec2_runner.sh ${REGION} "clean install -DskipTests -pl testsuite/integration-arquillian/servers/auth-server/quarkus -Pauth-server-quarkus -Dmaven.build.cache.enabled=true" - ./mvn_ec2_runner.sh ${REGION} "test ${{ env.SUREFIRE_RETRY }} -Pauth-server-quarkus -Pdb-${{ matrix.db }} $PROPS -Dtest=$TESTS -pl testsuite/integration-arquillian/tests/base" + ./mvn_ec2_runner.sh ${REGION} "clean install -B -DskipTests -Pdistribution" + ./mvn_ec2_runner.sh ${REGION} "clean install -B -DskipTests -pl testsuite/integration-arquillian/servers/auth-server/quarkus -Pauth-server-quarkus -Dmaven.build.cache.enabled=true" + ./mvn_ec2_runner.sh ${REGION} "test -B ${{ env.SUREFIRE_RETRY }} -Pauth-server-quarkus -Pdb-${{ matrix.db }} $PROPS -Dtest=$TESTS -pl testsuite/integration-arquillian/tests/base 2>&1 | misc/log/trimmer.sh" + + # Copy returned surefire-report directories to workspace root to ensure they're discovered + results=(files/keycloak/results/*) + rsync -a $results/* ../../../ + rm -rf $results - name: Run base tests if: ${{ matrix.db != 'aurora-postgres' }}