UCL-MIRSG / ansible-collection-infra

Ansible Collection to configure infrastructure for XNAT and OMERO
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Use MIRSG `molecule-test` #5

Closed p-j-smith closed 12 months ago

p-j-smith commented 1 year ago

Reduce duplication in workflows by:

Note, this depends on https://github.com/UCL-MIRSG/.github/pull/80 being merged first. And linting is broken will fix in a different pr

p-j-smith commented 1 year ago

Seems a bit odd to use a reusable workflow to call a composite workflow? Perfectly valid, but is it needed?

Yeah it is a little convoluted. The molecule-test action that's in our .github repo can be used both for testing this collection as well as for testing standalone roles. When testing the roles within this collection there's a bit of boilerplate that's needed (and that we'd use for each role we want to test). So I put this boilerplate into a reusable workflow. We could have a workflow molecule-test-collection but that would duplicate a lot of what's in the existing molecule-test action. Roundabout way of saying it's not really necessary, just seemed like a sensible way of doing things. Happy to change though!

paddyroddy commented 1 year ago

Roundabout way of saying it's not really necessary, just seemed like a sensible way of doing things. Happy to change though!

Happy with whatever you decide. If it's a duplication concern, I assume one composite action can depend on another (maybe)?

p-j-smith commented 1 year ago

Happy with whatever you decide. If it's a duplication concern, I assume one composite action can depend on another (maybe)?

Yeah we could have another action molecule-test-collection that uses the existing molecule-test action, and have each workflow use that molecule-test-collection. That new action would look like this:

https://github.com/UCL-MIRSG/ansible-collection-infra/blob/0ca6652ae9ac4571dc40d5a05a6cef224cf1d8b3/.github/actions/molecule-test-collection/action.yml#L1-L19

And using it in a workflow: https://github.com/UCL-MIRSG/ansible-collection-infra/blob/0ca6652ae9ac4571dc40d5a05a6cef224cf1d8b3/.github/workflows/molecule-firewalld-with-action.yml#L1-L26

Compared to the current workflow for the same role: https://github.com/UCL-MIRSG/ansible-collection-infra/blob/0ca6652ae9ac4571dc40d5a05a6cef224cf1d8b3/.github/workflows/molecule-firewalld.yml#L1-L13

So using a reusable workflow allows us to avoid some boilerplate that can't be avoided when using a composite action