forked from ome/prod-playbooks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
526d88b
commit d6017b4
Showing
1 changed file
with
61 additions
and
58 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 |
---|---|---|
@@ -1,59 +1,62 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
options: | ||
role-file: requirements.yml | ||
driver: | ||
name: docker | ||
lint: | | ||
yamllint . | ||
ansible-lint | ||
flake8 | ||
platforms: | ||
- name: ome-outreach | ||
image: centos/systemd | ||
command: /sbin/init | ||
privileged: true | ||
groups: | ||
- docker-hosts | ||
- omero-server | ||
- omero-web | ||
- monitored | ||
provisioner: | ||
name: ansible | ||
inventory: | ||
group_vars: | ||
all: | ||
molecule_test: true | ||
postgresql_version: "13" | ||
docker-hosts: | ||
# This should allow docker-in-docker to work | ||
docker_storage_driver: vfs | ||
# Latest version 17.12.1.ce-1.el7.centos has a bug that prevents | ||
# testing on travis: https://github.com/docker/for-linux/issues/219 | ||
docker_version: 17.09.1.ce-1.el7.centos | ||
# firewalld isn't installed, don't attempt to disable | ||
iptables_raw_disable_firewalld: false | ||
playbooks: | ||
prepare: ../resources/prepare-iproute.yml | ||
converge: ../../site.yml | ||
lint: | ||
name: ansible-lint | ||
scenario: | ||
name: omero-training-server | ||
test_sequence: | ||
- destroy | ||
# dependency must come first so that ansible-lint will see a custom module | ||
# This might be fixed by https://github.com/ansible/molecule/pull/1739 | ||
- dependency | ||
- lint | ||
- syntax | ||
- create | ||
- prepare | ||
- converge | ||
# FIXME: Some tasks are not idempotent | ||
# - idempotence | ||
- verify | ||
- destroy | ||
verifier: | ||
name: testinfra | ||
name: Molecule | ||
# yamllint disable-line rule:truthy | ||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '29 21 * * 0' | ||
|
||
jobs: | ||
|
||
list-scenarios: | ||
runs-on: ubuntu-22.04 | ||
outputs: | ||
matrix: ${{ steps.listscenarios.outputs.scenarios }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: listscenarios | ||
uses: ome/action-ansible-molecule-list-scenarios@main | ||
|
||
test: | ||
name: Test | ||
needs: | ||
- list-scenarios | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
# Keep running so we can see if other tests pass | ||
fail-fast: false | ||
matrix: | ||
scenario: ${{fromJson(needs.list-scenarios.outputs.matrix)}} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
- name: Install Ansible & Molecule | ||
run: | | ||
pip install "ansible<8" "ansible-lint<6.13" flake8 | ||
pip install "molecule<5" "ansible-compat<4" | ||
pip install molecule-plugins[docker] pytest-testinfra | ||
- name: Run molecule | ||
run: molecule test -s "${{ matrix.scenario }}" | ||
|
||
publish: | ||
name: Galaxy | ||
if: startsWith(github.ref, 'refs/tags') | ||
needs: | ||
- test | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Read the role name | ||
id: role-name | ||
run: | | ||
name=$(grep 'role_name' meta/main.yml | sed -r 's/^[^:]*:(.*)$/\1/' | tr -d '[:space:]') # noqa | ||
echo "rolename=$name" >> "$GITHUB_OUTPUT" | ||
- name: Publish to Galaxy | ||
uses: ome/action-ansible-galaxy-publish@main | ||
with: | ||
galaxy-api-key: ${{ secrets.GALAXY_API_KEY }} | ||
galaxy-version: ${{ github.ref_name }} | ||
role-name: ${{ steps.role-name.outputs.rolename }} |