How do you use step:entrypoint? #3263
Replies: 3 comments 8 replies
-
You should separate the command and its args: steps:
list:
image: ghcr.io/regclient/regctl:v0.5.6
entrypoint:
- /regctl
- tag
- ls
- ghcr.io/regclient/regctl
If this is really the case (I didn't test), that's a bug.
Yes, but we don't have a good way to run scripts currently. I know that command execution needs a refactor, maybe I can take a look at some point. |
Beta Was this translation helpful? Give feedback.
-
Doesn't work, skip_clone: true
steps:
curl:
image: curlimages/curl
entrypoint:
- /usr/bin/curl
commands:
- http://google.com
pod-1.yaml skip_clone: true
steps:
curl:
image: curlimages/curl
entrypoint:
- /usr/bin/curl
- http://google.com
|
Beta Was this translation helpful? Give feedback.
-
Thanks for taking a look. I wonder if something like this would work:
There's probably a better way to restrict specifying both |
Beta Was this translation helpful? Give feedback.
-
Today I created a step that looks something like:
It turns out that
regctl
is a scratch container and produces an error with:Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/bin/sh": stat /bin/sh: no such file or directory: unknown
I noticed that Woodpecker v2.2.0 adds support for overriding the container entrypoint.
I adapted the configuration, but I can't seem to get this working.
The following just prints the
regctl
help message as if only the first argument is making it to theentrypoint
:The same is true if I use:
And, oddly, the same if I specify garbage for the entrypoint:
The
entrypoint
only seems to take effect ifcommands
is also set:resulting in:
Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/regctlgarbage": stat /regctlgarbage: no such file or directory: unknown
So if I use the valid entrypoint:
The output is still no good:
unknown command "echo $CI_SCRIPT | base64 -d | /bin/sh -e" for "regctl"
In this case, it looks like the
commands
parameter is being converted as normal to theCI_SCRIPT
and then passed to the/regctl
entrypoint.I can further validate this by moving the commands back to the entrypoint and supplying a placeholder command:
This yields:
accepts 1 arg(s), received 2
That's output from
regctl
indicating it has received extra arguments.Is this a bug in how
entrypoint
is being handled?Actually, I'm inclined to think it is that. Or at least an undocumented behavior.
woodpecker/pipeline/backend/docker/convert.go
Line 45 in c8fa718
Unless I'm overlooking another change, that if statement shows that the
entrypoint
is only modified ifcommands
are also specified. But, ifcommands
are specified, they're supplied as an argument to theentrypoint
as if thatentrypoint
was still the default/bin/sh
.So, am I ultimately going about this the wrong way?
Granted, I could build from the container to add the expected shell, but I'm hoping there's another way to solve this without creating custom containers.
Beta Was this translation helpful? Give feedback.
All reactions