Skip to content
This repository has been archived by the owner on Jun 19, 2023. It is now read-only.

Commit

Permalink
ci(GITHUB): simplify ansible cache
Browse files Browse the repository at this point in the history
  • Loading branch information
niall-byrne committed Feb 18, 2023
1 parent 801de83 commit 99c8215
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
14 changes: 11 additions & 3 deletions .github/scripts/ansible_cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# .github/scripts/ansible_cache.sh
# Creates symlinks for attaching an external cache folder for Ansible.
# Separate folders for Roles, and Collections are maintained.
# Separate folders for Ansible-Compat, and Molecule are maintained.

# 1: The absolute path of the mount point of the external cache folder.
# 2: The absolute path of the usage point of the cache on the system.
Expand All @@ -16,9 +16,17 @@ main () {
MOUNT_FOLDER="${1}"
USAGE_FOLDER="${2}"

mkdir -p "${MOUNT_FOLDER}"
mkdir -p "${MOUNT_FOLDER}/ansible-compat"
mkdir -p "${MOUNT_FOLDER}/molecule"

ln -sf "${MOUNT_FOLDER}" "${USAGE_FOLDER}"
mkdir -p "${USAGE_FOLDER}"

ln -sf "${MOUNT_FOLDER}/ansible-compat" "${USAGE_FOLDER}/ansible-compat"
ln -sf "${MOUNT_FOLDER}/molecule" "${USAGE_FOLDER}/molecule"

echo "Cache Symlinks Created:"
echo "${MOUNT_FOLDER}/ansible-compat -> ${USAGE_FOLDER}/ansible-compat"
echo "${MOUNT_FOLDER}/molecule -> ${USAGE_FOLDER}/molecule"

}

Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,8 @@ jobs:
run: |
mkdir -p ~/.cache/pypoetry/virtualenvs/
source ./role/.github/scripts/ansible_cache.sh \
"$(pwd)/ansible_cache/ansible-compat" \
~/.cache/ansible-compat
source ./role/.github/scripts/ansible_cache.sh \
"$(pwd)/ansible_cache/molecule" \
~/.cache/molecule
"$(pwd)/ansible_cache" \
~/.cache
- name: Molecule Lint -- Mount Ansible Cache
uses: actions/cache@v3
Expand Down Expand Up @@ -270,11 +267,8 @@ jobs:
run: |
mkdir -p ~/.cache/pypoetry/virtualenvs
source ./role/.github/scripts/ansible_cache.sh \
"$(pwd)/ansible_cache/ansible-compat" \
~/.cache/ansible-compat
source ./role/.github/scripts/ansible_cache.sh \
"$(pwd)/ansible_cache/molecule" \
~/.cache/molecule
"$(pwd)/ansible_cache" \
~/.cache
- name: OSX Build -- Mount Ansible Cache
uses: actions/cache@v3
Expand Down

0 comments on commit 99c8215

Please sign in to comment.