From 044d71bd779a263c50a0bac1edddbaaf4f1a2b65 Mon Sep 17 00:00:00 2001 From: Ryan Emerson Date: Wed, 23 Oct 2024 14:19:10 +0100 Subject: [PATCH] Aurora IT tests failing periodically with download of node (#34107) Closes #33767 Co-authored-by: Jon Koops Signed-off-by: Ryan Emerson --- .github/actions/maven-cache/action.yml | 18 +++------------- .github/actions/node-cache/action.yml | 21 +++++++++++++++++++ .../scripts/ansible/keycloak_ec2_installer.sh | 4 +++- .../keycloak_ec2_installer/defaults/main.yml | 1 + .../keycloak_ec2_installer/tasks/install.yml | 7 +++++++ .github/workflows/ci.yml | 7 ++++++- 6 files changed, 41 insertions(+), 17 deletions(-) create mode 100644 .github/actions/node-cache/action.yml diff --git a/.github/actions/maven-cache/action.yml b/.github/actions/maven-cache/action.yml index 8d66ff851e..fbfbfb2d3a 100644 --- a/.github/actions/maven-cache/action.yml +++ b/.github/actions/maven-cache/action.yml @@ -54,18 +54,6 @@ runs: key: ${{ steps.weekly-cache-key.outputs.key }} enableCrossOsArchive: true - - name: Get Node.js and PNPM versions - id: tooling-versions - shell: bash - run: | - echo "node=$(mvn help:evaluate -Dexpression=node.version -q -DforceStdout | cut -c 2-)" >> $GITHUB_OUTPUT - echo "pnpm=$(mvn help:evaluate -Dexpression=pnpm.version -q -DforceStdout)" >> $GITHUB_OUTPUT - - # Downloading Node.js often fails due to network issues, therefore we cache the artifacts downloaded by the frontend plugin. - - uses: actions/cache@v4 - name: Cache Node.js related artifacts - with: - path: | - ~/.m2/repository/com/github/eirslett/node - ~/.m2/repository/com/github/eirslett/pnpm - key: ${{ runner.os }}-frontend-plugin-artifacts-${{ steps.tooling-versions.outputs.node }}-${{ steps.tooling-versions.outputs.pnpm }} + - id: node-cache + name: Node cache + uses: ./.github/actions/node-cache diff --git a/.github/actions/node-cache/action.yml b/.github/actions/node-cache/action.yml new file mode 100644 index 0000000000..9bcfb69d49 --- /dev/null +++ b/.github/actions/node-cache/action.yml @@ -0,0 +1,21 @@ +name: Node Cache +description: Caches Node and PNPM binaries + +runs: + using: composite + steps: + - name: Get Node.js and PNPM versions + id: tooling-versions + shell: bash + run: | + echo "node=$(mvn help:evaluate -Dexpression=node.version -q -DforceStdout | cut -c 2-)" >> $GITHUB_OUTPUT + echo "pnpm=$(mvn help:evaluate -Dexpression=pnpm.version -q -DforceStdout)" >> $GITHUB_OUTPUT + + # Downloading Node.js often fails due to network issues, therefore we cache the artifacts downloaded by the frontend plugin. + - uses: actions/cache@v4 + name: Cache Node.js and PNPM binaries + with: + path: | + ~/.m2/repository/com/github/eirslett/node + ~/.m2/repository/com/github/eirslett/pnpm + key: ${{ runner.os }}-frontend-plugin-artifacts-${{ steps.tooling-versions.outputs.node }}-${{ steps.tooling-versions.outputs.pnpm }} diff --git a/.github/scripts/ansible/keycloak_ec2_installer.sh b/.github/scripts/ansible/keycloak_ec2_installer.sh index f91237d8ce..5d04ed1c4e 100755 --- a/.github/scripts/ansible/keycloak_ec2_installer.sh +++ b/.github/scripts/ansible/keycloak_ec2_installer.sh @@ -9,6 +9,8 @@ fi REGION=$1 CLUSTER_NAME=$2 KEYCLOAK_SRC=$3 +MAVEN_ARCHIVE=$4 ansible-playbook -i ${CLUSTER_NAME}_${REGION}_inventory.yml keycloak.yml \ - -e "keycloak_src=\"${KEYCLOAK_SRC}\"" + -e "keycloak_src=\"${KEYCLOAK_SRC}\"" \ + -e "maven_archive=\"${MAVEN_ARCHIVE}\"" diff --git a/.github/scripts/ansible/roles/keycloak_ec2_installer/defaults/main.yml b/.github/scripts/ansible/roles/keycloak_ec2_installer/defaults/main.yml index 1079802a0e..b0f7a3190f 100644 --- a/.github/scripts/ansible/roles/keycloak_ec2_installer/defaults/main.yml +++ b/.github/scripts/ansible/roles/keycloak_ec2_installer/defaults/main.yml @@ -2,6 +2,7 @@ ansible_ssh_user: ec2-user # Workspace on the remote hosts kc_home: /opt/keycloak +m2_home: ~/.m2 update_system_packages: no install_java: yes java_version: 21 diff --git a/.github/scripts/ansible/roles/keycloak_ec2_installer/tasks/install.yml b/.github/scripts/ansible/roles/keycloak_ec2_installer/tasks/install.yml index a86db4e1bf..0c19fbacf8 100644 --- a/.github/scripts/ansible/roles/keycloak_ec2_installer/tasks/install.yml +++ b/.github/scripts/ansible/roles/keycloak_ec2_installer/tasks/install.yml @@ -27,3 +27,10 @@ src: "{{ keycloak_src }}" dest: "{{ kc_home }}" owner: "{{ ansible_ssh_user }}" + +- name: Install Maven repository on the remote hosts + unarchive: + src: "{{ maven_archive }}" + creates: "{{ kc_home }}" + dest: "{{ kc_home }}" + owner: "{{ ansible_ssh_user }}" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 846f5ffefd..659248dc89 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -418,6 +418,10 @@ jobs: steps: - uses: actions/checkout@v4 + - id: node-cache + name: Node cache + uses: ./.github/actions/node-cache + - id: aurora-init name: Initialize Aurora environment run: | @@ -457,6 +461,7 @@ jobs: git archive --format=zip --output /tmp/keycloak.zip $GITHUB_REF zip -u /tmp/keycloak.zip aws.pem + tar -C ~/ -czvf m2.tar.gz .m2 cd .github/scripts/ansible python3 -m venv .venv @@ -464,7 +469,7 @@ jobs: ./aws_ec2.sh requirements pipx inject ansible-core boto3 botocore ./aws_ec2.sh create ${AWS_REGION} ${EC2_CLUSTER_NAME} - ./keycloak_ec2_installer.sh ${AWS_REGION} ${EC2_CLUSTER_NAME} /tmp/keycloak.zip + ./keycloak_ec2_installer.sh ${AWS_REGION} ${EC2_CLUSTER_NAME} /tmp/keycloak.zip m2.tar.gz ./mvn_ec2_runner.sh ${AWS_REGION} ${EC2_CLUSTER_NAME} "clean install -B -DskipTests -Pdistribution" ./mvn_ec2_runner.sh ${AWS_REGION} ${EC2_CLUSTER_NAME} "clean install -B -DskipTests -pl testsuite/integration-arquillian/servers/auth-server/quarkus -Pauth-server-quarkus -Pdb-aurora-postgres -Dmaven.build.cache.enabled=true"