<commit_before>#!/bin/bash

setup() {
	mkdir -p /kontinuous/{src,status}/${PIPELINE_ID}/${BUILD_ID}/${STAGE_ID}
}

prepare_kube_config() {
	# replace token for kube config
	sed -i "s/{{token}}/$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)/g" /root/.kube/config
}

wait_for_ready() {
	echo "Waiting for ready signal..."
	until [[ -f /kontinuous/status/${PIPELINE_ID}/${BUILD_ID}/${STAGE_ID}/ready ]]; do
		sleep 5
	done
}

create_dependencies() {
	for dependency in ${DEPENDENCIES}; do
		deploy ${dependency}
	done
}

cleanup_dependencies() {
	for dependency in ${DEPENDENCIES}; do
		clean ${dependency}
	done
}

deploy(){
	echo "Deploying App to Kubernetes Cluster"
    #local deployFile="${WORKING_DIR}/${DEPLOY_FILE}"
    local deployFile="${WORKING_DIR}/$1"

    if [[ ! -f ${deployFile} ]]; then

        echo "Deploy Failed. $deployFile is unavailable."
        return 1
    fi

    kubectl create -f ${deployFile}
    if [[ "$?" != "0" ]]; then
        echo "Deploy Failed. Unable to deploy app."
        return 1
    fi 
    echo "Deploy Successful"
    return 0
}

clean(){
    echo "Cleaning up"
    local deployFile="${WORKING_DIR}/$1"
    if [[ ! -f deployFile ]]; then
        echo "Clean up Failed. File is unavailable."
        return 1
    fi

    kubectl delete -f deployFile
    if [[ "$?" == "1" ]]; then
        echo "Clean up Failed. Unable to remove app from the cluster."
        exit 1
    fi <commit_msg>fix cleanup error<commit_after>#!/bin/bash

setup() {
	mkdir -p /kontinuous/{src,status}/${PIPELINE_ID}/${BUILD_ID}/${STAGE_ID}
}

prepare_kube_config() {
	# replace token for kube config
	sed -i "s/{{token}}/$(cat /var/run/secrets/kubernetes.io/serviceaccount/token)/g" /root/.kube/config
}

wait_for_ready() {
	echo "Waiting for ready signal..."
	until [[ -f /kontinuous/status/${PIPELINE_ID}/${BUILD_ID}/${STAGE_ID}/ready ]]; do
		sleep 5
	done
}

create_dependencies() {
	for dependency in ${DEPENDENCIES}; do
		deploy ${dependency}
	done
}

cleanup_dependencies() {
	for dependency in ${DEPENDENCIES}; do
		clean ${dependency}
	done
}

deploy(){
	echo "Deploying App to Kubernetes Cluster"
    #local deployFile="${WORKING_DIR}/${DEPLOY_FILE}"
    local deployFile="${WORKING_DIR}/$1"

    if [[ ! -f ${deployFile} ]]; then

        echo "Deploy Failed. $deployFile is unavailable."
        return 1
    fi

    kubectl create -f ${deployFile}
    if [[ "$?" != "0" ]]; then
        echo "Deploy Failed. Unable to deploy app."
        return 1
    fi 
    echo "Deploy Successful"
    return 0
}

clean(){
    echo "Cleaning up"
    local deployFile="${WORKING_DIR}/$1"
    if [[ ! -f ${deployFile} ]]; then
        echo "Clean up Failed. File is unavailable."
        return 1
    fi

    kubectl delete -f ${deployFile}
    if [[ "$?" == "1" ]]; then
        echo "Clean up Failed. Unable to remove app from the cluster."
        exit 1
    fi 
{'fraction_non_alphanumeric': 0.1507607192254495, 'fraction_numerical': 0.006915629322268326, 'mean_word_length': 2.925373134328358, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '2114150', 'n_tokens_mistral': 1064, 'n_tokens_neox': 987, 'n_words': 270}