Skip to content

Commit

Permalink
fix: start script
Browse files Browse the repository at this point in the history
  • Loading branch information
tjbck committed May 31, 2024
1 parent 2bb329a commit 2059c7d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,28 @@ download_pipelines() {
# Function to parse and install requirements from frontmatter
install_frontmatter_requirements() {
local file=$1

echo "Checking $file for requirements in frontmatter..."

# Extract the frontmatter if it exists
frontmatter=$(sed -n '/^---$/,/^---$/p' "$file")

if echo "$frontmatter" | grep -q "requirements:"; then
# Extract lines starting from "requirements:" to the end of the block or until another top-level key is found
requirements=$(echo "$frontmatter" | sed -n '/^requirements:/,/^[a-zA-Z\-]*:/p' | sed -e '1d' -e '$d' | tr -d ',\n')
requirements=$(echo "$requirements" | awk '{$1=$1};1')
echo "Installing requirements: $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"
pip install $requirements
else
echo "No requirements found in frontmatter of $file."
fi
}



# Check if PIPELINES_URLS environment variable is set and non-empty
if [[ -n "$PIPELINES_URLS" ]]; then
pipelines_dir="./pipelines"
Expand Down

0 comments on commit 2059c7d

Please sign in to comment.