<commit_before>#!/bin/bash

set -e

echo "Check modified files"
git show --name-status $DRONE_COMMIT_SHA | grep '^[MA]\s'  | sed -e 's/^[MA]\s*//g' | while read i; do echo $i ; done > /tmp/out
cat /tmp/out
IS_DOCKER_FILE=0
while read p
do
    echo "Check $p"
    curfile=`basename $p`
    dirfile=`dirname $p`
    if [ $curfile == "Dockerfile" ]
    then
        IS_DOCKER_FILE=1
        echo "PLUGIN_DOCKERFILE=$p" > DRONE_ENV
        major=`sed -n 's/.*\ssoftware.version="\(.*\)"\s*\\\*/\1/p' $p`
        minor=`sed -n 's/.*\sversion="\(.*\)"\s*\\\*/\1/p' $p`
        version=$major-$minor
        echo "## $version ==> $minor"
        if [ "$minor" == "" ]
        then
            version=$major
        fi
        software=`sed -n 's/.*\ssoftware="\(.*\)"\s*\\\*/\1/p' $p`
        container=`sed -n 's/.*\scontainer="\(.*\)"\s*\\\*/\1/p' $p`
        if [ "$container" == "" ]
        then
            echo "no container name, use software name"
        else
            software=$container
        fi
        if [ "$version" == "-" ]
        then
            echo "Could not extract version from Dockerfile: $p"
            exit 1
        fi
        echo "DOCKERFILE=$p" >> DRONE_ENV
        echo "PLUGIN_TAG=$version" >> DRONE_ENV
        echo "PLUGIN_REPO=openstack-192-168-100-43.genouest.org/osallou/$software" >> DRONE_ENV
        echo "BIOCONTAINER_DIR=$dirfile" >> DRONE_ENV
        echo "PLUGIN_REGISTRY=openstack-192-168-100-43.genouest.org" >> DRONE_ENV
    else
        echo "No Dockerfile here, skipping"
    fi

done < /tmp/out

if [ $IS_DOCKER_FILE == 0 ]
then
    echo "No Dockerfile found"
    exit 1
fi

rm -f /tmp/out
cat DRONE_ENV
<commit_msg>check if this is a pull request to disable docker push<commit_after>#!/bin/bash

set -e

echo "Check modified files"
git show --name-status $DRONE_COMMIT_SHA | grep '^[MA]\s'  | sed -e 's/^[MA]\s*//g' | while read i; do echo $i ; done > /tmp/out
cat /tmp/out
IS_DOCKER_FILE=0
while read p
do
    echo "Check $p"
    curfile=`basename $p`
    dirfile=`dirname $p`
    if [ $curfile == "Dockerfile" ]
    then
        IS_DOCKER_FILE=1
        echo "PLUGIN_DOCKERFILE=$p" > DRONE_ENV
        major=`sed -n 's/.*\ssoftware.version="\(.*\)"\s*\\\*/\1/p' $p`
        minor=`sed -n 's/.*\sversion="\(.*\)"\s*\\\*/\1/p' $p`
        version=$major-$minor
        echo "## $version ==> $minor"
        if [ "$minor" == "" ]
        then
            version=$major
        fi
        software=`sed -n 's/.*\ssoftware="\(.*\)"\s*\\\*/\1/p' $p`
        container=`sed -n 's/.*\scontainer="\(.*\)"\s*\\\*/\1/p' $p`
        if [ "$container" == "" ]
        then
            echo "no container name, use software name"
        else
            software=$container
        fi
        if [ "$version" == "-" ]
        then
            echo "Could not extract version from Dockerfile: $p"
            exit 1
        fi
        echo "DOCKERFILE=$p" >> DRONE_ENV
        echo "PLUGIN_TAG=$version" >> DRONE_ENV
        echo "PLUGIN_REPO=openstack-192-168-100-43.genouest.org/osallou/$software" >> DRONE_ENV
        echo "BIOCONTAINER_DIR=$dirfile" >> DRONE_ENV
        echo "PLUGIN_REGISTRY=openstack-192-168-100-43.genouest.org" >> DRONE_ENV
        if [ "$DRONE_BUILD_EVENT" == "pull_request" ]
        then
            echo -e "\033[0;31mWARN:\033[0 this is a pull request, skip push of image"
            echo "PLUGIN_DRY_RUN=1" >> DRONE_ENV
        fi
    else
        echo "No Dockerfile here, skipping"
    fi

done < /tmp/out

if [ $IS_DOCKER_FILE == 0 ]
then
    echo "No Dockerfile found"
    exit 1
fi

rm -f /tmp/out
cat DRONE_ENV

{'fraction_non_alphanumeric': 0.17098301308827624, 'fraction_numerical': 0.020328599275967696, 'mean_word_length': 1.9883527454242929, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, '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': '6895997', 'n_tokens_mistral': 1422, 'n_tokens_neox': 1321, 'n_words': 306}