Skip to content

Commit

Permalink
Fix: modified parsing for ENVS in pr-deploy.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Data-Bishop committed Aug 2, 2024
1 parent 1074188 commit 7bf5a58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ if [ "$PR_ACTION" == "opened" ]; then
fi

echo "ENVS1=$ENVS"
ENV_ARGS=$(echo "$ENVS" | tr '\n' ' ' )
ENV_ARGS=$(echo "$ENVS" | tr '\n' ',' )
echo "ENV_ARGS=$ENV_ARGS"

# Copy the pr-deploy.sh script to the remote server.
Expand Down
6 changes: 3 additions & 3 deletions pr-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ REPO_ID=$5
BRANCH=$6
PR_ACTION=$7
PR_NUMBER=$8
ENV_ARGS="$9"
ENVS="$9"
COMMENT_ID=${10}
PR_ID="pr_${REPO_ID}${PR_NUMBER}"
# JSON file to store PIDs
Expand Down Expand Up @@ -110,11 +110,11 @@ sudo docker build -t $PR_ID -f $DOCKERFILE .
echo "Running docker container..."
# sudo docker run -d -p $FREE_PORT:$EXPOSED_PORT --name $PR_ID $PR_ID

ENVS=$(echo "$ENVS" | tr ' ' '\n' | sed 's/^/-e /' | tr '\n' ' ')
ENV_ARGS=$(echo "$ENVS" | tr ',' '\n' | sed 's/^/-e /' | tr '\n' ' ')
# ENV_ARGS=$(echo "$ENVS" | sed 's/^/-e /' | tr '\n' ' ')
# echo "ENV_ARGS: $ENVS"
# ENV_ARGS=$(echo "$ENVS" | sed 's/^/-e /' | sed ':a;N;$!ba;s/\n/ -e /g')
sudo docker run -d "$ENVS" -p $FREE_PORT:$EXPOSED_PORT --name $PR_ID $PR_ID
sudo docker run -d $ENV_ARGS -p $FREE_PORT:$EXPOSED_PORT --name $PR_ID $PR_ID

echo "Start SSH session..."
nohup ssh -tt -o StrictHostKeyChecking=no -R 80:localhost:$FREE_PORT serveo.net > serveo_output.log 2>&1 &
Expand Down

0 comments on commit 7bf5a58

Please sign in to comment.