diff options
author | Richard Samuels <richard.l.samuels@gmail.com> | 2021-11-03 12:09:10 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-11-03 12:33:49 +0000 |
commit | 14cd3f8d8d89a2bdc33374f80ed04d1e326f8fc6 (patch) | |
tree | c83ea4305d97d665b9f427b2575559be38ffed6e | |
parent | 837239bbd18c9d84ea5b57af80ffaabe7e5f9a73 (diff) | |
download | mongo-14cd3f8d8d89a2bdc33374f80ed04d1e326f8fc6.tar.gz |
SERVER-61161 Prevent antithesis images from being overwritten when older tasks are rerun
-rw-r--r-- | etc/evergreen.yml | 29 | ||||
-rw-r--r-- | evergreen/antithesis_image_build.sh | 39 |
2 files changed, 57 insertions, 11 deletions
diff --git a/etc/evergreen.yml b/etc/evergreen.yml index b0dbe37e4eb..68c1ab64099 100644 --- a/etc/evergreen.yml +++ b/etc/evergreen.yml @@ -88,6 +88,9 @@ parameters: - key: last_continuous_evg_version_id description: "The Evergreen Version ID of the last-continuous MongoDB binaries. Only binaries from release variants are used" + - key: antithesis_image_tag + description: "The docker tag to use when pushing images to Antithesis" + ## Some variables for convenience: variables: @@ -7111,10 +7114,11 @@ tasks: # this is not patchable to avoid hitting the docker registry excessively. # When iterating on this task, feel free to make this patchable for # testing purposes. Your image changes will be pushed with the - # evergreen-patch tag, so as to not clobber the waterfall + # evergreen-patch tag, so as to not clobber the waterfall. Use the + # antithesis_image_tag build parameter to override this if required. patchable: false depends_on: - - name: archive_dist_test_debug + - name: archive_dist_test commands: - *f_expansions_write - func: "git get project no modules" @@ -7122,6 +7126,13 @@ tasks: - func: "kill processes" - func: "cleanup environment" - func: "set up venv" + - command: s3.get + params: + aws_key: ${aws_key} + aws_secret: ${aws_secret} + remote_file: ${project}/${build_variant}/antithesis_last_push.txt + local_file: antithesis_last_push.txt + bucket: mciuploads - func: "do setup" # TODO SERVER-60619 download debug symbols and put them where needed. - command: subprocess.exec @@ -7129,6 +7140,17 @@ tasks: binary: bash args: - "./src/evergreen/antithesis_image_build.sh" + - command: s3.put + params: + optional: true + aws_key: ${aws_key} + aws_secret: ${aws_secret} + local_file: antithesis_next_push.txt + remote_file: ${project}/${build_variant}/antithesis_last_push.txt + bucket: mciuploads + permissions: private + content_type: text/plain + display_name: Last Push Date (seconds since epoch) ####################################### # Task Groups # @@ -7634,9 +7656,6 @@ buildvariants: - name: compile_ninja_TG distros: - ubuntu1804-build - - name: .antithesis - distros: - - ubuntu1804-large - name: build_variant_gen - name: .aggfuzzer .common - name: audit diff --git a/evergreen/antithesis_image_build.sh b/evergreen/antithesis_image_build.sh index eecd77a8ea0..de0d79c99fd 100644 --- a/evergreen/antithesis_image_build.sh +++ b/evergreen/antithesis_image_build.sh @@ -3,6 +3,20 @@ DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" set -euo pipefail +cd src +commit_date=$(date -d "$(git log -1 -s --format=%ci)" "+%s") +last_run_date=$(cat ../antithesis_last_push.txt || echo 0) +if [ "${is_patch}" != "true" && $last_run_date -gt $commit_date ]; then + echo -e "Refusing to push new antithesis images because this commit is older\nthan the last pushed commit" + exit 0 +fi +cd .. + +# check that the binaries in dist-test are linked to libvoidstar +ldd src/dist-test/bin/mongod | grep libvoidstar +ldd src/dist-test/bin/mongos | grep libvoidstar +ldd src/dist-test/bin/mongo | grep libvoidstar + # prepare the image building environment cp -rf src/buildscripts/antithesis/ antithesis # due to gitignore, we can't commit a folder called logs, so make it here @@ -27,10 +41,19 @@ tag="evergreen-latest-${branch_name}" if [ "${is_patch}" = "true" ]; then tag="evergreen-patch" fi + +if [ -n "${antithesis_image_tag}" ]; then + echo "Using provided tag: '$antithesis_image_tag' for docker pushes" + tag=$antithesis_image_tag +fi + docker build . -t workload:$tag cd ../database docker build . -t database:$tag cd .. +# ensure that the embedded image references actually point to the images we're +# pushing here +sed -i s/evergreen-latest-master/$tag/ docker-compose.yml docker build . -t config:$tag # login, push, and logout @@ -39,13 +62,17 @@ cat mongodb.key.json | docker login -u _json_key https://us-central1-docker.pkg. rm mongodb.key.json # tag and push to the registry -docker tag workload:$tag us-central1-docker.pkg.dev/molten-verve-216720/mongodb-repository/workload:$tag -docker push us-central1-docker.pkg.dev/molten-verve-216720/mongodb-repository/workload:$tag +docker tag "workload:$tag" "us-central1-docker.pkg.dev/molten-verve-216720/mongodb-repository/workload:$tag" +docker push "us-central1-docker.pkg.dev/molten-verve-216720/mongodb-repository/workload:$tag" -docker tag database:$tag us-central1-docker.pkg.dev/molten-verve-216720/mongodb-repository/database:$tag -docker push us-central1-docker.pkg.dev/molten-verve-216720/mongodb-repository/database:$tag +docker tag "database:$tag" "us-central1-docker.pkg.dev/molten-verve-216720/mongodb-repository/database:$tag" +docker push "us-central1-docker.pkg.dev/molten-verve-216720/mongodb-repository/database:$tag" -docker tag config:$tag us-central1-docker.pkg.dev/molten-verve-216720/mongodb-repository/config:$tag -docker push us-central1-docker.pkg.dev/molten-verve-216720/mongodb-repository/config:$tag +docker tag "config:$tag" "us-central1-docker.pkg.dev/molten-verve-216720/mongodb-repository/config:$tag" +docker push "us-central1-docker.pkg.dev/molten-verve-216720/mongodb-repository/config:$tag" docker logout https://us-central1-docker.pkg.dev + +if [ "${is_patch}" != "true" ]; then + echo "$commit_date" > antithesis_next_push.txt +fi |