<commit_before>#!/bin/bash
set -o pipefail
IFS=$'\n\t'

DOCKER_SOCKET=/var/run/docker.sock

if [ ! -e "${DOCKER_SOCKET}" ]; then
  echo "Docker socket missing at ${DOCKER_SOCKET}"
  exit 1
fi

TAG="${BUILD_TAG}"
if [ -n "${REGISTRY}" ]; then
  TAG="${REGISTRY}/${BUILD_TAG}"
elif [ -n "${DOCKER_REGISTRY}" ]; then
  TAG="${DOCKER_REGISTRY}/${BUILD_TAG}"
fi

if [[ "${SOURCE_URI}" != "git://"* ]] && [[ "${SOURCE_URI}" != "git@"* ]]; then
  URL="${SOURCE_URI}"
  if [[ "${URL}" != "http://"* ]] && [[ "${URL}" != "https://"* ]]; then
    URL="https://${URL}"
  fi
  curl --head --silent --fail --location --max-time 16 $URL > /dev/null<commit_msg>support old docker_context_url env variable<commit_after>#!/bin/bash
set -o pipefail
IFS=$'\n\t'

DOCKER_SOCKET=/var/run/docker.sock

if [ ! -e "${DOCKER_SOCKET}" ]; then
  echo "Docker socket missing at ${DOCKER_SOCKET}"
  exit 1
fi

TAG="${BUILD_TAG}"
if [ -n "${REGISTRY}" ]; then
  TAG="${REGISTRY}/${BUILD_TAG}"
elif [ -n "${DOCKER_REGISTRY}" ]; then
  TAG="${DOCKER_REGISTRY}/${BUILD_TAG}"
fi

# backwards compatibility for older openshift versions that passed docker context instead of source_uri
if [ -n "${DOCKER_CONTEXT_URL}" ]; then
  SOURCE_URI=${DOCKER_CONTEXT_URL}
fi

if [[ "${SOURCE_URI}" != "git://"* ]] && [[ "${SOURCE_URI}" != "git@"* ]]; then
  URL="${SOURCE_URI}"
  if [[ "${URL}" != "http://"* ]] && [[ "${URL}" != "https://"* ]]; then
    URL="https://${URL}"
  fi
  curl --head --silent --fail --location --max-time 16 $URL > /dev/null
{'fraction_non_alphanumeric': 0.24850498338870433, 'fraction_numerical': 0.003986710963455149, 'mean_word_length': 4.003322259136213, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, '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': '7049954', 'n_tokens_mistral': 606, 'n_tokens_neox': 575, 'n_words': 132}