-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from vsoch/fix/install-return-value
install script should exit on nonzero return code
- Loading branch information
Showing
8 changed files
with
117 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Examples | ||
|
||
This is a small folder of examples intended to be built to test or otherwise | ||
show how something works. If you would like an example added, please | ||
[open an issue](https://github.com/vsoch/scif). | ||
|
||
- [Exit on Install](exit-on-install): A container to test exit on install error (non zero return value). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# SciF Example | ||
# | ||
# docker build -f docs/examples/exit-on-install/Dockerfile -t scif-exit . | ||
|
||
FROM continuumio/miniconda3 | ||
|
||
####################################### | ||
# SciF Install | ||
####################################### | ||
|
||
# Can be replaced with pip install scif | ||
RUN mkdir /code | ||
ADD . /code | ||
RUN python /code/setup.py install | ||
ENV PATH=/opt/conda/bin:$PATH | ||
|
||
####################################### | ||
# SciF Entrypoint | ||
####################################### | ||
|
||
RUN scif install /code/docs/examples/exit-on-install/recipe.scif | ||
ENTRYPOINT ["scif"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Exit on Install | ||
|
||
This should be built from the root of the repository as follows: | ||
|
||
```bash | ||
docker build -f docs/examples/exit-on-install/Dockerfile -t scif-exit-on-install . | ||
``` | ||
|
||
When you build the above, it should exit on the install of one of the apps: | ||
|
||
```bash | ||
Using /opt/conda/lib/python3.7/site-packages | ||
Finished processing dependencies for scif==0.0.81 | ||
Removing intermediate container adef9b9e2880 | ||
---> 1827c8e9dfde | ||
Step 5/7 : ENV PATH=/opt/conda/bin:$PATH | ||
---> Running in 02f699d02f52 | ||
Removing intermediate container 02f699d02f52 | ||
---> 6916a222e1c6 | ||
Step 6/7 : RUN scif install /code/docs/examples/exit-on-install/recipe.scif | ||
---> Running in 30639ab520f0 | ||
ERROR Return value 256 for install of hello-world-script | ||
Installing base at /scif | ||
+ apprun hello-world-echo | ||
+ appenv hello-world-echo | ||
+ apprun hello-world-script | ||
+ appenv hello-world-script | ||
+ apphelp hello-world-script | ||
+ appinstall hello-world-script | ||
The command '/bin/sh -c scif install /code/docs/examples/exit-on-install/recipe.scif' returned a non-zero code: 1 | ||
``` | ||
The user is alerted of the error here: | ||
|
||
```bash | ||
ERROR Return value 256 for install of hello-world-script | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
%appenv hello-world-echo | ||
THEBESTAPP=hello-world-echo | ||
export THEBESTAPP | ||
%apprun hello-world-echo | ||
echo "The best app is $THEBESTAPP" | ||
%appinstall hello-world-script | ||
echo "echo 'Hello World!'" >> $SCIF_APPBIN/hello-world.sh | ||
chmod u+x $SCIF_APPBIN/hello-world.sh | ||
return 1 | ||
%appenv hello-world-script | ||
THEBESTAPP=$SCIF_APPNAME | ||
export THEBESTAPP | ||
%apprun hello-world-script | ||
/bin/bash hello-world.sh | ||
%apprun hello-world-custom | ||
echo "Hello $@" | ||
%appenv hello-world-env | ||
OMG=TACOS | ||
%apphelp hello-world-script | ||
This version of hello world runs a script to print hello world | ||
%apphelp hello-world-env | ||
This is the help section for hello-world-env! This app | ||
does not have anything other than an environment installed. | ||
It just defines the environment variable `OMG=TACOS`. Try issuing | ||
a command to the scif entrypoint to echo this variable: | ||
|
||
# Local installation | ||
scif exec hello-world-env echo [e]OMG | ||
|
||
# Docker image example | ||
docker run quay.io/scif/scif exec hello-world-env echo [e]OMG | ||
[hello-world-env] executing /bin/echo $OMG | ||
TACOS | ||
%apptest hello-world-script | ||
echo "Running tests!" | ||
if [ $# -eq 0 ] | ||
then | ||
echo "No arguments supplied, tests pass!" | ||
exit 0 | ||
fi | ||
echo "Argument supplied, exiting with ${1}" | ||
exit ${1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters