Commit 881365bf authored by Lionel Metrailler's avatar Lionel Metrailler
Browse files

New make-functions

parents c174c178 dfe22a04
...@@ -91,7 +91,7 @@ function run() { ...@@ -91,7 +91,7 @@ function run() {
--user $(id -u) \ --user $(id -u) \
-e ODA_SPARQL_ROOT \ -e ODA_SPARQL_ROOT \
-p $PORT:$PORT \ -p $PORT:$PORT \
-v $HOME/.ssh:/home/oda/.ssh:ro \ -v $HOME/.ssh:/home/oda/.ssh:ro \
-v $HOME/.ssh:/home/jovyan/.ssh:ro \ -v $HOME/.ssh:/home/jovyan/.ssh:ro \
-v $PWD/passwd.new:/etc/passwd \ -v $PWD/passwd.new:/etc/passwd \
-v $PWD:/repo \ -v $PWD:/repo \
...@@ -109,20 +109,25 @@ function run() { ...@@ -109,20 +109,25 @@ function run() {
# TODO: this logic should be within oda eval # TODO: this logic should be within oda eval
function run-one() { function run-one() {
cname=cc-ci-run-$SOURCE_NAME-${RANDOM} cname=cc-ci-run-$SOURCE_NAME-${RANDOM}
docker run --entrypoint cat $IMAGE /etc/passwd > passwd docker run --entrypoint cat $IMAGE /etc/passwd > passwd
< passwd sed 's/1000/'$(id -u)'/' > passwd.new < passwd sed 's/1000/'$(id -u)'/' > passwd.new
docker run \ if [ ${MOUNT_SSH_FLAG:=no} == "yes" ]; then
extra="-v /${HOME:?HOME variable is not set?}/.ssh:/home/oda/.ssh:ro"
echo -e "\033[32mYES mounting ssh keys\033[0m: will rely on ssh when possible"
else
echo -e "\033[31mNOT mounting ssh keys\033[0m: will rely on https, please be sure sources are synchronous"
fi
docker run \
--name $cname \ --name $cname \
-e CI_JOB_TOKEN \ -e CI_JOB_TOKEN \
-e MINIO_UPLOAD_KEY \ -e MINIO_UPLOAD_KEY \
-e NBARGS_PYDICT \ -e NBARGS_PYDICT \
-v //c/Users/metra/.ssh:/home/oda/.ssh:ro \ $extra \
--entrypoint bash $IMAGE \ --entrypoint bash $IMAGE \
-c ''' -c '''
set -x
mkdir -pv /tmp/outputs mkdir -pv /tmp/outputs
export export
export | grep CI_J export | grep CI_J
...@@ -142,18 +147,21 @@ function run-one() { ...@@ -142,18 +147,21 @@ function run-one() {
echo $MINIO_UPLOAD_KEY > /tmp/home-run/.minio echo $MINIO_UPLOAD_KEY > /tmp/home-run/.minio
chmod 400 /tmp/home-run/.minio chmod 400 /tmp/home-run/.minio
## if [ "'$MOUNT_SSH_FLAG'" == "yes" ]; then
if git clone git@gitlab.astro.unige.ch:integral/cc-workflows/cc-isgri-oda-nustar-reference.git /tmp/test-clone; then if git clone git@gitlab.astro.unige.ch:integral/cc-workflows/cc-isgri-oda-nustar-reference.git /tmp/test-clone; then
echo "\033[32mSUCCESS\033[0mfully cloned private repo from gitlab"; echo -e "\033[32mSUCCESS\033[0mfully cloned private repo from gitlab";
else
echo -e "\033[31mFAILED033[0m to cloned private repo from gitlab";
echo "make sure that your home contains ssh keys"
exit 1
fi
else else
echo "\033[31mFAILED033[0m to cloned private repo from gitlab"; echo "skipping ssh check: ssh will not be used"
echo "make sure that your home contains ssh keys"
exit 1
fi fi
git clone /repo /tmp/home-run/repo git clone /repo /tmp/home-run/repo
cd /tmp/home-run/repo cd /tmp/home-run/repo
set -x
echo "${NBARGS_PYDICT:-{\}}" > nbargs.py echo "${NBARGS_PYDICT:-{\}}" > nbargs.py
cat nbargs.py cat nbargs.py
...@@ -186,11 +194,11 @@ function run-one() { ...@@ -186,11 +194,11 @@ function run-one() {
docker cp $cname:/tmp/outputs . docker cp $cname:/tmp/outputs .
docker rm -f $cname docker rm -f $cname
ls -ltr outputs ls -ltr outputs
ls outputs/*_output.ipynb ls outputs/*_output.ipynb
nbinspect outputs/*_output.ipynb > pars.json nbinspect outputs/*_output.ipynb > pars.json
mkdir -pv outputs/$(python -c 'import json; print("{subcases_pattern[value]}_{nscw[value]}scw_sf{systematic_fraction[value]}_{osa_version[value]}".format(**json.load(open("pars.json"))))') mkdir -pv outputs/$(python -c 'import json; print("{subcases_pattern[value]}_{nscw[value]}scw_sf{systematic_fraction[value]}_{osa_version[value]}".format(**json.load(open("pars.json"))))')
mv -fv outputs/*output* outputs/$(python -c 'import json; print("{subcases_pattern[value]}_{nscw[value]}scw_sf{systematic_fraction[value]}_{osa_version[value]}".format(**json.load(open("pars.json"))))') mv -fv outputs/*output* outputs/$(python -c 'import json; print("{subcases_pattern[value]}_{nscw[value]}scw_sf{systematic_fraction[value]}_{osa_version[value]}".format(**json.load(open("pars.json"))))')
} }
function build-singularity() { function build-singularity() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment