Skip to content

Commit

Permalink
Merge pull request #303 from 1995parham/main
Browse files Browse the repository at this point in the history
Respect to `PIPELINES_DIR` in start.sh
  • Loading branch information
tjbck authored Oct 22, 2024
2 parents 1c02f70 + 886d9e6 commit 372350b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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"
Expand All @@ -108,13 +108,14 @@ 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"
for path in "${ADDR[@]}"; do
download_pipelines "$path" "$pipelines_dir"
download_pipelines "$path" "$PIPELINES_DIR"
done

for file in "$pipelines_dir"/*; do
Expand Down

0 comments on commit 372350b

Please sign in to comment.