-
-
Notifications
You must be signed in to change notification settings - Fork 610
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
Added docker image test script #1733
Conversation
there is python package docker? Nice!) Since, I've started from |
Yes, I tried that from my side to see if this could work. @trsvchn if you'd like to review, feel free to comment out and give a feedback. |
And sorry for overlapping ! |
No problem, sorry, I was busy yesterday. and now I know about |
@trsvchn do you have an idea why it can't find installed |
@vfdev-5 Oh, I think I know what is happening |
and env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.10/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.7.10/x64/lib Thus: sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY" Removes python libs and python |
Oh, I see. Should we just reinstall it after building ? |
But, wait, pyaml works fine |
pyyaml is OK as it is used only before the suppression |
Yes, for base images |
Let's try
Just after the checkout, and before Python install actiob |
@trsvchn seems like it works ! |
Great! |
@trsvchn I'm struggling with def run_python_cmd(cmd):
try:
out = client.containers.run(args.image, f"python -c '{cmd}'", auto_remove=True, stderr=True,)
assert isinstance(out, bytes), type(out)
out = out.decode("utf-8").strip()
except docker.errors.ContainerError as e:
raise RuntimeError(e)
return out Any ideas how to improve it ? |
@vfdev-5 sure! I'll test |
I'm thinking to do something like def run_python_cmd(cmd):
try_except_cmd = f"""
def main():
{cmd}
try:
main()
except Exception as e:
import traceback
print(traceback.format_exc())
"""
try:
out = client.containers.run(args.image, f"python -c '{try_except_cmd}'", auto_remove=True, stderr=True,)
assert isinstance(out, bytes), type(out)
out = out.decode("utf-8").strip()
if any([k in out.lower() for k in ["error", "exception"]]):
raise RuntimeError(out)
except docker.errors.ContainerError as e:
raise RuntimeError(e)
return out but this looks like a hack... |
@vfdev-5 Yes!, I think the problem is in that cmd raises exceptions, since this generates exit code 1 and it forces run method to raise exception: $ python -c 'raise RuntimeError'
Traceback (most recent call last):
File "<string>", line 1, in <module>
RuntimeError
$ echo $?
1
we should handle this quietly |
That's right. But what I'd like to have is to execute tests like |
What about to try
|
detach or not detach this is the question :) |
cv or not 2cv ... or cv2 |
It seems to work fine |
Let's see if we can finally update our docker images |
Addresses #1644
Description:
Check list: