Skip to content

Commit

Permalink
common: update files for updating repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
osalyk committed Jul 11, 2024
1 parent 0f3c4ec commit 0a8c25a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
17 changes: 2 additions & 15 deletions .github/workflows/pmem_ras.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,7 @@ jobs:
- name: Clone the git repo
uses: actions/checkout@v4

# Variables, such as $ras_runner are hidden on the controller platform as environmental variables.
# 'sed' command is used to filter out IP addresses from the ansible output, it will show up as the 'ras_runner' instead.
# 'tee' command is used to save the overall output to the file. This file is needed for the next step.
# Variables, such as $ras_runner are set on the controller platform as environment variables.
- name: Prepare and run RAS Linux tests via ansible-playbook
working-directory: ${{ env.WORKDIR }}
run: ansible-playbook -i $ras_runner, run-ras-linux.yml -e "host=all ansible_user=$ras_user" | sed 's/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/ras_runner/' | tee playbook_output.txt

# This simple step will look through the output in search of specific fail strings.
# The workflow will fail if any of the expected phrases are found in the file.
- name: Fail the workflow if the playbook finished with a failure
working-directory: ${{ env.WORKDIR }}
run: |
if grep -E '(fatal|failed): \[ras_runner\]' playbook_output.txt; then
exit 1
else
exit 0
fi
run: ansible-playbook -i $ras_runner, run-ras-linux.yml -e "host=all ansible_user=$ras_user"
25 changes: 22 additions & 3 deletions utils/gha-runners/run-ras-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@
#

- hosts: '{{ host }}'
any_errors_fatal: true

vars:
bash_path: /bin/bash
working_dir_path: "/var/tmp/rasUnsafeShutdown"
logs_dir_path: "/var/tmp/raslogs"
working_dir_path: "/home/pmdkuser/rasUnsafeShutdown"
logs_dir_path: "/home/pmdkuser/raslogs"
test_dir_path: "{{ working_dir_path }}/testDir"
pmdk_install_dir_path: "{{ working_dir_path }}/pmdkInstallTarget"
pmdk_tests_build_dir_path: "{{ working_dir_path }}/pmdkTestsBuild"
Expand Down Expand Up @@ -174,11 +175,29 @@
with_items: "{{ workspace_dirs }}"

# The 'Main' branch is used for both repositories.
- name: "Clone repositories"
- name: "Ensure the working directory exists"
file:
path: "{{ working_dir_path }}"
state: directory

- name: "Remove the PMDK repository if present"
file:
path: "{{ pmdk_install_dir_path }}"
state: absent
force: yes

- name: "Remove the PMDK-test repository if present"
file:
path: "{{ repo.pmdk_tests.target_dir }}"
state: absent
force: yes

- name: "Clone the PMDK & PMDK-test repositories"
git:
repo: "{{ item.value.url }}"
dest: "{{ item.value.target_dir }}"
version: "{{ item.value.branch }}"
force: yes
with_dict: "{{ repo }}"

- name: "Build PMDK"
Expand Down

0 comments on commit 0a8c25a

Please sign in to comment.