-
-
Notifications
You must be signed in to change notification settings - Fork 380
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
Service containers have their working directory changed when launched #3993
Comments
this migth happen if the service has no commands (as usual) and no environment set, it will count as plugin. and plugins get set there working directory. using the this is done because of security considerations. I think we should add an hint to use directory into the docs :) In any case normally you should not have to set a workdir as it will be set to the root of where the workflow workspace is mounted at. @Gr3q does this answer/solve your issue and could you propose a good place where to put that hint into the docs? |
If you want to put it somewhere it should be above https://woodpecker-ci.org/docs/usage/services#configuration where you note that any container setting
I have environment set. services:
- name: database
image: linuxserver/mariadb
pull: true
environment:
- TZ=Europe/London
- MYSQL_USER=dockeruser
- MYSQL_ROOT_PASSWORD=root
- MYSQL_PASSWORD=testpw
- MYSQL_DATABASE=api
- name: signing-server
image: REDACTED
pull: true
# Unfortunately this is needed now...
directory: /api
environment:
- TEST_MODE=True
- TEST_SIGN_CLIENT_ID=test
- TEST_SIGN_CLIENT_SECRET=test
This is only good in the use case where a service you want to run might depend on (uses files from) the repo the pipeline runs on. For the use case when you just want to run something like redis/db as a service it doesn't make sense. To use the workaround you also need to have knowledge about the internals of the image used, which is not always the case. The question is how the affected images are treated. Either:
|
hmm 🤔 well that's not completely wrong ... it has to be improved.
|
Some addition info that the linter says I shouldn't use
|
-> #4127 |
Did this get fixed by #4127? |
I would say #3993 (comment) + mentioned issue should fix it ... PS: feel free to open a new one if something similar appears and reference this issue here |
Component
server
Describe the bug
From 2.7.0 if I add a service container that had
WORKDIR
set in Dockerfile the service won't be able to find files via relative paths (or it expects to find files in it's current folder).Workaround: Set
directory
manually on the serviceSteps to reproduce
WORKDIR
set to something you know the contents of and setCMD
andENTRYPOINT
tols
WORKDIR
's contents.Expected behavior
Working directory inside the container should be left alone and be the same set in the container.
System Info
docker-compose config:
Additional context
No response
Validations
next
version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]The text was updated successfully, but these errors were encountered: