Skip to content

ci: improve ansible collection install robustness and pre-commit performance#211

Merged
l50 merged 1 commit intomainfrom
fix/ansible-galaxy-retry-resilience
Apr 16, 2026
Merged

ci: improve ansible collection install robustness and pre-commit performance#211
l50 merged 1 commit intomainfrom
fix/ansible-galaxy-retry-resilience

Conversation

@l50
Copy link
Copy Markdown
Contributor

@l50 l50 commented Apr 16, 2026

Key Changes:

  • Implement retry logic for Ansible collection installation in CI workflows
  • Add caching for Ansible collections to speed up pre-commit CI runs
  • Restrict pre-commit Ansible hooks to only run on relevant files for efficiency

Added:

  • Ansible collections caching step in pre-commit GitHub Actions workflow to utilize cache based on requirements.yml hash

Changed:

  • Ansible collection install steps in molecule and pre-commit workflows now use up to five retries with increasing sleep intervals and explicit timeout settings to reduce transient failures
  • Set ANSIBLE_GALAXY_SERVER_TIMEOUT environment variable to 120 seconds for more robust dependency installs in CI
  • Pre-commit Ansible lint and documentation hooks now only run on changes within the ansible/ directory and no longer always run, improving CI performance and reducing unnecessary runs

Removed:

  • Automatic always-run behavior for pre-commit Ansible lint and documentation hooks, limiting their scope to relevant file changes

…kflows

**Added:**

- Introduced retry logic with exponential backoff for Ansible Galaxy collection installs in both molecule and pre-commit workflows to improve reliability in case of network issues
- Added caching for Ansible collections in the pre-commit workflow using actions/cache to speed up repeated runs

**Changed:**

- Set ANSIBLE_GALAXY_SERVER_TIMEOUT environment variable to 120 seconds for collection installs in all workflows to handle slow servers
- Modified ansible-lint and docsible pre-commit hooks to only run on files within the `ansible/` directory and set `always_run` to false in `.pre-commit-config.yaml` to limit unnecessary executions

**Removed:**

- Removed unconditional ansible-galaxy install steps without retry logic from molecule and pre-commit workflows
@dreadnode-renovate-bot dreadnode-renovate-bot Bot added area/pre-commit Changes made to pre-commit hooks area/github Changes made to GitHub Actions workflows labels Apr 16, 2026
@l50 l50 merged commit f02a5cb into main Apr 16, 2026
8 checks passed
@l50 l50 deleted the fix/ansible-galaxy-retry-resilience branch April 16, 2026 21:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/github Changes made to GitHub Actions workflows area/pre-commit Changes made to pre-commit hooks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant