<commit_before>#!/bin/bash
# Run the connector 
set -e

trap 'echo Receive itttt' SIGTERM SIGINT

# Set up go environment
export GOROOT=/go
export GOPATH=/gocode
PATH=$PATH:$GOROOT/bin:$GOPATH/bin
mkdir -p $GOPATH/bin

# Pull cocoon source
branch=$CONNECTOR_VERSION
repoOwner=github.com/ncodes
repoOwnerDir=$GOPATH/src/$repoOwner
mkdir -p $repoOwnerDir
cd $repoOwnerDir
printf "> Fetching cocoon source. [branch=$branch] [dest=$repoOwnerDir]\n"
rm -rf cocoon
git clone --depth=1 -b $branch https://$repoOwner/cocoon

# build the binary
printf "> Building cocoon"
cd cocoon
rm -rf .glide/ && rm -rf vendor
glide --debug install
go build -v -o $GOPATH/bin/cocoon core/main.go

# pull launch-go image
docker pull ncodes/launch-go:latest 

while true; do
	: # Do nothing
done

# # start connector 
# printf "Running Cocoon Connector"
# cocoon connector <commit_msg>pass signal TERM/INT to cocoon<commit_after>#!/bin/bash
# Run the connector 
set -e

trap 'kill -TERM $CPID' SIGTERM SIGINT

# Set up go environment
export GOROOT=/go
export GOPATH=/gocode
PATH=$PATH:$GOROOT/bin:$GOPATH/bin
mkdir -p $GOPATH/bin

# Pull cocoon source
branch=$CONNECTOR_VERSION
repoOwner=github.com/ncodes
repoOwnerDir=$GOPATH/src/$repoOwner
mkdir -p $repoOwnerDir
cd $repoOwnerDir
printf "> Fetching cocoon source. [branch=$branch] [dest=$repoOwnerDir]\n"
rm -rf cocoon
git clone --depth=1 -b $branch https://$repoOwner/cocoon

# build the binary
printf "> Building cocoon"
cd cocoon
rm -rf .glide/ && rm -rf vendor
glide --debug install
go build -v -o $GOPATH/bin/cocoon core/main.go

# pull launch-go image
docker pull ncodes/launch-go:latest 

# start connector, store its process id and wait for it.
printf "Running Cocoon Connector"
cocoon connector & 
CPID=$!
wait $CPID
wait $CPID
EXIT_STATUS=$?
{'fraction_non_alphanumeric': 0.11467116357504216, 'fraction_numerical': 0.0011242270938729624, 'mean_word_length': 4.545171339563863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2099007', 'n_tokens_mistral': 671, 'n_tokens_neox': 629, 'n_words': 198}