diff --git a/2.7/s2i/bin/assemble b/2.7/s2i/bin/assemble index 79d97720..3123ed67 100755 --- a/2.7/s2i/bin/assemble +++ b/2.7/s2i/bin/assemble @@ -1,5 +1,16 @@ #!/bin/bash +if [ "$(ls -A /tmp/artifacts/ 2>/dev/null)" ]; then + echo "---> Restoring found build artifacts..." + cp -Rf /tmp/artifacts/. ./ + rc=$? + if [ $rc -eq 0 ] && [ ! -z "${PYTHONUSERBASE}" ] && [ -d "$(dirname ${PYTHONUSERBASE})" ]; then + cp -Rf /tmp/artifacts/. $(dirname ${PYTHONUSERBASE}) + else + ls -la $(dirname ${PYTHONUSERBASE}) + fi +fi + function is_django_installed() { python -c "import django" &>/dev/null } diff --git a/2.7/s2i/bin/save-artifacts b/2.7/s2i/bin/save-artifacts new file mode 100755 index 00000000..5dcfa5aa --- /dev/null +++ b/2.7/s2i/bin/save-artifacts @@ -0,0 +1,8 @@ +#!/bin/bash + +if [ -d .local ]; then + tar cf - .local +elif [ ! -z "${PYTHONUSERBASE}" ] && [ -d "${PYTHONUSERBASE}" ]; then + cd $(dirname ${PYTHONUSERBASE}) + tar cf - $(basename ${PYTHONUSERBASE}) +fi diff --git a/3.3/s2i/bin/assemble b/3.3/s2i/bin/assemble index 0d69d0ed..a2140c5f 100755 --- a/3.3/s2i/bin/assemble +++ b/3.3/s2i/bin/assemble @@ -1,5 +1,16 @@ #!/bin/bash +if [ "$(ls -A /tmp/artifacts/ 2>/dev/null)" ]; then + echo "---> Restoring found build artifacts..." + cp -Rf /tmp/artifacts/. ./ + rc=$? + if [ $rc -eq 0 ] && [ ! -z "${PYTHONUSERBASE}" ] && [ -d "$(dirname ${PYTHONUSERBASE})" ]; then + cp -Rf /tmp/artifacts/. $(dirname ${PYTHONUSERBASE}) + else + ls -la $(dirname ${PYTHONUSERBASE}) + fi +fi + function is_django_installed() { python -c "import django" &>/dev/null } diff --git a/3.3/s2i/bin/save-artifacts b/3.3/s2i/bin/save-artifacts new file mode 100755 index 00000000..5dcfa5aa --- /dev/null +++ b/3.3/s2i/bin/save-artifacts @@ -0,0 +1,8 @@ +#!/bin/bash + +if [ -d .local ]; then + tar cf - .local +elif [ ! -z "${PYTHONUSERBASE}" ] && [ -d "${PYTHONUSERBASE}" ]; then + cd $(dirname ${PYTHONUSERBASE}) + tar cf - $(basename ${PYTHONUSERBASE}) +fi diff --git a/3.4/s2i/bin/assemble b/3.4/s2i/bin/assemble index 7af00ad5..964866a6 100755 --- a/3.4/s2i/bin/assemble +++ b/3.4/s2i/bin/assemble @@ -1,5 +1,16 @@ #!/bin/bash +if [ "$(ls -A /tmp/artifacts/ 2>/dev/null)" ]; then + echo "---> Restoring found build artifacts..." + cp -Rf /tmp/artifacts/. ./ + rc=$? + if [ $rc -eq 0 ] && [ ! -z "${PYTHONUSERBASE}" ] && [ -d "$(dirname ${PYTHONUSERBASE})" ]; then + cp -Rf /tmp/artifacts/. $(dirname ${PYTHONUSERBASE}) + else + ls -la $(dirname ${PYTHONUSERBASE}) + fi +fi + function is_django_installed() { python -c "import django" &>/dev/null } diff --git a/3.4/s2i/bin/save-artifacts b/3.4/s2i/bin/save-artifacts new file mode 100755 index 00000000..5dcfa5aa --- /dev/null +++ b/3.4/s2i/bin/save-artifacts @@ -0,0 +1,8 @@ +#!/bin/bash + +if [ -d .local ]; then + tar cf - .local +elif [ ! -z "${PYTHONUSERBASE}" ] && [ -d "${PYTHONUSERBASE}" ]; then + cd $(dirname ${PYTHONUSERBASE}) + tar cf - $(basename ${PYTHONUSERBASE}) +fi diff --git a/3.5/s2i/bin/assemble b/3.5/s2i/bin/assemble index 79d97720..3123ed67 100755 --- a/3.5/s2i/bin/assemble +++ b/3.5/s2i/bin/assemble @@ -1,5 +1,16 @@ #!/bin/bash +if [ "$(ls -A /tmp/artifacts/ 2>/dev/null)" ]; then + echo "---> Restoring found build artifacts..." + cp -Rf /tmp/artifacts/. ./ + rc=$? + if [ $rc -eq 0 ] && [ ! -z "${PYTHONUSERBASE}" ] && [ -d "$(dirname ${PYTHONUSERBASE})" ]; then + cp -Rf /tmp/artifacts/. $(dirname ${PYTHONUSERBASE}) + else + ls -la $(dirname ${PYTHONUSERBASE}) + fi +fi + function is_django_installed() { python -c "import django" &>/dev/null } diff --git a/3.5/s2i/bin/save-artifacts b/3.5/s2i/bin/save-artifacts new file mode 100755 index 00000000..5dcfa5aa --- /dev/null +++ b/3.5/s2i/bin/save-artifacts @@ -0,0 +1,8 @@ +#!/bin/bash + +if [ -d .local ]; then + tar cf - .local +elif [ ! -z "${PYTHONUSERBASE}" ] && [ -d "${PYTHONUSERBASE}" ]; then + cd $(dirname ${PYTHONUSERBASE}) + tar cf - $(basename ${PYTHONUSERBASE}) +fi diff --git a/3.6/s2i/bin/assemble b/3.6/s2i/bin/assemble index 1de7ce2e..1e640ba3 100755 --- a/3.6/s2i/bin/assemble +++ b/3.6/s2i/bin/assemble @@ -1,5 +1,16 @@ #!/bin/bash +if [ "$(ls -A /tmp/artifacts/ 2>/dev/null)" ]; then + echo "---> Restoring found build artifacts..." + cp -Rf /tmp/artifacts/. ./ + rc=$? + if [ $rc -eq 0 ] && [ ! -z "${PYTHONUSERBASE}" ] && [ -d "$(dirname ${PYTHONUSERBASE})" ]; then + cp -Rf /tmp/artifacts/. $(dirname ${PYTHONUSERBASE}) + else + ls -la $(dirname ${PYTHONUSERBASE}) + fi +fi + function is_django_installed() { python -c "import django" &>/dev/null } diff --git a/3.6/s2i/bin/save-artifacts b/3.6/s2i/bin/save-artifacts new file mode 100755 index 00000000..5dcfa5aa --- /dev/null +++ b/3.6/s2i/bin/save-artifacts @@ -0,0 +1,8 @@ +#!/bin/bash + +if [ -d .local ]; then + tar cf - .local +elif [ ! -z "${PYTHONUSERBASE}" ] && [ -d "${PYTHONUSERBASE}" ]; then + cd $(dirname ${PYTHONUSERBASE}) + tar cf - $(basename ${PYTHONUSERBASE}) +fi