How do I properly override a service entrypoint? #26688
-
I want to define a service in my GitHub action and override its entrypoint by adding arguments to it. How can I do this? Here’s what I’ve got right now that should sum up what I want to do…
However, this blows up when initializing containers because the command it runs isn’t right…
The error is:
I think the generated create command should actually be something like this
Here’s a docker-compose I’ve been using in Jenkins that I’m basing my action on:
Any ideas how within a GitHub Action Service definition I can override the entrypoint with arguments being passed to the executable? |
Beta Was this translation helpful? Give feedback.
Replies: 17 comments 3 replies
-
Hi @carterbancroft , The position of parameter ‘–listen-client-urls … --advertise-client-urls …’ will cause the error. now it invokes:
It will be successful if you put them at the end of the code:
It’s not supported to use these two parameters for services.options. Please remove them, it works fine on my side.
Or instead of job.jobid.services, you can run the ‘docker create’ command directly in the job.steps. |
Beta Was this translation helpful? Give feedback.
-
Hi @weide-zhou Thanks for the answer. That create command is generated on GitHub’s side, I don’t have power over where the params are placed. That’s what I was pointing out in my question, that those parameters need to go at the end of the command GitHub is generating. The params are what I need so just doing It sounds like you’re saying though, that for services in a workflow you cannot override the entrypoint with arguments. Is that right? It seems odd to be able to use services like that but not have an Will this ever be supported? |
Beta Was this translation helpful? Give feedback.
-
@chrispat This seems like a common ask, is it on the roadmap? I think we could support entrypoint+args on service containers similar to container actions @carterbancroft You are correct that this is something we dont fully support at this time. Options was intended to allow arbitrary additional arguments but entrypoint is strange because of its positional requirements. While you can set the entrypoint alone, as you have noted you cant also provide the args to this entrypoint. At this time I think the only solution is to build the image yourself with the entrypoint + args defined in the Dockerfile |
Beta Was this translation helpful? Give feedback.
-
@dakalethanks for clarifying that, I really appreciate it. Your solution is basically what I wound up doing. Hopefully we’ll see this in a release at some point. Thanks again! |
Beta Was this translation helpful? Give feedback.
-
@dakale I’m also currently hitting a similar issue with services in GitHub Actions. I would like to set up a MinIO instance for some integration tests but the official Docker image requires you to specify the command yourself like |
Beta Was this translation helpful? Give feedback.
-
My use case is to turn off the fsync to the postgress service for performance optimization. I would love to see that feature! |
Beta Was this translation helpful? Give feedback.
-
@ivaylo-bachvarov how about this:
|
Beta Was this translation helpful? Give feedback.
-
This is a great snippet! Thanks! However I tested and it seems that my tests are slower now. That is strange :D |
Beta Was this translation helpful? Give feedback.
-
@dakale do you know if there are any plans to support this feature? Thanks for mentioning the workaround (building the image yourself with the correct args). I ended up calling |
Beta Was this translation helpful? Give feedback.
-
Ping, this bad boy is 2 years old but I’d also like to have this feature :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
For what it's worth, I'm also facing inability to customize a command. For context, I'm now facing exactly the same issue with |
Beta Was this translation helpful? Give feedback.
-
+1. Would really like to have this. |
Beta Was this translation helpful? Give feedback.
-
I ran into this while trying to run tests against Apache Solr, which supports configuration using custom entry points (https://solr.apache.org/guide/solr/latest/deployment-guide/solr-in-docker.html#custom-set-up-scripts) but not by, say, custom environmental variables or a well-known path which we could do with the current functionality. @dakale for prioritization, I would note that this is an area where something which is very easy to do with GitLab CI is much harder to do with GitHub Actions. I use that all of the time at work so I was surprised not to have an equivalent here. |
Beta Was this translation helpful? Give feedback.
-
@chrispat ... it'd be nice to at least mention that it isn't supported in the docs. I ended up here after three hours of blindingly believing it was simple and I was just missing something obvious. I guess the good news is that I now have a way deeper understanding of GHA after that rabbit hole. |
Beta Was this translation helpful? Give feedback.
-
Ran into this with the same postgres fsync use-case here, being able to override the command'd be a good addition! |
Beta Was this translation helpful? Give feedback.
-
linking back to the open PR for this feature in case it bumps it up the queue actions/runner#1152 implementing it is fairly simple (there's already an EntryPointArgs in the DockerCreate wrapper, it's just not populated from yaml) |
Beta Was this translation helpful? Give feedback.
-
Hey, any update on this? Service containers are unusable to me as is without being able to override CMD. |
Beta Was this translation helpful? Give feedback.
@chrispat This seems like a common ask, is it on the roadmap? I think we could support entrypoint+args on service containers similar to container actions
@carterbancroft You are correct that this is something we dont fully support at this time. Options was intended to allow arbitrary additional arguments but entrypoint is strange because of its positional requirements. While you can set the entrypoint alone, as you have noted you cant also provide the args to this entrypoint. At this time I think the only solution is to build the image yourself with the entrypoint + args defined in the Dockerfile