intersystems-community / iris-community-edition

Feedback and Issues for InterSystems IRIS Community Edition
https://hub.docker.com/_/intersystems-iris-data-platform
MIT License
1 stars 0 forks source link

Docker entrypoint with session #8

Closed daimor closed 5 years ago

daimor commented 5 years ago

I should be able to run docker container just with some ObjectScript code. Like, I need to run UnitTests. And I need only start, test and stop container after that. My current entry point something like this.

#!/bin/sh

TESTS=`pwd`/tests/cls

iris start $ISC_PACKAGE_INSTANCENAME quietly EmergencyID=admin,sys \

/bin/echo -e 'admin\nsys\n' \
  "set ^UnitTestRoot=\"$TESTS\"\n" \
  'do ##class(%UnitTest.Manager).RunTest()\n' \
  'halt\n' \
| iris session $ISC_PACKAGE_INSTANCENAME | tee /tmp/tests.log

/bin/echo -e 'admin\nsys\n' \
| iris stop $ISC_PACKAGE_INSTANCENAME quietly

if ! grep -iq "All PASSED" /tmp/tests.log 
then
  exit 1
fi

And I don't like it, would be nice, to pass just objectscript, which will be executed on running instance, and will stop a container after that.

daimor commented 5 years ago

I suppose, it can be done with iris-main just option, to execute some objectscript code, and stop after. iris-main -c somescript.mac this, should either support existing file on the filesystem, e.g. some mac routine. And should allow, to call routine or class, as it possible with iris session. and then, I would be able to run my image like this. docker run myimage -c somescript.mac

daimor commented 5 years ago

As an addition, it would be nice to get extended HALT command, where I could define exit code ZHALT 1 or EXIT 1, so, It will be very easy to catch it outside, for many purposes, very useful for CI. At this time, I use this way

Do $zu(4, $job, 1)
evshvarov commented 5 years ago

Fixed in the following release