Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion exaslct
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@

set -euo pipefail

SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
rl=readlink
if [[ "$(uname)" = Darwin ]]; then
rl=greadlink
fi

if [[ ! "$(command -v $rl)" ]]; then
echo readlink not available! Please install coreutils: On Linux \"apt-get install coreutils\" or similar. On MacOsX \"brew install coreutils\".
exit 1
fi

SCRIPT_DIR="$(dirname "$($rl -f "${BASH_SOURCE[0]}")")"

RUNNER_IMAGE_NAME="$("$SCRIPT_DIR/starter_scripts/construct_docker_runner_image_name.sh")"

Expand Down
2 changes: 1 addition & 1 deletion installer/checksums/exaslct_installer.sh.sha512sum
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6df6fa47fb39de40428f76f61da10b37099c421c39dba3fe95b85bef8ba651da5762cb3813b6f3a393229b7d6a56257c3148749afb88bfd10d02b7358f278321 exaslct_installer.sh
5d07ac5365bbcbb60c6de07ffa9f2b27fcdea3c66782f3681061c54005b2dca637efb4964f5b657504dbfbf68ed79bcd911d6e1e30a5d24157ebd08f3f97988f exaslct_installer.sh
1 change: 1 addition & 0 deletions installer/exaslct_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ main() {
#Take care and make sure list of files is identical!!!
download_and_verify_raw_file_from_github "$repo" "$exaslct_git_ref" "starter_scripts/exaslct_within_docker_container_without_container_build.sh"
download_and_verify_raw_file_from_github "$repo" "$exaslct_git_ref" "starter_scripts/exaslct_within_docker_container.sh"
download_and_verify_raw_file_from_github "$repo" "$exaslct_git_ref" "starter_scripts/exaslct_within_docker_container_slim.sh"
download_and_verify_raw_file_from_github "$repo" "$exaslct_git_ref" "starter_scripts/construct_docker_runner_image_name.sh"
download_and_verify_raw_file_from_github "$repo" "$exaslct_git_ref" "starter_scripts/mount_point_parsing.sh"
download_and_verify_raw_file_from_github "$repo" "$exaslct_git_ref" "installer/exaslct_install_template.sh"
Expand Down
16 changes: 14 additions & 2 deletions starter_scripts/build_docker_runner_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,23 @@

set -euo pipefail

SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
rl=readlink
if [[ "$(uname)" = Darwin ]]; then
rl=greadlink
fi


if [[ ! "$(command -v $rl)" ]]; then
echo readlink not available! Please install coreutils: On Linux \"apt-get install coreutils\" or similar. On MacOsX \"brew install coreutils\".
exit 1
fi

SCRIPT_DIR="$(dirname "$($rl -f "${BASH_SOURCE[0]}")")"

PROJECT_ROOT_DIR="$SCRIPT_DIR/.."

IMAGE_NAME="$("$SCRIPT_DIR/construct_docker_runner_image_name.sh")"

docker build -t "$IMAGE_NAME" -f "$SCRIPT_DIR/Dockerfile" "$PROJECT_ROOT_DIR" 1>&2

echo "$IMAGE_NAME"
echo "$IMAGE_NAME"
Original file line number Diff line number Diff line change
@@ -1 +1 @@
06c592b5dc270c7b9f73a6343a98375b43f25273d013922d0e9b7d923caf02f89267222435597aef1e636e17cc3a6e40a2f3eaababda852f64781eb37a324621 build_docker_runner_image.sh
161fab846f87104984c47e7bf8f98e56f555f2585f27975a03aa5b3fdf6a372fdc050020be2661dcaebc0a3e3a3db825b68dc21717a9123a5bf7d05b94f13d8f build_docker_runner_image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4b45b5ddee4dfbdb5b1428883d73fa437d7459eb30523f96a5129aaadf9d72d0733c519209a74f3fdfdce06ed32218dde89d1e914ae4667e6645d0f3f5afdd08 exaslct_within_docker_container_slim.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
eb85b4ac9b0a2dcb174e0cf8049e777cac80a31771f10683f1f8dd63fb8b1fe8f1961887241cdc90876b51916208726e8fbe9c8b35f54a5bb3b8b099d922c7b1 exaslct_within_docker_container_with_container_build.sh
0ab36ce358b89a34276cce1407ce164395d46cb72ff64d13066e9447df05c908e71a582512fcb69ce184a4c1ed5b27a81a3734128f58d39e1c36b6ae240b19bb exaslct_within_docker_container_with_container_build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
468914d925bab35af2f4f848ea4cadab51e743aafbe8d7d705ea851f32024092977a011a7df93d41a505d712051899cc4fd1b07312d424483b59d7ae885d2ec9 exaslct_within_docker_container_without_container_build.sh
4c6c5f8486b20bdba2c930117baf47926fcbc79cbb42cbbd462eec3004ab212a012f66f36a9fcf4c91f317b7241591c6367082cffcf1fb10323b225e7f11a081 exaslct_within_docker_container_without_container_build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bce2c32e4418cfd60b09fac1adc81a091a1a7f866d47b6d9e400a2de7634638f6b4b09a9fbac161d4cff939b4eb445fd216571e98b0cb66bc4595e6e46e7c0b4 exaslct_without_poetry.sh
f904d9b796823a23eaeb9647ac75eacd1d4360ce9ba59c6538d19a76f99c97ddafb93d962c336ee199dbf4538d2434959c066285c0ac69de2dc1f18ee9353d58 exaslct_without_poetry.sh
80 changes: 80 additions & 0 deletions starter_scripts/exaslct_within_docker_container_slim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#!/usr/bin/env bash

#set -e => immediately exit if any command [1] has a non-zero exit status
#set -u => reference to any variable you haven't previously defined is an error and causes the program to immediately exit.
#set -o pipefailt => This setting prevents errors in a pipeline from being masked.
# If any command in a pipeline fails,
# that return code will be used as the return code of the whole pipeline.
set -euo pipefail


RUNNER_IMAGE_NAME="$1"
shift 1

if [[ -t 1 ]]; then
terminal_parameter=-it
else
terminal_parameter=""
fi

RED='\033[0;31m'
printf "${RED} Using slim version of exaslct. Please note that all input/output artifacts (input flavor directories, output, log, etc.) needs to be within the current working directory.\n"

rl=readlink
if [[ "$(uname)" = Darwin ]]; then
rl=greadlink
fi

if [[ ! "$(command -v $rl)" ]]; then
echo readlink not available! Please install coreutils: On Linux \"apt-get install coreutils\" or similar. On MacOsX \"brew install coreutils\".
exit 1
fi

SCRIPT_DIR="$(dirname "$($rl -f "${BASH_SOURCE[0]}")")"

quoted_arguments=''
for argument in "${@}"; do
argument="${argument//\\/\\\\}"
quoted_arguments="$quoted_arguments \"${argument//\"/\\\"}\""
done

RUN_COMMAND="/script-languages-container-tool/starter_scripts/exaslct_without_poetry.sh $quoted_arguments; RETURN_CODE=\$?; chown -R $(id -u):$(id -g) .build_output &> /dev/null; exit \$RETURN_CODE"

HOST_DOCKER_SOCKER_PATH="/var/run/docker.sock"
CONTAINER_DOCKER_SOCKER_PATH="/var/run/docker.sock"
DOCKER_SOCKET_MOUNT="$HOST_DOCKER_SOCKER_PATH:$CONTAINER_DOCKER_SOCKER_PATH"

function create_env_file() {
touch "$tmpfile_env"
if [ -n "${TARGET_DOCKER_PASSWORD-}" ]; then
echo "TARGET_DOCKER_PASSWORD=$TARGET_DOCKER_PASSWORD" >> "$tmpfile_env"
fi
if [ -n "${SOURCE_DOCKER_PASSWORD-}" ]; then
echo "SOURCE_DOCKER_PASSWORD=$SOURCE_DOCKER_PASSWORD" >> "$tmpfile_env"
fi
}

function create_env_file_debug_protected() {
shell_options="$-"
case $shell_options in
*x*) set +x ;;
*) echo &>/dev/null ;;
esac

create_env_file "$1"

case $shell_options in
*x*) set -x ;;
*) echo &>/dev/null ;;
esac
}

old_umask=$(umask)
umask 277
tmpfile_env=$(mktemp)
trap 'rm -f -- "$tmpfile_env"' INT TERM HUP EXIT

create_env_file_debug_protected "$tmpfile_env"
docker run --network host --env-file "$tmpfile_env" --rm $terminal_parameter -v "$PWD:$PWD" -v "$DOCKER_SOCKET_MOUNT" -w "$PWD" "$RUNNER_IMAGE_NAME" bash -c "$RUN_COMMAND"

umask "$old_umask"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@

set -euo pipefail

SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
rl=readlink
if [[ "$(uname)" = Darwin ]]; then
rl=greadlink
fi

if [[ ! "$(command -v $rl)" ]]; then
echo readlink not available! Please install coreutils: On Linux \"apt-get install coreutils\" or similar. On MacOsX \"brew install coreutils\".
exit 1
fi

SCRIPT_DIR="$(dirname "$($rl -f "${BASH_SOURCE[0]}")")"


RUNNER_IMAGE_NAME="$1"
shift 1
Expand All @@ -12,4 +23,9 @@ if [ -z "$FIND_IMAGE_LOCALLY" ]; then
docker pull "$RUNNER_IMAGE_NAME" || bash "$SCRIPT_DIR/build_docker_runner_image.sh"
fi

