2023-07-28 15:45:04 +02:00
|
|
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)"
|
|
|
|
. "$DIR/prelude.sh"
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
|
2023-08-15 16:58:20 +02:00
|
|
|
# The antithesis docker repository to push images to
|
|
|
|
antithesis_repo="us-central1-docker.pkg.dev/molten-verve-216720/mongodb-repository"
|
|
|
|
|
2023-11-09 19:33:02 +01:00
|
|
|
# tag images as evergreen[-${antithesis_build_type}]-{latest,patch} or just ${antithesis_image_tag}
|
2023-07-28 15:45:04 +02:00
|
|
|
if [ -n "${antithesis_image_tag:-}" ]; then
|
|
|
|
echo "Using provided tag: '$antithesis_image_tag' for docker pushes"
|
|
|
|
tag=$antithesis_image_tag
|
2023-11-09 19:33:02 +01:00
|
|
|
else
|
|
|
|
tag="evergreen"
|
|
|
|
if [[ -n "${antithesis_build_type}" ]]; then
|
|
|
|
tag="${tag}-${antithesis_build_type}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "${is_patch}" = "true" ]; then
|
|
|
|
tag="${tag}-patch"
|
|
|
|
else
|
|
|
|
tag="${tag}-latest-${branch_name}"
|
|
|
|
fi
|
2023-07-28 15:45:04 +02:00
|
|
|
fi
|
|
|
|
|
2023-09-06 05:01:32 +02:00
|
|
|
# Clean up any leftover docker artifacts
|
|
|
|
sudo docker logout
|
|
|
|
sudo docker rm $(docker ps -a -q) --force || echo "No pre-existing containers"
|
|
|
|
sudo docker network prune --force
|
|
|
|
|
2024-05-24 17:08:11 +02:00
|
|
|
# Temporary fix until DEVPROD-6961 is complete
|
|
|
|
# move docker data dir out of the root partition
|
|
|
|
sudo service docker stop
|
|
|
|
sudo mkdir -p /data/mci/docker
|
|
|
|
if ! sudo jq -e . /etc/docker/daemon.json; then
|
|
|
|
echo "docker daemon.json did not exist or was invalid"
|
|
|
|
echo "setting docker daemon.json to {}"
|
|
|
|
sudo sh -c 'echo "{}" > /etc/docker/daemon.json'
|
|
|
|
fi
|
|
|
|
MODIFIED_JSON=$(sudo jq '."data-root" |= "/data/mci/docker"' /etc/docker/daemon.json)
|
|
|
|
sudo echo "${MODIFIED_JSON}" | sudo tee /etc/docker/daemon.json
|
|
|
|
echo "docker daemon.json: set data-root to /data/mci/docker"
|
|
|
|
sudo service docker start
|
|
|
|
|
2023-09-06 05:01:32 +02:00
|
|
|
# Login
|
|
|
|
echo "${antithesis_repo_key}" > mongodb.key.json
|
|
|
|
cat mongodb.key.json | sudo docker login -u _json_key https://us-central1-docker.pkg.dev --password-stdin
|
|
|
|
rm mongodb.key.json
|
|
|
|
|
2023-07-28 15:45:04 +02:00
|
|
|
# Build Image
|
|
|
|
cd src
|
|
|
|
activate_venv
|
2023-09-11 14:57:47 +02:00
|
|
|
setup_db_contrib_tool
|
2023-09-09 01:38:12 +02:00
|
|
|
$python buildscripts/resmoke.py run --suite ${suite} ${resmoke_args} --dockerComposeTag $tag --dockerComposeBuildImages workload,config,mongo-binaries --dockerComposeBuildEnv evergreen
|
2023-07-28 15:45:04 +02:00
|
|
|
|
2023-08-15 16:58:20 +02:00
|
|
|
# Test Image
|
2023-09-06 05:01:32 +02:00
|
|
|
docker-compose -f docker_compose/${suite}/docker-compose.yml up -d
|
|
|
|
echo "ALL RUNNING CONTAINERS: "
|
|
|
|
docker ps
|
2024-04-24 20:37:13 +02:00
|
|
|
set +o errexit
|
2023-09-09 01:38:12 +02:00
|
|
|
docker exec workload buildscripts/resmoke.py run --suite ${suite} ${resmoke_args} --sanityCheck --externalSUT
|
2024-04-24 20:37:13 +02:00
|
|
|
RET=$?
|
|
|
|
set -o errexit
|
|
|
|
|
|
|
|
docker-compose -f docker_compose/${suite}/docker-compose.yml logs > docker_logs.txt
|
|
|
|
docker-compose -f docker_compose/${suite}/docker-compose.yml down
|
|
|
|
|
|
|
|
# Change the permissions of all of the files in the docker compose directory to the current user.
|
|
|
|
# Some of the data files cannot be archived otherwise.
|
|
|
|
sudo chown -R $USER docker_compose/${suite}/
|
|
|
|
if [ $RET -ne 0 ]; then
|
|
|
|
echo "Resmoke sanity check has failed"
|
|
|
|
exit $RET
|
|
|
|
fi
|
2023-07-28 15:45:04 +02:00
|
|
|
|
|
|
|
# Push Image
|
2023-09-09 01:38:12 +02:00
|
|
|
sudo docker tag "${suite}:$tag" "$antithesis_repo/${task_name}:$tag"
|
|
|
|
sudo docker push "$antithesis_repo/${task_name}:$tag"
|
2023-08-15 16:58:20 +02:00
|
|
|
|
|
|
|
sudo docker tag "mongo-binaries:$tag" "$antithesis_repo/mongo-binaries:$tag"
|
|
|
|
sudo docker push "$antithesis_repo/mongo-binaries:$tag"
|
|
|
|
|
|
|
|
sudo docker tag "workload:$tag" "$antithesis_repo/workload:$tag"
|
|
|
|
sudo docker push "$antithesis_repo/workload:$tag"
|
|
|
|
|
2023-09-06 05:01:32 +02:00
|
|
|
# Logout
|
2023-08-15 16:58:20 +02:00
|
|
|
sudo docker logout https://us-central1-docker.pkg.dev
|