Reusable workflows incompatible with workflow services

I have a reusable workflow that builds, tests, and publishes application docker images.
This reusable workflow is being reuse in multiple client/application repositories.

Some, but not all, applications require services, such as nginx or postgresql consumer, during testing.
I would like to startup container services before the reusable workflow.
However the parser does not allow this:

The workflow is not valid. .github/workflows/publish-deploy.yml (Line: 15, Col: 5): Unexpected value 'services'

jobs:
  publish:
    uses:  "org/github-workflows/.github/workflows/publish.yml@reusable"
    services:
      nginx:
        image: nginx
        # Map port 8080 on the Docker host to port 80 on the nginx container
        ports:
        - 8080:80
1 Like

I wonder if a composite action might be what you’re looking for? Services are per job, with a composite action you could run standardized steps in a custom job.

Alternatively you could try to pass the list of services to run to the workflow using toJSON() and fromJSON(), but that seems fragile to me. :sweat_smile:

No, composite actions do not solve this.

My workflows are already made of made of composite actions and you can’t nest these.
Being able composite actions call other composite actions would be really useful - but that’s a different story. (Ditto reusable workflows).

That’s the reason I’m trying to reuse this workflow: it already a series of steps defined as composite action to achieve a certain result.

Yes I could pass down a list of services to start, but this feels morally wrong/fragile and I’m not sure it will even work.

It seems to me that within a job definition one should either have a uses or steps clause. But the presence of either should mean services is valid or not. Hopefully this is only not implemented yet concern. But I invite @jenschelkopf to comment.