<commit_before>set -ex

cd batch

gcloud -q auth activate-service-account \
  --key-file=/secrets/gcr-push-service-account-key.json

gcloud -q auth configure-docker

SHA=$(git rev-parse --short=12 HEAD)

# get sha label of batch deployment
DEPLOYED_SHA=$(kubectl get --selector=app=batch deployments -o "jsonpath={.items[*].metadata.labels.hail\.is/sha}")

if [[ $(git cat-file -t "$DEPLOYED_SHA" 2>/dev/null || true) == commit ]]; then
    if [[ "$SHA" == "$DEPLOYED_SHA" ]]; then
	exit 0
    fi

    NEEDS_REDEPLOY=$(cd $ROOT && python3 project-changed.py $DEPLOYED_SHA batch)
    if [[ $NEEDS_REDEPLOY = no ]]; then
        exit 0
    fi
fi

# requires docker
make push-batch

sed -e "s,@sha@,$SHA," \
    -e "s,@image@,$(cat batch-image)," \
    < deployment.yaml.in > deployment.yaml

kubectl apply -f deployment.yaml

# ci can't recover from batch restart yet
kubectl delete pods -l app=hail-ci
<commit_msg>fix hail ci deploy (#4442)<commit_after>set -ex

gcloud -q auth activate-service-account \
  --key-file=/secrets/gcr-push-service-account-key.json

gcloud -q auth configure-docker

SHA=$(git rev-parse --short=12 HEAD)

# get sha label of batch deployment
DEPLOYED_SHA=$(kubectl get --selector=app=batch deployments -o "jsonpath={.items[*].metadata.labels.hail\.is/sha}")

if [[ $(git cat-file -t "$DEPLOYED_SHA" 2>/dev/null || true) == commit ]]; then
    if [[ "$SHA" == "$DEPLOYED_SHA" ]]; then
	exit 0
    fi

    NEEDS_REDEPLOY=$(cd $ROOT && python3 project-changed.py $DEPLOYED_SHA batch)
    if [[ $NEEDS_REDEPLOY = no ]]; then
        exit 0
    fi
fi

# requires docker
make push-batch

sed -e "s,@sha@,$SHA," \
    -e "s,@image@,$(cat batch-image)," \
    < deployment.yaml.in > deployment.yaml

kubectl apply -f deployment.yaml

# ci can't recover from batch restart yet
kubectl delete pods -l app=hail-ci

{'fraction_non_alphanumeric': 0.1558228540185894, 'fraction_numerical': 0.008747949699289229, 'mean_word_length': 3.441747572815534, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '5288745', 'n_tokens_mistral': 720, 'n_tokens_neox': 676, 'n_words': 176}