-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OPSEXP-2972 Workaround apache mirror flakiness with controller cache (#…
…999)
- Loading branch information
Showing
10 changed files
with
141 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: 'Cache downloads' | ||
description: 'Cache downloads to speed up the workflow' | ||
inputs: | ||
cache-name: | ||
description: 'A keyword to compose the cache final name' | ||
required: true | ||
default: 'default' | ||
cache-version: | ||
description: 'Increase to force recreating the cache' | ||
required: true | ||
default: "1" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Restore downloaded artifacts | ||
id: artifacts-cache | ||
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 | ||
with: | ||
path: 'downloads/**' | ||
key: cache-downloads-v${{ inputs.cache-version }}-${{ inputs.cache-name }}-${{ hashFiles('group_vars/all.yml') }}-${{ hashFiles('playbooks/prefetch-artifacts.yml') }} | ||
|
||
- name: Prefetch artifacts | ||
shell: bash | ||
if: steps.artifacts-cache.outputs.cache-hit != 'true' | ||
run: | | ||
pipenv run ansible-playbook -i inventory_local.yml playbooks/prefetch-artifacts.yml | ||
- name: Save downloaded artifacts | ||
uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2 | ||
if: steps.artifacts-cache.outputs.cache-hit != 'true' | ||
with: | ||
path: 'downloads/**' | ||
key: ${{ steps.artifacts-cache.outputs.cache-primary-key }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Download artifacts from flaky mirrors and cache them on the controller for later use. | ||
# Particularly useful when running on CI or nodes with limited internet access. | ||
# Run with `ansible-playbook -i inventory_local.yml playbooks/prefetch-artifacts.yml` | ||
- name: Download and cache artifacts on the controller | ||
hosts: localhost | ||
gather_facts: true | ||
tasks: | ||
- name: Include common vars | ||
ansible.builtin.include_vars: ../roles/common/{{ item }}/main.yml | ||
loop: ["defaults", "vars"] | ||
|
||
- name: Set path for local download | ||
ansible.builtin.stat: | ||
path: "{{ lookup('env', 'GITHUB_WORKSPACE') | default(lookup('env', 'PWD'), True) }}" | ||
register: local_path | ||
|
||
- name: Create download location | ||
ansible.builtin.file: | ||
path: "{{ local_path.stat.path }}/downloads" | ||
state: directory | ||
mode: "0755" | ||
register: download_path | ||
|
||
- name: Download ActiveMQ archive | ||
ansible.builtin.get_url: | ||
url: "{{ dependencies_url.activemq }}" | ||
checksum: sha512:{{ dependencies_url.activemq_sha512_checksum_url }} | ||
dest: "{{ download_path.path }}/apache-activemq-{{ dependencies_version.activemq }}-bin.tar.gz" | ||
mode: "0644" | ||
|
||
- name: Download Tomcat archive | ||
ansible.builtin.get_url: | ||
url: "{{ dependencies_url.tomcat }}" | ||
checksum: sha512:{{ dependencies_url.tomcat_sha512_checksum_url }} | ||
dest: "{{ download_path.path }}/apache-tomcat-{{ dependencies_version.tomcat }}.tar.gz" | ||
mode: "0644" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters