From 5c0440ac3f33deeb57de7207745333c55c86766d Mon Sep 17 00:00:00 2001 From: Parham Alvani Date: Mon, 21 Oct 2024 15:20:04 +0000 Subject: [PATCH 1/2] fix: respect to pipelines dir environment variable in start.sh --- start.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/start.sh b/start.sh index a6fd1f63..dfabf4a6 100755 --- a/start.sh +++ b/start.sh @@ -8,13 +8,13 @@ PIPELINES_DIR=${PIPELINES_DIR:-./pipelines} reset_pipelines_dir() { if [ "$RESET_PIPELINES_DIR" = true ]; then echo "Resetting pipelines directory: $PIPELINES_DIR" - + # Check if the directory exists if [ -d "$PIPELINES_DIR" ]; then # Remove all contents of the directory rm -rf "${PIPELINES_DIR:?}"/* echo "All contents in $PIPELINES_DIR have been removed." - + # Optionally recreate the directory if needed mkdir -p "$PIPELINES_DIR" echo "$PIPELINES_DIR has been recreated." @@ -87,14 +87,14 @@ install_frontmatter_requirements() { local file_content=$(cat "$1") # Extract the first triple-quoted block local first_block=$(echo "$file_content" | awk '/"""/{flag=!flag; if(flag) count++; if(count == 2) {exit}} flag' ) - + # Check if the block contains requirements local requirements=$(echo "$first_block" | grep -i 'requirements:') - + if [ -n "$requirements" ]; then # Extract the requirements list requirements=$(echo "$requirements" | awk -F': ' '{print $2}' | tr ',' ' ' | tr -d '\r') - + # Construct and echo the pip install command local pip_command="pip install $requirements" echo "$pip_command" @@ -108,8 +108,9 @@ install_frontmatter_requirements() { # Check if PIPELINES_URLS environment variable is set and non-empty if [[ -n "$PIPELINES_URLS" ]]; then - pipelines_dir="./pipelines" - mkdir -p "$pipelines_dir" + if [ ! -d "$PIPELINES_DIR" ]; then + mkdir -p "$PIPELINES_DIR" + fi # Split PIPELINES_URLS by ';' and iterate over each path IFS=';' read -ra ADDR <<< "$PIPELINES_URLS" From 886d9e61102c1f64a9c5b403bdca6e701317e31c Mon Sep 17 00:00:00 2001 From: Parham Alvani Date: Mon, 21 Oct 2024 15:20:47 +0000 Subject: [PATCH 2/2] fix: respect to pipelines dir environment variable in start.sh --- start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.sh b/start.sh index dfabf4a6..e2ddd8b4 100755 --- a/start.sh +++ b/start.sh @@ -115,7 +115,7 @@ if [[ -n "$PIPELINES_URLS" ]]; then # Split PIPELINES_URLS by ';' and iterate over each path IFS=';' read -ra ADDR <<< "$PIPELINES_URLS" for path in "${ADDR[@]}"; do - download_pipelines "$path" "$pipelines_dir" + download_pipelines "$path" "$PIPELINES_DIR" done for file in "$pipelines_dir"/*; do