bash "$SCRIPT_DIR/exaslct_within_docker_container.sh" "$RUNNER_IMAGE_NAME" "${@}"
EXEC_SCRIPT=exaslct_within_docker_container.sh
if [[ "$(uname)" = Darwin ]]; then
EXEC_SCRIPT=exaslct_within_docker_container_slim.sh
fi

bash "$SCRIPT_DIR/$EXEC_SCRIPT" "$RUNNER_IMAGE_NAME" "${@}"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@

set -euo pipefail

SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
rl=readlink
if [[ "$(uname)" = Darwin ]]; then
rl=greadlink
fi

if [[ ! "$(command -v $rl)" ]]; then
echo readlink not available! Please install coreutils: On Linux \"apt-get install coreutils\" or similar. On MacOsX \"brew install coreutils\".
exit 1
fi

SCRIPT_DIR="$(dirname "$($rl -f "${BASH_SOURCE[0]}")")"


RUNNER_IMAGE_NAME="$1"
shift 1
Expand All @@ -12,4 +23,9 @@ if [ -z "$FIND_IMAGE_LOCALLY" ]; then
docker pull "$RUNNER_IMAGE_NAME"
fi

bash "$SCRIPT_DIR/exaslct_within_docker_container.sh" "$RUNNER_IMAGE_NAME" "${@}"
EXEC_SCRIPT=exaslct_within_docker_container.sh
if [[ "$(uname)" = Darwin ]]; then
EXEC_SCRIPT=exaslct_within_docker_container_slim.sh
fi

bash "$SCRIPT_DIR/$EXEC_SCRIPT" "$RUNNER_IMAGE_NAME" "${@}"
12 changes: 11 additions & 1 deletion starter_scripts/exaslct_without_poetry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@

set -euo pipefail

SCRIPT_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
rl=readlink
if [[ "$(uname)" = Darwin ]]; then
rl=greadlink
fi

if [[ ! "$(command -v $rl)" ]]; then
echo readlink not available! Please install coreutils: On Linux \"apt-get install coreutils\" or similar. On MacOsX \"brew install coreutils\".
exit 1
fi

SCRIPT_DIR="$(dirname "$($rl -f "${BASH_SOURCE[0]}")")"
PROJECT_ROOT_DIR="$SCRIPT_DIR/.."

export PYTHONPATH="$PROJECT_ROOT_DIR/"
Expand Down