Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to change entrypoint / shell for ci step #278

Closed
anbraten opened this issue Aug 26, 2021 · 6 comments · Fixed by #2985
Closed

Allow to change entrypoint / shell for ci step #278

anbraten opened this issue Aug 26, 2021 · 6 comments · Fixed by #2985
Labels
feature add new functionality
Milestone

Comments

@anbraten
Copy link
Member

anbraten commented Aug 26, 2021

Problem

Currently /bin/sh is used as entrypoint for every ci step. If an image does not contain /bin/sh it can not be used with woodpecker ATM. For example gcr.io/kaniko-project/executor:debug only ships with /bin/busybox.

// File: /pipeline/frontend/yaml/compiler/convert.go

entrypoint = []string{"/bin/sh", "-c"}
command = []string{"echo $CI_SCRIPT | base64 -d | /bin/sh -e"}

Solution

Allow to exec multiple commands with the agent instead of a single combined one. This could allow to use the default entrypoint or even a specific one. Commands could be executed with something like docker exec instead.

Workaround

Create a plugin as plugins can define their entrypoint.

@zc-devs
Copy link
Contributor

zc-devs commented Jun 22, 2023

As a temporary workaround we can try to create symbolic link forget, doesn't work:(

@6543
Copy link
Member

6543 commented Jun 22, 2023

Well from securety standpoint: as long as we handle it like normal steps there should not be a downside ... we just make sure that asap it is set ... it's not considered as a plugin usage anymore

@zc-devs
Copy link
Contributor

zc-devs commented Jul 7, 2023

For linux-like OS entrypoint and command look like mentioned above:

env["CI_SCRIPT"] = base64.StdEncoding.EncodeToString([]byte(generateScriptPosix(commands)))
env["HOME"] = "/root"
env["SHELL"] = "/bin/sh"
entry = []string{"/bin/sh", "-c"}
cmd = []string{"echo $CI_SCRIPT | base64 -d | /bin/sh -e"}

So, we depend on some shell and base64. Seems we can change shell only and hope image would contain base64 command. Am I right? Things are getting worse with Windows.

@zc-devs

This comment was marked as off-topic.

@6543
Copy link
Member

6543 commented Jul 7, 2023

....
So, we depend on some shell and base64. Seems we can change shell only and hope image would contain base64 command. Am I right? Things are getting worse with Windows.

well that's some legacy limitation we will get rid of in the near future ... it's al here only the backend's need to adopt the new capability

@6543
Copy link
Member

6543 commented Jul 7, 2023

beside for windows we have a powershell equivalent ...

If you want to chat ... I suggest our Matrix-Rooms/Discord-Server :)

@qwerty287 qwerty287 added this to the 3.x.x milestone Nov 8, 2023
@qwerty287 qwerty287 modified the milestones: 3.x.x, 2.2.0 Dec 21, 2023
@6543 6543 modified the milestones: 2.2.0, 3.0.0 Jan 12, 2024
@pat-s pat-s modified the milestones: 2.3.0, 2.x.x Jan 13, 2024
@qwerty287 qwerty287 modified the milestones: 2.x.x, 2.3.0 Jan 14, 2024
6543 added a commit that referenced this issue Jan 19, 2024
Closes #278

---------

Co-authored-by: Anbraten <anton@ju60.de>
Co-authored-by: 6543 <6543@obermui.de>
@qwerty287 qwerty287 modified the milestones: 2.3.0, 2.2.0 Jan 19, 2024
fernandrone pushed a commit to quintoandar/woodpecker that referenced this issue Feb 1, 2024
Closes woodpecker-ci#278

---------

Co-authored-by: Anbraten <anton@ju60.de>
Co-authored-by: 6543 <6543@obermui.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature add new functionality
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants