<commit_before>#!/bin/sh
REPOSITORY="ardoq/ardoq-swagger-addon"

if [ "${CIRCLE_BRANCH}" == "master" ]; then
    DOCKER_TAG=$(head -n 1 project.clj | awk '{gsub(/"/, "", $3); print $3}')
elif  [ "${CIRCLE_BRANCH}" == "test" ] \
     || [ "${CIRCLE_BRANCH:0:12}" = "internal-env" ]
then
    DOCKER_TAG=$(head -n 1 project.clj | awk '{gsub(/"/, "", $3); print $3}')-${CIRCLE_SHA1:0:7}
fi

RESPONSE=$(curl --write-out %{http_code} --silent --output /dev/null -H "Authorization: Basic $DOCKER_AUTH" \
                "https://index.docker.io/v1/repositories/$REPOSITORY/tags/$DOCKER_TAG")

if [ $RESPONSE -eq 404 ]; then
    echo "Building docker container..."
    docker build -t $REPOSITORY:$DOCKER_TAG .
    if [ "${CIRCLE_BRANCH}" == "master" ]; then
      docker tag $REPOSITORY:$DOCKER_TAG $REPOSITORY:latest
    elif [ "${CIRCLE_BRANCH}" == "test" ]; then
      docker tag $REPOSITORY:$DOCKER_TAG $REPOSITORY:test
    elif [ "${CIRCLE_BRANCH:0:12}" = "internal-env" ]; then
      docker tag $REPOSITORY:$DOCKER_TAG
    fi<commit_msg>CircleCI: fix pushing images to Docker Hub<commit_after>#!/bin/sh
REPOSITORY="ardoq/ardoq-swagger-addon"

if [ "${CIRCLE_BRANCH}" == "master" ]; then
    DOCKER_TAG=$(head -n 1 project.clj | awk '{gsub(/"/, "", $3); print $3}')
elif  [ "${CIRCLE_BRANCH}" == "test" ] \
     || [ "${CIRCLE_BRANCH:0:12}" = "internal-env" ]
then
    DOCKER_TAG=$(head -n 1 project.clj | awk '{gsub(/"/, "", $3); print $3}')-${CIRCLE_SHA1:0:7}
fi

RESPONSE=$(curl --write-out %{http_code} --silent --output /dev/null -H "Authorization: Basic $DOCKER_AUTH" \
                "https://hub.docker.com/v1/repositories/$REPOSITORY/tags/$DOCKER_TAG")

if [ $RESPONSE -eq 404 ]; then
    echo "Building docker container..."
    docker build -t $REPOSITORY:$DOCKER_TAG .
    if [ "${CIRCLE_BRANCH}" == "master" ]; then
      docker tag $REPOSITORY:$DOCKER_TAG $REPOSITORY:latest
    elif [ "${CIRCLE_BRANCH}" == "test" ]; then
      docker tag $REPOSITORY:$DOCKER_TAG $REPOSITORY:test
    elif [ "${CIRCLE_BRANCH:0:12}" = "internal-env" ]; then
      docker tag $REPOSITORY:$DOCKER_TAG
    fi
{'fraction_non_alphanumeric': 0.19666666666666666, 'fraction_numerical': 0.018095238095238095, 'mean_word_length': 3.6175824175824176, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5869153', 'n_tokens_mistral': 879, 'n_tokens_neox': 833, 'n_words': 163}