<commit_before>#!/bin/bash

set -e

tags=$@

password_url="taskcluster/secrets/v1/secret/repo:github.com/mozilla/balrog:dockerhub"
artifact_url="taskcluster/queue/v1/task/${TASK_ID}/runs/${RUN_ID}/artifacts/public/docker-image-shasum256.txt"
artifact_expiry=$(date -d "+1 year" -u +%FT%TZ)
dockerhub_email=<EMAIL>
dockerhub_username=mozillabalrog
dockerhub_password=$(curl ${password_url} | python -c 'import json, sys; a = json.load(sys.stdin); print a["secret"]["dockerhub_password"]')

if [ -z $dockerhub_password ]; then
    echo "Dockerhub password not set, can't continue!"
    exit 1
fi
if [ ${#tags[@]} -eq 0 ]; then
    echo "Must pass at least one tag"
    exit 2
fi

commit=$(git rev-parse HEAD)
version=$(cat version.txt)

cat > version.json <<EOF
{
    "commit": "${commit}",
    "version": "${version}",
    "source": "https://github.com/mozilla/balrog",
    "build": "https://tools.taskcluster.net/task-inspector/#${TASK_ID}"
}
EOF

echo "Building Docker image"
docker build -t buildtemp .
echo "Logging into Dockerhub"
docker login -e $dockerhub_email -u $dockerhub_username -p $dockerhub_password

for tag in ${tags[@]}; do
    echo "Tagging Docker image with ${tag}"
    docker tag buildtemp "mozilla/balrog:${tag}"
    echo "Pushing Docker image tagged with ${tag}"<commit_msg>Explicitly convert $@ to array (#681)<commit_after>#!/bin/bash

set -e

tags=( $@ )

password_url="taskcluster/secrets/v1/secret/repo:github.com/mozilla/balrog:dockerhub"
artifact_url="taskcluster/queue/v1/task/${TASK_ID}/runs/${RUN_ID}/artifacts/public/docker-image-shasum256.txt"
artifact_expiry=$(date -d "+1 year" -u +%FT%TZ)
dockerhub_email=<EMAIL>
dockerhub_username=mozillabalrog
dockerhub_password=$(curl ${password_url} | python -c 'import json, sys; a = json.load(sys.stdin); print a["secret"]["dockerhub_password"]')

if [ -z $dockerhub_password ]; then
    echo "Dockerhub password not set, can't continue!"
    exit 1
fi
if [ ${#tags[*]} -eq 0 ]; then
    echo "Must pass at least one tag"
    exit 2
fi

commit=$(git rev-parse HEAD)
version=$(cat version.txt)

cat > version.json <<EOF
{
    "commit": "${commit}",
    "version": "${version}",
    "source": "https://github.com/mozilla/balrog",
    "build": "https://tools.taskcluster.net/task-inspector/#${TASK_ID}"
}
EOF

echo "Building Docker image"
docker build -t buildtemp .
echo "Logging into Dockerhub"
docker login -e $dockerhub_email -u $dockerhub_username -p $dockerhub_password

for tag in ${tags[*]}; do
    echo "Tagging Docker image with ${tag}"
    docker tag buildtemp "mozilla/balrog:${tag}"
    echo "Pushing Docker image tagged with ${tag}"
{'fraction_non_alphanumeric': 0.16221374045801526, 'fraction_numerical': 0.00801526717557252, 'mean_word_length': 4.74780701754386, 'pattern_counts': {'":': 8, '<': 9, '<?xml version=': 0, '>': 7, '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': '2238615', 'n_tokens_mistral': 972, 'n_tokens_neox': 895, 'n_words': 229}