<commit_before>#!/bin/bash
#Note: This script is intended for jenkins.
#Please run this from the top level of the infrastructure repo

#Dump the freshly built images into a tarball
/usr/bin/docker save spa > /tmp/spa.tar &&\
/bin/echo "Docker images exported" &&\
/bin/gzip -1 /tmp/spa.tar &&\
/bin/echo "Exported images now compressed"

#Store the image in an s3 bucket for the BSVE deployment scripts
aws s3 cp /tmp/spa.tar.gz s3://bsve-integration/spa.tar.gz &&\
/bin/echo "Images uploaded"

/bin/echo "Notify BSVE to redeploy"
aws sns publish --topic-arn arn:aws:sns:us-east-1:789867670404:EHA-Git-Lambda --message '{"app":"spa"}' --profile bsve-user

#Useful alias/function
export ssh_command="/usr/bin/ssh -i /keys/infrastructure.pem  <EMAIL> "
function scp_file { /usr/bin/scp -i /keys/infrastructure.pem $1 <EMAIL>:/tmp/; }

#Import images on demo box
scp_file /tmp/spa.tar.gz &&\
$ssh_command /bin/gzip -d /tmp/spa.tar.gz &&\
$ssh_command "/usr/bin/sudo /usr/bin/docker load < /tmp/spa.tar" &&\
/bin/echo "Images now imported on remote"

#Clean up old data
/bin/rm /tmp/spa.tar.gz &&\
$ssh_command /bin/rm /tmp/spa.tar &&\

#Setup AWS credentials in shared directory
scp_file /var/lib/jenkins/.aws/credentials &&\
$ssh_command "sudo /bin/mkdir -p /shared/.aws" &&\
$ssh_command "sudo /bin/mv /tmp/credentials /shared/.aws"

#Reprovision containers
scp_file docker/containers/spa.yml &&\
$ssh_command "sudo docker-compose -f /tmp/spa.yml up -d"<commit_msg>Upload spa to bsve bucket on new deploys<commit_after>#!/bin/bash
#Note: This script is intended for jenkins.
#Please run this from the top level of the infrastructure repo

#Dump the freshly built images into a tarball
/usr/bin/docker save spa > /tmp/spa.tar &&\
/bin/echo "Docker images exported" &&\
/bin/gzip -1 /tmp/spa.tar &&\
/bin/echo "Exported images now compressed"

#Store the image in an s3 bucket for the BSVE deployment scripts
aws s3 cp /tmp/spa.tar.gz s3://bsve-integration/spa.tar.gz &&\
/bin/echo "Images uploaded"

/bin/echo "Notify BSVE to redeploy"
aws sns publish --topic-arn arn:aws:sns:us-east-1:789867670404:EHA-Git-Lambda --message '{"app":"spa"}' --profile bsve-user

#Useful alias/function
export ssh_command="/usr/bin/ssh -i /keys/infrastructure.pem  <EMAIL>ha.io "
function scp_file { /usr/bin/scp -i /keys/infrastructure.pem $1 ubuntu<EMAIL>ha.io:/tmp/; }

#Import images on demo box
scp_file /tmp/spa.tar.gz &&\
$ssh_command /bin/gzip -d /tmp/spa.tar.gz &&\
$ssh_command "/usr/bin/sudo /usr/bin/docker load < /tmp/spa.tar" &&\
/bin/echo "Images now imported on remote"

#Clean up old data
/bin/rm /tmp/spa.tar.gz &&\
$ssh_command /bin/rm /tmp/spa.tar &&\

#Setup AWS credentials in shared directory
scp_file /var/lib/jenkins/.aws/credentials &&\
$ssh_command "sudo /bin/mkdir -p /shared/.aws" &&\
$ssh_command "sudo /bin/mv /tmp/credentials /shared/.aws"

#Reprovision containers
scp_file docker/containers/spa.yml &&\
$ssh_command "sudo docker-compose -f /tmp/spa.yml up -d"

#Upload new docker image to S3
$ssh_command "
  sudo rm /tmp/spa.tar.gz
  sudo docker save spa > /tmp/spa.tar &&\
  sudo gzip -1 /tmp/spa.tar &&\
  sudo aws s3 cp /tmp/spa.tar.gz s3://bsve-integration/spa.tar.gz
  sudo rm /tmp/spa.tar.gz
"
{'fraction_non_alphanumeric': 0.15348692403486924, 'fraction_numerical': 0.012453300124533, 'mean_word_length': 3.5704125177809387, 'pattern_counts': {'":': 2, '<': 9, '<?xml version=': 0, '>': 10, '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': '1419509', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1221, 'n_words': 336}