Files
dc-deployments-automation/pipeline_generator/templates/bitbucket-pipelines.yml.j2
2025-09-26 11:02:43 -05:00

62 lines
1.9 KiB
Django/Jinja

---
# This file was generated; to regnerated `cd` to `pipeline_generator`
# and run:
#
# make > ../bitbucket-pipelines.yml
image: debian:bookworm
options:
size: 2x
definitions:
caches:
ansible-collections: ansible_collections
pre-commit: ~/.cache/pre-commit
services:
docker:
memory: 4096
pipelines:
default:
- step:
name: Pre-commit
image: python:3.9
caches:
- pre-commit
script:
- apt update && apt install -y pipenv
- pipenv sync --dev
- pipenv run pre-commit run --all-files
- step:
name: Pre Parallelization stage
script:
- echo "Running tests in {{ scenario_paths|length }} batches"
- step:
name: Check if the template is up-to-date
script:
- |
actual_scenario_count=$(find ./roles -type f -name "molecule.yml" -exec dirname {} ';' | wc -l | sed -e 's/^[[:space:]]*//')
if ! grep -q "Running tests in ${actual_scenario_count} batches" bitbucket-pipelines.yml; then
echo "Mismatch between expected ({{ scenario_paths|length }}) and actual number (${actual_scenario_count}) of scenarios. Please look at https://bitbucket.org/atlassian/dc-deployments-automation/src/master/DEVELOPMENT.md for instructions on how to fix this error."
exit 1
fi
- parallel:
{% for spath in scenario_paths %}
- step:
name: {{ spath.parts[2] }}/{{ spath.parts[4] }}
caches:
- ansible-collections
- docker
- pip
services:
- docker
script:
- apt-get update && apt-get install -y rsync
- export ANSIBLE_CONFIG=./ansible.cfg
- ./bin/install-ansible --dev
- cd roles/{{ spath.parts[2] }}
- pipenv run molecule test -s {{ spath.parts[4] }}
{% endfor %}