<commit_before>#!/usr/bin/env bash

set -eo pipefail

if [ -z "$TRAVIS_TAG" ]; then
  echo "Build is not a release, skipping CD" >&2; exit 0
fi

if [ -z "$DOCKER_USERNAME" -o -z "$DOCKER_PASSWORD" ]; then
  echo "No docker credentials configured, unable to publish builds" >&2; exit 1
fi

secrets_archive="$(mktemp)"
compose_file="$(mktemp)"
env_file='.env'
cert_file='cert.pem'

openssl aes-256-cbc -K $encrypted_2ff31a343d6c_key -iv $encrypted_2ff31a343d6c_iv -in travis/secrets.tar.enc -out "$secrets_archive" -d
tar xf "$secrets_archive" -C . "$cert_file" "$env_file"
touch "$env_file"

cleanup() {
  rm -f "$compose_file" "$env_file" "$secrets_archive" "$cert_file"
}
trap cleanup EXIT

APP_PORT="80" BUILD_TAG="$TRAVIS_TAG" ENV_FILE="$env_file" \
  docker-compose config > "$compose_file"

docker-compose -f "$compose_file" build

docker login --username="$DOCKER_USERNAME" --password="$<PASSWORD>"
docker-compose -f "$compose_file" push

if [ -z "$SERVICE_FABRIC_HOST" -o -z "$SERVICE_FABRIC_DEPLOYMENT_NAME" ]; then
  echo "No service fabric credentials configured, skipping upgrade of cluster" >&2; exit 0
fi

if [ ! -f "$cert_file" -o ! -s "$env_file" ]; then
  echo "No service fabric secrets found, unable to upgrade cluster" >&2; exit 2
fi

sudo python3 -m pip install sfctl

REQUESTS_CA_BUNDLE="$cert_file" sfctl cluster select --endpoint "https://$SERVICE_FABRIC_HOST:19080" --pem "$cert_file" --no-verify
sfctl compose upgrade --deployment-name "$SERVICE_FABRIC_DEPLOYMENT_NAME" --file-path "$compose_file"<commit_msg>Fix "no module named pip" issue on Travis<commit_after>#!/usr/bin/env bash

set -eo pipefail

if [ -z "$TRAVIS_TAG" ]; then
  echo "Build is not a release, skipping CD" >&2; exit 0
fi

if [ -z "$DOCKER_USERNAME" -o -z "$DOCKER_PASSWORD" ]; then
  echo "No docker credentials configured, unable to publish builds" >&2; exit 1
fi

secrets_archive="$(mktemp)"
compose_file="$(mktemp)"
env_file='.env'
cert_file='cert.pem'

openssl aes-256-cbc -K $encrypted_2ff31a343d6c_key -iv $encrypted_2ff31a343d6c_iv -in travis/secrets.tar.enc -out "$secrets_archive" -d
tar xf "$secrets_archive" -C . "$cert_file" "$env_file"
touch "$env_file"

cleanup() {
  rm -f "$compose_file" "$env_file" "$secrets_archive" "$cert_file"
}
trap cleanup EXIT

APP_PORT="80" BUILD_TAG="$TRAVIS_TAG" ENV_FILE="$env_file" \
  docker-compose config > "$compose_file"

docker-compose -f "$compose_file" build

docker login --username="$DOCKER_USERNAME" --password="$<PASSWORD>"
docker-compose -f "$compose_file" push

if [ -z "$SERVICE_FABRIC_HOST" -o -z "$SERVICE_FABRIC_DEPLOYMENT_NAME" ]; then
  echo "No service fabric credentials configured, skipping upgrade of cluster" >&2; exit 0
fi

if [ ! -f "$cert_file" -o ! -s "$env_file" ]; then
  echo "No service fabric secrets found, unable to upgrade cluster" >&2; exit 2
fi

sudo pip install sfctl

REQUESTS_CA_BUNDLE="$cert_file" sfctl cluster select --endpoint "https://$SERVICE_FABRIC_HOST:19080" --pem "$cert_file" --no-verify
sfctl compose upgrade --deployment-name "$SERVICE_FABRIC_DEPLOYMENT_NAME" --file-path "$compose_file"
{'fraction_non_alphanumeric': 0.14230145867098865, 'fraction_numerical': 0.02106969205834684, 'mean_word_length': 5.110891089108911, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '1297990', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1165, 'n_words': 316}