# Support for mongodump+mongorestore passthrough tests.

include:
  - filename: "mongodump_passthrough/globals.yml"
  - filename: "mongodump_passthrough/parameters.yml"
  - filename: "mongodump_passthrough/modules.yml"
  - filename: "mongodump_passthrough/functions.yml"
  - filename: "mongodump_passthrough/tasks.yml"
  - filename: "mongodump_passthrough/variants.yml"

#######################################
#    Tools Driver Config for MCI      #
#######################################
# default command type
command_type: system

# 3 hour default timeout
exec_timeout_secs: 10800

# run the same task in the previous revision if the current task fails
stepback: true

variables:
  # Common mongodb arguments
  mongod_arguments:
    default: &mongod_default_startup_args
      mongod_args: ""
      mongod_port: 33333
    ssl: &mongod_ssl_startup_args
      mongod_args: "--sslMode requireSSL --sslCAFile common/db/testdata/ca-ia.pem --sslPEMKeyFile common/db/testdata/test-server.pem"
      replsettest_ssl_config: "sslMode: \\\"requireSSL\\\",sslPEMKeyFile: \\\"common/db/testdata/test-server.pem\\\", sslCAFile: \\\"common/db/testdata/ca-ia.pem\\\", sslAllowInvalidHostnames: \\\"\\\""
      mongod_port: 33333
    tls: &mongod_tls_startup_args
      mongod_args_tls: "--tlsMode requireTLS --tlsCAFile common/db/testdata/ca-ia.pem --tlsCertificateKeyFile common/db/testdata/test-server.pem"
      replsettest_tls_config: "tlsMode: \\\"requireTLS\\\",tlsCertificateKeyFile: \\\"common/db/testdata/test-server.pem\\\", tlsCAFile: \\\"common/db/testdata/ca-ia.pem\\\", tlsAllowInvalidHostnames: \\\"\\\""
      mongod_port: 33333

  mongo_arguments:
    default: &mongo_default_startup_args
      mongo_args: &mongo_default_startup_args_string "--port 33333"
      mongod_port: 33333
    ssl: &mongo_ssl_startup_args
      mongo_args: "--port 33333 --ssl --sslCAFile common/db/testdata/ca-ia.pem --sslPEMKeyFile common/db/testdata/test-server.pem --sslAllowInvalidCertificates"
      mongod_port: 33333
    tls: &mongo_tls_startup_args
      mongo_args_tls: "--port 33333 --tls --tlsCAFile common/db/testdata/ca-ia.pem --tlsCertificateKeyFile common/db/testdata/test-server.pem --tlsAllowInvalidCertificates"
      mongod_port: 33333

  # Used to determine load_libs_version for *-latest builds.
  # Same as maxServerVersion supported in download_server.go
  max_server_version: &max_server_version "8.3"

parameters:
  - key: fake_tag_for_release_testing
    description: |
      This can be set to test tasks that require a tag without actually
      triggering all of the release automation. Setting it will cause the
      `EVG_TRIGGERED_BY_TAG` environment variable to be populated with this
      parameter's value.

functions:
  "run legacy tests":
    command: shell.exec
    type: test
    params:
      shell: bash
      working_dir: src/github.com/mongodb/mongo-tools
      script: |
        set -o errexit
        set -o pipefail
        set -o verbose

        chmod +x bin/*
        mv bin/* ${test_path}/
        cd ${test_path}
        if [ -n "${load_libs_version}" ]; then
          IMPORT_LOAD_LIBS="await import(\"../shell_common/libs/load_libs-${load_libs_version}.js\");"
        fi
        ./mongo --nodb --eval "$IMPORT_LOAD_LIBS" lib/run_mongod.js jstests/tool/*.js

  "run qa-tests":
    command: subprocess.exec
    params:
      binary: bash
      working_dir: src/github.com/mongodb/mongo-tools
      args:
        - "./scripts/run_qa.sh"
      add_expansions_to_env: true

  "run native-cert-ssl":
    command: subprocess.exec
    params:
      binary: bash
      working_dir: src/github.com/mongodb/mongo-tools
      args:
        - "./scripts/run_native_cert_ssl.sh"
      add_expansions_to_env: true

  "run make target":
    command: shell.exec
    type: test
    params:
      shell: bash
      working_dir: src/github.com/mongodb/mongo-tools
      script: |
        set -o errexit
        set -o pipefail
        set -o verbose

        ${_set_shell_env}
        ${_maybe_enable_devtoolset_7}
        PATH=$PATH:$HOME
        go run build.go -v ${target}

  "download mongod and shell":
    - command: github.generate_token
      params:
        owner: 10gen
        repo: mongo-release
        expansion_name: generated_token_mongo_release
        permissions:
          contents: read
    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          ${_set_shell_env}
          ${_maybe_enable_devtoolset_7}
          PATH=$PATH:$HOME
          go run release/release.go download-mongod-and-shell --server-version ${mongo_version}
        add_expansions_to_env: true

  "get buildnumber":
    command: keyval.inc
    params:
      key: "${build_variant}_tools"
      destination: "builder_num"

  "setup integration test":
    command: shell.exec
    params:
      shell: bash
      working_dir: src/github.com/mongodb/mongo-tools
      # Set up Kerberos stuff: run kinit if necessary, and add KDC to registry
      # on Windows (see https://wiki.mongodb.com/display/DH/Testing+Kerberos)
      script: |
        set -o errexit
        set -o pipefail
        set -o verbose

        # export sensitive info before `set -x`
        if [ '${run_kinit}' = 'true' ]; then
            # BUILD-3830
            mkdir -p "$(pwd)/.evergreen"
            touch "$(pwd)/.evergreen/krb5.conf.empty"
            export KRB5_CONFIG="$(pwd)/.evergreen/krb5.conf.empty"

            echo "Writing keytab"
            echo ${kerberos_keytab} | base64 -d > "$(pwd)/.evergreen/drivers.keytab"
            echo "Running kinit"
            kinit -k -t "$(pwd)/.evergreen/drivers.keytab" -p drivers@LDAPTEST.10GEN.CC;
        fi;
        set -x
        set -v
        if [ "Windows_NT" = "$OS" ]; then
          cmd /c "REG ADD HKLM\SYSTEM\ControlSet001\Control\Lsa\Kerberos\Domains\LDAPTEST.10GEN.CC /v KdcNames /d ldaptest.10gen.cc /t REG_MULTI_SZ /f"
        fi;

  "setup credentials":
    command: shell.exec
    params:
      shell: bash
      working_dir: src/github.com/mongodb/mongo-tools
      silent: true
      script: |
        set -o errexit
        set -o pipefail
        set -o verbose

        cat > mci.buildlogger <<END_OF_CREDS
        slavename='${slave}'
        passwd='${passwd}'
        builder='MCI_${build_variant}'
        build_num=${builder_num}
        build_phase='${task_name}_${execution}'
        END_OF_CREDS
        # Resmoke hardcodes the location of this file so we need to copy it to the working directory
        # we run resmoke from.
        cp mci.buildlogger test/qa-tests

  "start mongod":
    command: shell.exec
    params:
      shell: bash
      working_dir: src/github.com/mongodb/mongo-tools
      background: true
      script: |
        set -o errexit
        set -o pipefail
        set -o verbose

        rm -rf mongodb/db_files mongodb/${logfile|run.log}
        mkdir -p mongodb/db_files
        MONGOD_ARGS="${mongod_args}"
        if [ "${USE_TLS}" = "true" ]; then
          MONGOD_ARGS="${mongod_args_tls}"
        elif [ "${AWS_AUTH}" = "true" ]; then
          MONGOD_ARGS="--auth --setParameter authenticationMechanisms=MONGODB-AWS,SCRAM-SHA-256"
        fi;
        echo "Starting mongod..."
        storage_args=''
        if [ "${STORAGE_ENGINE}" != '' ]; then
          storage_args='--storageEngine ${STORAGE_ENGINE}'
        fi
        PATH=$PWD/bin:$PATH ./bin/mongod${extension}  --port ${mongod_port} $MONGOD_ARGS ${additional_args} --dbpath mongodb/db_files --setParameter=enableTestCommands=1 $storage_args

  "wait for mongod to be ready":
    command: shell.exec
    params:
      shell: bash
      working_dir: src/github.com/mongodb/mongo-tools
      script: |
        set -o errexit
        set -o pipefail
        set -o verbose

        SECS=0
        MONGO_ARGS="${mongo_args}"
        if [ "${USE_TLS}" = "true" ]; then
          MONGO_ARGS="${mongo_args_tls}"
        elif [ "${AWS_AUTH}" = "true" ]; then
          MONGO_ARGS="--port 33333"
        fi;
        while true ; do
            set +o errexit
            ./bin/mongo${extension} $MONGO_ARGS --eval 'true;'
            status=$?
            # This overwrites "$?".
            set -o errexit

            if [ "$status" = "0" ]; then
                echo "mongod ready";
                exit 0
            else
                SECS=`expr $SECS + 1`
                if [ $SECS -gt 100 ]; then
                    echo "mongod not ready after 100 seconds"
                    exit 1
                fi
                echo "waiting for mongod $MONGO_ARGS to be ready..."  ;
                sleep 1 ;
            fi
        done

  "create mongod users":
    command: shell.exec
    params:
      shell: bash
      working_dir: src/github.com/mongodb/mongo-tools
      script: |
        set -o errexit
        set -o pipefail
        set -o verbose

        ${_set_shell_env}
        MONGO_ARGS="${mongo_args}"
        if [ "${USE_TLS}" = "true" ]; then
          MONGO_ARGS="${mongo_args_tls}"
        fi
        echo "db.createUser({ user: '${auth_username}', pwd: '${auth_password}', roles: [{ role: '__system', db: 'admin' }] });" | ./bin/mongo${extension} $MONGO_ARGS admin

  "create release artifacts":
    # build release artifacts
    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          ${_set_shell_env}
          ${_maybe_enable_devtoolset_7}
          PATH=$PATH:$HOME
          go run release/release.go build-archive
          go run release/release.go build-packages

    # temporary workaround for TOOLS-2606
    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          rm -rf ./mongorestore/testdata/longcollectionname/

    # upload individual release artifacts to task page
    - command: s3.put
      params:
        aws_key: ${aws_key}
        aws_secret: ${aws_secret}
        local_files_include_filter:
          - src/github.com/mongodb/mongo-tools/mongodb-database-tools*.deb
          - src/github.com/mongodb/mongo-tools/mongodb-database-tools*.msi
          - src/github.com/mongodb/mongo-tools/mongodb-database-tools*.rpm
          - src/github.com/mongodb/mongo-tools/mongodb-database-tools*.tgz
          - src/github.com/mongodb/mongo-tools/mongodb-database-tools*.zip
        remote_file: mongo-tools/pkgs/${build_id}/
        content_type: application/octet-stream
        bucket: mciuploads
        permissions: public-read
        display_name: "Release Artifact - "

    # pack all release artifacts into a tarball and upload them to one
    # place so that they can be more easily downloaded by the sign task
    - command: archive.targz_pack
      params:
        target: src/github.com/mongodb/mongo-tools/upload.tgz
        source_dir: src/github.com/mongodb/mongo-tools
        include:
          - mongodb-database-tools*.deb
          - mongodb-database-tools*.msi
          - mongodb-database-tools*.rpm
          - mongodb-database-tools*.tgz
          - mongodb-database-tools*.zip
    - command: s3.put
      params:
        aws_key: ${aws_key}
        aws_secret: ${aws_secret}
        local_file: src/github.com/mongodb/mongo-tools/upload.tgz
        remote_file: mongo-tools/task/dist/${build_id}/all-release-artifacts.tgz
        content_type: application/x-gzip
        bucket: mciuploads
        permissions: public-read
        display_name: All Release Artifacts (.tgz)

  "fetch dist release artifacts":
    - command: s3.get
      params:
        aws_key: ${aws_key}
        aws_secret: ${aws_secret}
        remote_file: mongo-tools/task/dist/${build_id}/all-release-artifacts.tgz
        extract_to: src/github.com/mongodb/mongo-tools/
        bucket: mciuploads

  "sign artifacts":
    command: shell.exec
    params:
      shell: bash
      working_dir: src/github.com/mongodb/mongo-tools
      env:
        MONGO_OS: ${mongo_os}
        MACOS_NOTARY_KEY: ${MACOS_NOTARY_KEY}
        MACOS_NOTARY_SECRET: ${MACOS_NOTARY_SECRET}
        ARTIFACTORY_PASSWORD: ${artifactory_password}
        ARTIFACTORY_USERNAME: ${artifactory_username}
        GARASIGN_PASSWORD: ${garasign_password}
        GARASIGN_USERNAME: ${garasign_username}
        AUTHENTICODE_KEY_NAME: ${authenticode_key_name}
      script: |
        set -o errexit
        set -o pipefail
        set -o verbose

        ${_set_shell_env}
        ./scripts/sign_artifacts.sh

  "upload signed release artifacts":
    # temporary workaround for TOOLS-2606
    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          rm -rf ./mongorestore/testdata/longcollectionname/
    - command: s3.put
      params:
        aws_key: ${aws_key}
        aws_secret: ${aws_secret}
        local_files_include_filter:
          - src/github.com/mongodb/mongo-tools/mongodb-database-tools*.sig
          - src/github.com/mongodb/mongo-tools/mongodb-database-tools*.deb
          - src/github.com/mongodb/mongo-tools/mongodb-database-tools*.msi
          - src/github.com/mongodb/mongo-tools/mongodb-database-tools*.rpm
          - src/github.com/mongodb/mongo-tools/mongodb-database-tools*.tgz
          - src/github.com/mongodb/mongo-tools/mongodb-database-tools*.zip
        remote_file: mongo-tools/task/sign/${build_id}/
        bucket: mciuploads
        permissions: public-read
        content_type: application/octet-stream

  "upload release packages to s3":
    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          ${_set_shell_env}
          go run release/release.go upload-release

  "upload release json feed to s3":
    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          ${_set_shell_env}
          go run release/release.go upload-json
    - command: s3.put
      params:
        aws_key: ${aws_key}
        aws_secret: ${aws_secret}
        local_file: src/github.com/mongodb/mongo-tools/release.json
        remote_file: mongo-tools/release/${build_id}/
        optional: true
        content_type: application/json
        bucket: mciuploads
        permissions: public-read

  "generate full JSON feed":
    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          ${_set_shell_env}
          go run release/release.go generate-full-json

  "upload release packages to linux repos":
    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          curl -L -O http://boxes.10gen.com/build/curator/curator-dist-rhel70-latest.tar.gz
          tar -zxvf curator-dist-rhel70-latest.tar.gz
    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          ${_set_shell_env}
          go run release/release.go linux-release

  "fetch source":
    - command: shell.exec
      params:
        shell: bash
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          mkdir -p src/github.com/mongodb
    - command: git.get_project
      params:
        directory: src/github.com/mongodb/mongo-tools
    - command: git.apply_patch
      params:
        directory: src/github.com/mongodb/mongo-tools
    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          mkdir -p bin

  "create repl_set":
    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        background: true
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          echo "starting repl set"
          MONGO_ARGS="${mongo_args}"
          NODE_OPTIONS=""
          mkdir -p /data/db/
          if [ "${USE_TLS}" = "true" ]; then
            NODE_OPTIONS="${replsettest_tls_config}"
            MONGO_ARGS="${mongo_args_tls}"
          elif [ "${USE_SSL}" = "true" ]; then
            NODE_OPTIONS="${replsettest_ssl_config}"
          fi
          # use jsconfig.json to set baseUrl to find libs
          mv test/shell_common/jsconfig.json ./
          if [ -n "${load_libs_version}" ]; then
            IMPORT_LOAD_LIBS="await import(\"../shell_common/libs/load_libs-${load_libs_version}.js\");"
          fi
          PATH=./bin:$PATH ./bin/mongo $MONGO_ARGS --nodb --eval "$IMPORT_LOAD_LIBS; TestData = new Object(); TestData.minPort=\"${mongod_port}\"; var repl = new ReplSetTest({nodes:1, name:'repltester', nodeOptions: {$NODE_OPTIONS}});repl.startSet();repl.initiate();repl.awaitSecondaryNodes();while(true){sleep(1000);}"

    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          MONGO_ARGS="${mongo_args}"
          if [ "${USE_TLS}" = "true" ]; then
            MONGO_ARGS="${mongo_args_tls}"
          fi;
          ./bin/mongo $MONGO_ARGS --nodb --eval 'assert.soon(function(x){try{var d = new Mongo("localhost:${mongod_port}"); return true} catch(e){return false}}, "timed out connection")'

  "create sharded cluster":
    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        background: true
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          echo "starting sharded cluster"
          mkdir -p /data/db/
          # use jsconfig.json to set baseUrl to find libs
          mv test/shell_common/jsconfig.json ./
          if [ -n "${load_libs_version}" ]; then
            IMPORT_LOAD_LIBS="await import(\"../shell_common/libs/load_libs-${load_libs_version}.js\");"
          fi
          PATH=./bin:$PATH ./bin/mongo --port ${mongod_port} --nodb --eval "$IMPORT_LOAD_LIBS; var st = new ShardingTest({name: \"tools_sharded_cluster\", shards: 1, mongos: [{port: ${mongod_port}}], other: {rsOptions: {}, configOptions: {}}}); while(true){sleep(1000);}"

    - command: shell.exec
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          ./bin/mongo --port ${mongod_port} --nodb --eval 'assert.soon(function(x){try{var d = new Mongo("localhost:${mongod_port}"); return true} catch(e){return false}}, "timed out connection")'

  "add-aws-auth-variables-to-file":
    - command: shell.exec
      type: test
      params:
        shell: bash
        silent: true
        working_dir: src/github.com/mongodb/mongo-tools/common/testdata/lib
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          cat <<EOF > $(pwd)/aws_e2e_setup.json
          {
            "iam_auth_assume_aws_account": "${iam_auth_assume_aws_account}",
            "iam_auth_assume_aws_secret_access_key": "${iam_auth_assume_aws_secret_access_key}",
            "iam_auth_assume_role_name": "${iam_auth_assume_role_name}"
          }
          EOF

  "setup-aws-auth-test-with-assume-role-credentials":
    - command: shell.exec
      type: test
      params:
        shell: bash
        # silent: true
        working_dir: src/github.com/mongodb/mongo-tools/common/testdata/lib
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          PATH=/opt/mongodbtoolchain/v3/bin/:$PATH
          python="python3"
          if [ "Windows_NT" = "$OS" ]; then
            python="/cygdrive/c/python/Python311/python"
          fi

          # The aws_e2e_assume_role script requires python3 with boto3.
          # Set up or use an existing python virtualenv for boto3.
          venv='venv'
          venvNonWindows () { . "$venv"/bin/activate; python -m pip install boto3; }
          venvWindows () { . "$venv"/Scripts/activate; pip install boto3; }

          if [ -f "$venv"/bin/activate ]; then
            echo 'activating existing virtualenv'
            venvNonWindows
          elif [ -f "$venv"/Scripts/activate ]; then
            echo 'activating existing virtualenv'
            dos2unix "$venv"/Scripts/activate
            venvWindows
          elif $python -m venv "$venv"; then
            echo 'creating new virtualenv'
            if [ -f "$venv"/bin/activate ]; then
              echo 'activating new virtualenv'
              venvNonWindows
            elif [ -f "$venv"/Scripts/activate ]; then
              echo 'activating new virtualenv'
              dos2unix "$venv"/Scripts/activate
              venvWindows
            fi
          fi

          $python -m pip list

          ../../../bin/mongo --nodb aws_e2e_assume_role.js

    - command: shell.exec
      type: test
      params:
        shell: bash
        silent: true
        working_dir: src/github.com/mongodb/mongo-tools/common/testdata/lib
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          PATH=/opt/mongodbtoolchain/v3/bin/:$PATH
          python="python3"
          if [ "Windows_NT" = "$OS" ]; then
            python="/cygdrive/c/python/Python311/python"
          fi

          jsonkey () { $python -c "import sys, json; sys.stdout.write(json.load(sys.stdin)['$1'])" < creds.json; }
          urlencode () { $python -c "import sys, urllib.parse as ul; sys.stdout.write(ul.quote_plus('$1'))"; }

          USER=$(jsonkey AccessKeyId)
          USER=$(urlencode $USER)

          PASS=$(jsonkey SecretAccessKey)
          PASS=$(urlencode $PASS)

          MONGOD_URI="mongodb://$USER:$PASS@localhost:33333/?authMechanism=MONGODB-AWS"

          SESSION_TOKEN=$(jsonkey SessionToken)
          SESSION_TOKEN=$(urlencode $SESSION_TOKEN)
          if [ -n $SESSION_TOKEN ]; then
              MONGOD_URI="$MONGOD_URI&authMechanismProperties=AWS_SESSION_TOKEN:$SESSION_TOKEN"
          fi

          echo -n "$MONGOD_URI" > MONGOD_URI

  "check sbom lite":
    command: shell.exec
    type: test
    params:
      shell: bash
      working_dir: src/github.com/mongodb/mongo-tools
      script: |
        set -o errexit
        set -o pipefail
        set -o verbose

        ${_set_shell_env}
        ./scripts/regenerate-and-diff-sbom-lite.sh

  "check sarif report":
    command: shell.exec
    type: test
    params:
      shell: bash
      working_dir: src/github.com/mongodb/mongo-tools
      script: |
        set -o errexit
        set -o pipefail
        set -o verbose

        ${_set_shell_env}
        ./scripts/regenerate-and-diff-sarif-report.sh

  "create evergreen config file":
    - command: shell.exec
      type: test
      params:
        shell: bash
        working_dir: src/github.com/mongodb/mongo-tools
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          ${_set_shell_env}
          ./scripts/write-evergreen-config-file.sh

  "set silkbomb credentials":
    - command: ec2.assume_role
      display_name: Assume IAM role with permissions to pull Kondukto API token
      params:
        role_arn: ${kondukto_role_arn}
    - command: shell.exec
      display_name: Pull Kondukto API token from AWS Secrets Manager and write it to file
      params:
        shell: bash
        silent: true
        include_expansions_in_env:
          [AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN]
        script: |
          set -o errexit
          set -o pipefail
          set -o verbose

          # use AWS CLI to get the Kondukto API token from AWS Secrets Manager
          kondukto_token=$(aws secretsmanager get-secret-value --secret-id "kondukto-token" --region "us-east-1" --query 'SecretString' --output text)
          # set the KONDUKTO_TOKEN environment variable
          echo "KONDUKTO_TOKEN: $kondukto_token" > kondukto_token.yml
    - command: expansions.update
      params:
        file: kondukto_token.yml
        redact_file_expansions: true

pre:
  - command: shell.exec
    params:
      silent: true
      shell: bash
      script: |
        # This script intentionally doesn't set errexit or pipefail, since these commands can fail and that's ok.
        set -o verbose

        ${killall_mci|pkill -9 mongo; pkill -9 mongodump; pkill -9 mongoexport; pkill -9 mongoimport; pkill -9 mongofiles; pkill -9 mongorestore; pkill -9 mongostat; pkill -9 mongotop; pkill -9 mongod; pkill -9 mongos; pkill -f buildlogger.py; pkill -f smoke.py} >/dev/null 2>&1
        rm -rf src /data/db/*
        exit 0
  - command: shell.exec
    params:
      shell: bash
      script: |
        cat <<EOT > expansions.yml
        _set_shell_env: |
          . ./set_goenv.sh
          GOROOT=""; set_goenv || exit
          export EVG_IS_PATCH='${is_patch}'
          export EVG_TRIGGERED_BY_TAG='${triggered_by_git_tag}'
          if [ -n "${fake_tag_for_release_testing}" ]; then
            export EVG_TRIGGERED_BY_TAG="${fake_tag_for_release_testing}"
            export IS_FAKE_TAG=1
          fi
          export EVG_BUILD_ID='${build_id}'
          export EVG_VERSION='${version_id}'
          export EVG_VARIANT='${build_variant}'
          if [ '${_platform}' != '' ]; then
            export EVG_VARIANT='${_platform}'
          fi
          export EVG_USER='${evg_user}'
          export EVG_KEY='${evg_key}'
          export EVG_TASK_ID='${task_id}'
          export AWS_ACCESS_KEY_ID='${cdn_aws_access_key_id}'
          export AWS_SECRET_ACCESS_KEY='${cdn_aws_secret}'
          export BARQUE_USERNAME='${barque_username}'
          export BARQUE_API_KEY='${barque_api_key}'
          export TOOLS_TESTING_AUTH_USERNAME='${auth_username}'
          export TOOLS_TESTING_AUTH_PASSWORD='${auth_password}'
          export MONGODB_KERBEROS_PASSWORD='${kerberos_password}'
          export TOOLS_TESTING_PKCS8_PASSWORD='${pkcs8_password}'
          set -o xtrace
          set -o verbose
          set -o errexit
        _maybe_enable_devtoolset_7: |
          if [ -f /opt/rh/devtoolset-7/enable ]; then
            source /opt/rh/devtoolset-7/enable
          fi
        EOT
  - command: expansions.update
    params:
      file: expansions.yml
  # Extra pre steps needed for mongodump passthrough.
  - command: expansions.update
    params:
      updates:
        - key: python
          value: "/opt/mongodbtoolchain/v4/bin/python3"
        - key: resmoke_dir
          value: "src/resmoke"
        - key: resmoke_venv_dir
          value: "resmoke-venv"
        - key: mongosync_binary_folder
          value: "mongosync-coverage-binary"

post:
  # attach.results works for jstests, gotest.parse_files for golang tests
  - command: attach.results
    params:
      file_location: src/github.com/mongodb/mongo-tools/report.json
  - command: gotest.parse_files
    params:
      files: ["src/github.com/mongodb/mongo-tools/testing_output/*.suite"]
  - command: shell.exec
    params:
      shell: bash
      silent: true
      script: |
        # This script intentionally doesn't set errexit or pipefail, since these commands can fail and that's ok.
        set -o verbose

        ${killall_mci|pkill -9 mongo; pkill -9 mongodump; pkill -9 mongoexport; pkill -9 mongoimport; pkill -9 mongofiles; pkill -9 mongorestore; pkill -9 mongostat; pkill -9 mongotop; pkill -9 mongod; pkill -9 mongos; pkill -f buildlogger.py; pkill -f smoke.py} >/dev/null 2>&1
        exit 0
  - command: shell.exec
    params:
      shell: bash
      script: |
        set -o errexit
        set -o pipefail
        set -o verbose

        rm -rf /data/db/*
        exit 0
  # Extra post steps needed for mongodump passthrough.
  - func: f_resmoke_report_attach
  - func: "attach artifacts"
  - func: f_mongo_coredumps_save

timeout:
  - command: shell.exec
    params:
      shell: bash
      silent: true
      script: |
        # This script intentionally doesn't set errexit or pipefail, since these commands can fail and that's ok.
        set -o verbose

        # don't attempt to abort on any distro which has a special way of
        # killing everything (i.e. using taskkill on Windows)
        if [ "${killall_mci}" = "" ]; then
          all_tools="bsondump mongodump mongoexport mongofiles mongoimport mongorestore mongostat mongotop"
          # send SIGABRT to print a stacktrace for any hung tool
          pkill -ABRT "^($(echo -n $all_tools | tr ' ' '|'))\$"
          # git the processes a second or two to dump their stacks
          sleep 10
        fi
  # Extra timeout steps needed for mongodump passthrough.
  - func: f_expansions_write
  - func: "wait for resmoke to shutdown"

tasks:
  - name: dist
    tags: ["git_tag"]
    commands:
      - func: "fetch source"
      - func: "run make target"
        vars:
          target: checkMinVersion
      - func: "run make target"
        vars:
          target: build
      - func: "create release artifacts"

  # Regardless of the buildvariant, the sign task must be run on a
  # distro that has the notary client available. We will use
  # amazon1-2018-test for this purpose. The notary client is not
  # available on all distros, which is why sign must be a separate task.
  - name: sign
    tags: ["git_tag"]
    depends_on:
      - name: dist
    commands:
      - func: "fetch source"
      - func: "fetch dist release artifacts"
      - func: "sign artifacts"
      - func: "upload signed release artifacts"

  - name: push
    tags: ["git_tag"]
    depends_on:
      - name: sign
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "upload release packages to s3"
      - func: "upload release packages to linux repos"
      - command: subprocess.exec
        params:
          binary: bash
          working_dir: src/github.com/mongodb/mongo-tools
          args:
            - "./scripts/set-expansions-for-papertrail.sh"
      - command: expansions.update
        params:
          file: src/github.com/mongodb/mongo-tools/expansions.yml
      - func: "fetch dist release artifacts"
      - command: papertrail.trace
        params:
          key_id: ${papertrail_key_id}
          secret_key: ${papertrail_secret_key}
          product: ${product_name}
          version: ${release_tag}
          filenames:
            - "./src/github.com/mongodb/mongo-tools/mongodb-database-tools*"

  - name: check-augmented-sbom
    tags: ["git_tag"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "set silkbomb credentials"
      - command: shell.exec
        params:
          shell: bash
          working_dir: src/github.com/mongodb/mongo-tools
          include_expansions_in_env: [KONDUKTO_TOKEN]
          script: |
            set -o errexit
            set -o pipefail
            set -o verbose

            ${_set_shell_env}
            ./scripts/regenerate-and-diff-augmented-sbom.sh

  - name: release-json
    tags: ["git_tag"]
    depends_on:
      - name: push
        variant: "*"
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "upload release json feed to s3"

  - name: generate-full-json
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "generate full JSON feed"

  - name: integration-4.2
    tags: ["4.2"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "4.2"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true ${testArgs}

  - name: integration-4.2-auth
    tags: ["4.2", "auth"]
    commands:
      - func: "fetch source"
      # Concat auth args
      - command: expansions.update
        params:
          updates:
            - key: "mongod_args"
              concat: " --auth"
      - func: "download mongod and shell"
        vars:
          mongo_version: "4.2"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "create mongod users"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -auth=true ${testArgs}

  - name: integration-4.4
    tags: ["4.4"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "4.4"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true ${testArgs}

  - name: integration-4.4-auth
    tags: ["4.4", "auth"]
    commands:
      - func: "fetch source"
      # Concat auth args
      - command: expansions.update
        params:
          updates:
            - key: "mongod_args_tls"
              concat: " --auth"
      - func: "download mongod and shell"
        vars:
          mongo_version: "4.4"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "create mongod users"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -auth=true ${testArgs}

  - name: integration-4.4-cluster
    tags: ["4.4", "cluster"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "4.4"
      - func: "create repl_set"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -topology=replSet ${testArgs}

  - name: integration-5.0
    tags: ["5.0"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "5.0"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true ${testArgs}

  - name: integration-5.0-auth
    tags: ["5.0", "auth"]
    commands:
      - func: "fetch source"
      # Concat auth args
      - command: expansions.update
        params:
          updates:
            - key: "mongod_args_tls"
              concat: " --auth"
      - func: "download mongod and shell"
        vars:
          mongo_version: "5.0"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "create mongod users"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -auth=true ${testArgs}

  - name: integration-5.0-cluster
    tags: ["5.0", "cluster"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "5.0"
      - func: "create repl_set"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -topology=replSet ${testArgs}

  - name: aws-auth-5.0
    tags: ["5.0", "aws-auth"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          edition: "enterprise"
          mongo_version: "5.0"
      - func: "start mongod"
        vars:
          AWS_AUTH: "true"
      - func: "wait for mongod to be ready"
        vars:
          AWS_AUTH: "true"
      - func: "add-aws-auth-variables-to-file"
      - func: "setup-aws-auth-test-with-assume-role-credentials"
      - func: "run make target"
        vars:
          target: test:awsauth ${testArgs}

  - name: integration-6.0
    tags: ["6.0"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "6.0"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true ${testArgs}

  - name: integration-6.0-auth
    tags: ["6.0", "auth"]
    commands:
      - func: "fetch source"
      # Concat auth args
      - command: expansions.update
        params:
          updates:
            - key: "mongod_args_tls"
              concat: " --auth"
      - func: "download mongod and shell"
        vars:
          mongo_version: "6.0"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "create mongod users"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -auth=true ${testArgs}

  - name: integration-6.0-cluster
    tags: ["6.0", "cluster"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "6.0"
      - func: "create repl_set"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -topology=replSet ${testArgs}

  - name: aws-auth-6.0
    tags: ["6.0", "aws-auth"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          edition: "enterprise"
          mongo_version: "6.0"
      - func: "start mongod"
        vars:
          AWS_AUTH: "true"
      - func: "wait for mongod to be ready"
        vars:
          AWS_AUTH: "true"
      - func: "add-aws-auth-variables-to-file"
      - func: "setup-aws-auth-test-with-assume-role-credentials"
      - func: "run make target"
        vars:
          target: test:awsauth ${testArgs}

  - name: integration-7.0
    tags: ["7.0"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "7.0"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true ${testArgs}

  - name: integration-7.0-auth
    tags: ["7.0", "auth"]
    commands:
      - func: "fetch source"
      # Concat auth args
      - command: expansions.update
        params:
          updates:
            - key: "mongod_args_tls"
              concat: " --auth"
      - func: "download mongod and shell"
        vars:
          mongo_version: "7.0"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "create mongod users"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -auth=true ${testArgs}

  - name: integration-7.0-cluster
    tags: ["7.0", "cluster"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "7.0"
      - func: "create repl_set"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -topology=replSet ${testArgs}

  - name: aws-auth-7.0
    tags: ["7.0", "aws-auth"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          edition: "enterprise"
          mongo_version: "7.0"
      - func: "start mongod"
        vars:
          AWS_AUTH: "true"
      - func: "wait for mongod to be ready"
        vars:
          AWS_AUTH: "true"
      - func: "add-aws-auth-variables-to-file"
      - func: "setup-aws-auth-test-with-assume-role-credentials"
      - func: "run make target"
        vars:
          target: test:awsauth ${testArgs}

  - name: integration-8.0
    tags: ["8.0"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.0"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true ${testArgs}

  - name: integration-8.0-auth
    tags: ["8.0", "auth"]
    commands:
      - func: "fetch source"
      # Concat auth args
      - command: expansions.update
        params:
          updates:
            - key: "mongod_args_tls"
              concat: " --auth"
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.0"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "create mongod users"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -auth=true ${testArgs}

  - name: integration-8.0-cluster
    tags: ["8.0", "cluster"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.0"
      - func: "create repl_set"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -topology=replSet ${testArgs}

  - name: aws-auth-8.0
    tags: ["8.0", "aws-auth"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          edition: "enterprise"
          mongo_version: "8.0"
      - func: "start mongod"
        vars:
          AWS_AUTH: "true"
      - func: "wait for mongod to be ready"
        vars:
          AWS_AUTH: "true"
      - func: "add-aws-auth-variables-to-file"
      - func: "setup-aws-auth-test-with-assume-role-credentials"
      - func: "run make target"
        vars:
          target: test:awsauth ${testArgs}

  - name: integration-8.1
    tags: ["8.1"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.1.0"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true ${testArgs}

  - name: integration-8.1-auth
    tags: ["8.1", "auth"]
    commands:
      - func: "fetch source"
      # Concat auth args
      - command: expansions.update
        params:
          updates:
            - key: "mongod_args_tls"
              concat: " --auth"
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.1.0"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "create mongod users"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -auth=true ${testArgs}

  - name: integration-8.1-cluster
    tags: ["8.1", "cluster"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.1.0"
      - func: "create repl_set"
        vars:
          USE_TLS: "true"
          load_libs_version: "8.1"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -topology=replSet ${testArgs}

  - name: aws-auth-8.1
    tags: ["8.1", "aws-auth"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          edition: "enterprise"
          mongo_version: "8.1.0"
      - func: "start mongod"
        vars:
          AWS_AUTH: "true"
      - func: "wait for mongod to be ready"
        vars:
          AWS_AUTH: "true"
      - func: "add-aws-auth-variables-to-file"
      - func: "setup-aws-auth-test-with-assume-role-credentials"
      - func: "run make target"
        vars:
          target: test:awsauth ${testArgs}

  - name: integration-8.2
    tags: ["8.2"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.2.0"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true ${testArgs}

  - name: integration-8.2-auth
    tags: ["8.2", "auth"]
    commands:
      - func: "fetch source"
      # Concat auth args
      - command: expansions.update
        params:
          updates:
            - key: "mongod_args_tls"
              concat: " --auth"
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.2.0"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "create mongod users"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -auth=true ${testArgs}

  - name: integration-8.2-cluster
    tags: ["8.2", "cluster"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.2.0"
      - func: "create repl_set"
        vars:
          USE_TLS: "true"
          load_libs_version: "8.2"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -topology=replSet ${testArgs}

  - name: aws-auth-8.2
    tags: ["8.2", "aws-auth"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          edition: "enterprise"
          mongo_version: "8.2.0"
      - func: "start mongod"
        vars:
          AWS_AUTH: "true"
      - func: "wait for mongod to be ready"
        vars:
          AWS_AUTH: "true"
      - func: "add-aws-auth-variables-to-file"
      - func: "setup-aws-auth-test-with-assume-role-credentials"
      - func: "run make target"
        vars:
          target: test:awsauth ${testArgs}

  - name: integration-8.3
    tags: ["8.3"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.3.0-rc4"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true ${testArgs}

  - name: integration-8.3-auth
    tags: ["8.3", "auth"]
    commands:
      - func: "fetch source"
      # Concat auth args
      - command: expansions.update
        params:
          updates:
            - key: "mongod_args_tls"
              concat: " --auth"
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.3.0-rc4"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "create mongod users"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -auth=true ${testArgs}

  - name: integration-8.3-cluster
    tags: ["8.3", "cluster"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.3.0-rc4"
      - func: "create repl_set"
        vars:
          USE_TLS: "true"
          load_libs_version: "8.3"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -topology=replSet ${testArgs}

  - name: aws-auth-8.3
    tags: ["8.3", "aws-auth"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          edition: "enterprise"
          mongo_version: "8.3.0-rc4"
      - func: "start mongod"
        vars:
          AWS_AUTH: "true"
      - func: "wait for mongod to be ready"
        vars:
          AWS_AUTH: "true"
      - func: "add-aws-auth-variables-to-file"
      - func: "setup-aws-auth-test-with-assume-role-credentials"
      - func: "run make target"
        vars:
          target: test:awsauth ${testArgs}

  - name: integration-latest
    tags: ["latest"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "latest"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true ${testArgs}

  - name: integration-latest-auth
    tags: ["latest", "auth"]
    commands:
      - func: "fetch source"
      # Concat auth args
      - command: expansions.update
        params:
          updates:
            - key: "mongod_args_tls"
              concat: " --auth"
      - func: "download mongod and shell"
        vars:
          mongo_version: "latest"
      - func: "start mongod"
        vars:
          USE_TLS: "true"
      - func: "wait for mongod to be ready"
        vars:
          USE_TLS: "true"
      - func: "create mongod users"
        vars:
          USE_TLS: "true"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -auth=true ${testArgs}

  - name: integration-latest-cluster
    tags: ["latest", "cluster"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "latest"
      - func: "create repl_set"
        vars:
          USE_TLS: "true"
          load_libs_version: *max_server_version
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:integration -ssl=true -topology=replSet ${testArgs}

  - name: integration-4.4-sharded
    tags: ["4.4", "sharded"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "4.4"
      - func: "create sharded cluster"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:sharded-integration ${testArgs}

  - name: integration-5.0-sharded
    tags: ["5.0", "sharded"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "5.0"
      - func: "create sharded cluster"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:sharded-integration ${testArgs}

  - name: integration-6.0-sharded
    tags: ["6.0", "sharded"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "6.0"
      - func: "create sharded cluster"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:sharded-integration ${testArgs}

  - name: integration-7.0-sharded
    tags: ["7.0", "sharded"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "7.0"
      - func: "create sharded cluster"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:sharded-integration ${testArgs}

  - name: integration-8.0-sharded
    tags: ["8.0", "sharded"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.0"
      - func: "create sharded cluster"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:sharded-integration ${testArgs}

  - name: integration-8.1-sharded
    tags: ["8.1", "sharded"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.1.0"
      - func: "create sharded cluster"
        vars:
          load_libs_version: "8.1"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:sharded-integration ${testArgs}

  - name: integration-8.2-sharded
    tags: ["8.2", "sharded"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.2.0"
      - func: "create sharded cluster"
        vars:
          load_libs_version: "8.2"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:sharded-integration ${testArgs}

  - name: integration-latest-sharded
    tags: ["latest", "sharded"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          mongo_version: "latest"
      - func: "create sharded cluster"
        vars:
          load_libs_version: *max_server_version
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:sharded-integration ${testArgs}

  - name: aws-auth-latest
    tags: ["latest", "aws-auth"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          edition: "enterprise"
          mongo_version: "latest"
      - func: "start mongod"
        vars:
          AWS_AUTH: "true"
      - func: "wait for mongod to be ready"
        vars:
          AWS_AUTH: "true"
      - func: "add-aws-auth-variables-to-file"
      - func: "setup-aws-auth-test-with-assume-role-credentials"
      - func: "run make target"
        vars:
          target: test:awsauth ${testArgs}

  - name: aws-auth-4.4
    tags: ["4.4", "aws-auth"]
    commands:
      - func: "fetch source"
      - command: expansions.update
      - func: "download mongod and shell"
        vars:
          edition: "enterprise"
          mongo_version: "4.4"
      - func: "start mongod"
        vars:
          AWS_AUTH: "true"
      - func: "wait for mongod to be ready"
        vars:
          AWS_AUTH: "true"
      - func: "add-aws-auth-variables-to-file"
      - func: "setup-aws-auth-test-with-assume-role-credentials"
      - func: "run make target"
        vars:
          target: test:awsauth ${testArgs}

  - name: kerberos
    tags: ["kerberos"]
    commands:
      - func: "fetch source"
      # Explicitly run ONLY Kerberos tests
      - command: expansions.update
        params:
          updates:
            - key: "args"
              value: "${args} -test.types=kerberos"
      - func: "setup integration test"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:kerberos ${testArgs}

  - name: legacy-jstests-4.2 # The server jstests from the tools removal from server in 4.2
    tags: ["4.2"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "4.2"
      - func: "run make target"
        vars:
          target: build
      - func: "run legacy tests"
        vars:
          test_path: "test/legacy42"

  - name: legacy-jstests-4.4 # The server jstests from the tools removal from server in 4.2
    tags: ["4.4"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "4.4"
      - func: "run make target"
        vars:
          target: build
      - func: "run legacy tests"
        vars:
          test_path: "test/legacy42"

  - name: legacy-jstests-5.0 # The server jstests from the tools removal from server in 4.2
    tags: ["5.0"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "5.0"
      - func: "run make target"
        vars:
          target: build
      - func: "run legacy tests"
        vars:
          test_path: "test/legacy42"

  - name: legacy-jstests-6.0 # The server jstests from the tools removal from server in 4.2
    tags: ["6.0"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "6.0"
      - func: "run make target"
        vars:
          target: build
      - func: "run legacy tests"
        vars:
          test_path: "test/legacy42"

  - name: legacy-jstests-7.0 # The server jstests from the tools removal from server in 4.2
    tags: ["7.0"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "7.0"
      - func: "run make target"
        vars:
          target: build
      - func: "run legacy tests"
        vars:
          test_path: "test/legacy42"

  - name: legacy-jstests-8.0 # The server jstests from the tools removal from server in 4.2
    tags: ["8.0"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.0"
      - func: "run make target"
        vars:
          target: build
      - func: "run legacy tests"
        vars:
          test_path: "test/legacy42"

  - name: legacy-jstests-8.1 # The server jstests from the tools removal from server in 4.2
    tags: ["8.1"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.1.0"
      - func: "run make target"
        vars:
          target: build
      - func: "run legacy tests"
        vars:
          test_path: "test/legacy42"
          load_libs_version: "8.1"

  - name: legacy-jstests-8.2 # The server jstests from the tools removal from server in 4.2
    tags: ["8.2"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.2.0"
      - func: "run make target"
        vars:
          target: build
      - func: "run legacy tests"
        vars:
          test_path: "test/legacy42"
          load_libs_version: "8.2"

  - name: legacy-jstests-8.3 # The server jstests from the tools removal from server in 4.2
    tags: ["8.3"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.3.0-rc4"
      - func: "run make target"
        vars:
          target: build
      - func: "run legacy tests"
        vars:
          test_path: "test/legacy42"
          load_libs_version: "8.3"

  - name: legacy-jstests-latest # The server jstests from the tools removal from server in 4.2
    tags: ["latest"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "latest"
      - func: "run make target"
        vars:
          target: build
      - func: "run legacy tests"
        vars:
          test_path: "test/legacy42"
          load_libs_version: *max_server_version

  - name: mod-tidy
    commands:
      - func: "fetch source"
      - func: "run make target"
        vars:
          target: sa:modtidy

  - name: evergreen-validate
    commands:
      - func: "fetch source"
      - func: "create evergreen config file"
      - func: "run make target"
        vars:
          target: sa:evgvalidate

  - name: lint
    commands:
      - func: "fetch source"
      - func: "run make target"
        vars:
          target: sa:installdevtools
      - command: shell.exec
        type: test
        params:
          shell: bash
          working_dir: src/github.com/mongodb/mongo-tools
          script: |
            set -o errexit
            set -o pipefail
            set -o verbose

            ${_set_shell_env}
            ./dev-bin/precious lint --all

  - name: qa-tests-5.0
    tags: ["5.0"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "5.0"
      - func: "run make target"
        vars:
          target: build
      - func: "run qa-tests"
        vars:
          resmoke_suite: "core${resmoke_use_tls}"
          excludes: "requires_unstable,${excludes}"

  - name: qa-tests-6.0
    tags: ["6.0"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "6.0"
      - func: "run make target"
        vars:
          target: build
      - func: "run qa-tests"
        vars:
          resmoke_suite: "core${resmoke_use_tls}"
          excludes: "requires_unstable,${excludes}"

  - name: qa-tests-7.0
    tags: ["7.0"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "7.0"
      - func: "run make target"
        vars:
          target: build
      - func: "run qa-tests"
        vars:
          resmoke_suite: "core${resmoke_use_tls}"
          excludes: "requires_unstable,${excludes}"

  - name: qa-tests-8.0
    tags: ["8.0"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.0"
      - func: "run make target"
        vars:
          target: build
      - func: "run qa-tests"
        vars:
          resmoke_suite: "core${resmoke_use_tls}"
          excludes: "requires_unstable,${excludes}"

  - name: qa-tests-8.1
    tags: ["8.1"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.1.0"
      - func: "run make target"
        vars:
          target: build
      - func: "run qa-tests"
        vars:
          resmoke_suite: "core${resmoke_use_tls}"
          excludes: "requires_unstable,${excludes}"

  - name: qa-tests-8.2
    tags: ["8.2"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.2.0"
      - func: "run make target"
        vars:
          target: build
      - func: "run qa-tests"
        vars:
          resmoke_suite: "core${resmoke_use_tls}"
          excludes: "requires_unstable,${excludes}"

  - name: qa-tests-8.3
    tags: ["8.3"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "8.3.0-rc4"
      - func: "run make target"
        vars:
          target: build
      - func: "run qa-tests"
        vars:
          resmoke_suite: "core${resmoke_use_tls}"
          excludes: "requires_unstable,${excludes}"

  - name: qa-tests-latest
    tags: ["latest"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "latest"
      - func: "run make target"
        vars:
          target: build
      - func: "run qa-tests"
        vars:
          resmoke_suite: "core${resmoke_use_tls}"
          excludes: "requires_unstable,${excludes}"

  - name: qa-tests-4.4
    tags: ["4.4"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "4.4"
      - func: "run make target"
        vars:
          target: build
      - func: "run qa-tests"
        vars:
          resmoke_suite: "core${resmoke_use_tls}"
          excludes: "requires_unstable,${excludes}"

  - name: qa-tests-4.2
    tags: ["4.2"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "4.2"
      - func: "run make target"
        vars:
          target: build
      - func: "run qa-tests"
        vars:
          resmoke_suite: "core${resmoke_use_tls}"
          excludes: "requires_unstable,${excludes}"

  - name: native-cert-ssl-4.4
    tags: ["4.4"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "4.4"
      - func: "run make target"
        vars:
          target: build
      - func: "run native-cert-ssl"

  - name: qa-dump-restore-with-archiving-4.4
    tags: ["4.4"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "4.4"
      - func: "run make target"
        vars:
          target: build -tools=mongodump,mongorestore
      - func: "run qa-tests"
        vars:
          resmoke_suite: "restore_archive"
          excludes: "requires_unstable,${excludes}"

  - name: qa-dump-restore-with-gzip-4.4
    tags: ["4.4"]
    commands:
      - func: "fetch source"
      - func: "get buildnumber"
      - func: "setup credentials"
      - func: "download mongod and shell"
        vars:
          mongo_version: "4.4"
      - func: "run make target"
        vars:
          target: build -tools=mongodump,mongorestore
      - func: "run qa-tests"
        vars:
          resmoke_suite: "restore_gzip"
          excludes: "requires_unstable,${excludes}"

  - name: unit
    commands:
      - command: expansions.update
      - func: "fetch source"
      - func: "run make target"
        vars:
          target: build
      - func: "run make target"
        vars:
          target: test:unit ${testArgs}

  - name: vet
    commands:
      - func: "fetch source"
      - command: shell.exec
        type: test
        params:
          shell: bash
          working_dir: src/github.com/mongodb/mongo-tools
          script: |
            set -o errexit
            set -o pipefail
            set -o verbose

            ${_set_shell_env}
            go vet -composites=false ./bsondump ./mongo*

  - name: check-third-party-notices
    commands:
      - func: "fetch source"
      - func: "run make target"
        vars:
          target: writeThirdPartyNotices
      - command: shell.exec
        type: test
        params:
          shell: bash
          working_dir: src/github.com/mongodb/mongo-tools
          script: |
            set -o errexit
            set -o pipefail
            set -o verbose

            git diff --exit-code

  - name: check-sbom-lite
    commands:
      - func: "fetch source"
      - func: "check sbom lite"

  - name: check-sarif-report
    commands:
      - func: "fetch source"
      - func: "run make target"
        vars:
          target: sa:installdevtools
      - func: "check sarif report"

buildvariants:
  #######################################
  #     Static Analysis Buildvariant    #
  #######################################

  - name: static
    display_name: "! Static Analysis"
    run_on:
      - rhel80-small
    expansions:
      _platform: rhel80
    tasks:
      - name: lint
      - name: mod-tidy
      - name: evergreen-validate
      - name: vet
      - name: check-third-party-notices
      - name: check-sbom-lite
      - name: check-sarif-report

  #######################################
  #     Release Manager Buildvariant    #
  #######################################

  - name: release
    display_name: "! Release Manager"
    tags: ["git_tag"]
    run_on:
      - amazon1-2018-test
    tasks:
      - name: check-augmented-sbom
        # podman is not available on the amazon distro.
        run_on: rhel87-small
      - name: release-json
      - name: generate-full-json

  #######################################
  #     Amazon x86_64 Buildvariants     #
  #######################################

  - name: amazon
    display_name: Amazon Linux 64
    run_on:
      - amazon1-2018-test
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: amazon2
    display_name: Amazon Linux 64 v2
    run_on:
      - amazon2-test
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  #######################################
  #     Debian x86_64 Buildvariants     #
  #######################################

  - name: debian92
    display_name: Debian 9.2
    run_on:
      - debian92-test
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: debian10
    display_name: Debian 10
    run_on:
      - debian10-test
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: debian11
    display_name: Debian 11
    run_on:
      - debian11
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: debian12
    display_name: Debian 12
    run_on:
      - debian12-small
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  #######################################
  #      macOS x86_64 Buildvariant      #
  #######################################

  - name: macos
    display_name: MacOS 14 x86_64
    expansions:
      mongo_os: "osx"
    run_on:
      - macos-14
    tasks:
      - name: "dist"
      - name: "sign"
      - name: "push"
        run_on: rhel80-small

  #######################################
  #       macOS ARM Buildvariant        #
  #######################################

  - name: macos-arm64
    display_name: MacOS 14 ARM
    expansions:
      mongo_os: "osx"
    run_on:
      - macos-14-arm64
    tasks:
      - name: "dist"
      - name: "sign"
      - name: "push"
        run_on: rhel80-small

  #######################################
  #     RHEL x86_64 Buildvariants       #
  #######################################

  - name: rhel70
    display_name: RHEL 7.0
    run_on:
      - rhel70-small
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: rhel88
    display_name: "# RHEL 8.8"
    cron: 0 3 * * *
    run_on:
      - rhel8.8-large
    expansions:
      <<:
        [
          *mongod_ssl_startup_args,
          *mongo_ssl_startup_args,
          *mongod_tls_startup_args,
          *mongo_tls_startup_args,
        ]
      mongo_os: "rhel80"
      mongo_edition: "enterprise"
      resmoke_use_tls: _tls
      edition: enterprise
      run_kinit: true
      resmoke_args: --jobs 4
    tasks:
      - name: "unit"
      - name: ".4.2"
      - name: ".4.4"
      - name: ".5.0"
      - name: ".6.0"
      - name: ".7.0"
      - name: ".8.0"
      - name: ".8.1"
      - name: ".8.2"
      - name: ".8.3"
      - name: ".latest"
      - name: ".kerberos"
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: rhel88-race
    display_name: RHEL 8.8 w/ Race Detector
    run_on:
      - rhel8.8-large
    expansions:
      <<:
        [
          *mongod_ssl_startup_args,
          *mongo_ssl_startup_args,
          *mongod_tls_startup_args,
          *mongo_tls_startup_args,
        ]
      mongo_os: "rhel80"
      mongo_edition: "enterprise"
      testArgs: "-race=true"
      resmoke_use_tls: _tls
      edition: enterprise
      run_kinit: true
      resmoke_args: --jobs 4
    tasks:
      - name: "unit"
      - name: ".4.2"
      - name: ".4.4"
      - name: ".5.0"
      - name: ".6.0"
      - name: ".7.0"
      - name: ".8.0"
      - name: ".8.1"
      - name: ".8.2"
      - name: ".8.3"
      - name: ".latest"
      - name: ".kerberos"

  - name: rhel93
    display_name: RHEL 9.3
    run_on:
      - rhel93-small
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: amazon2023
    display_name: Amazon Linux 2023
    run_on:
      - amazon2023-small
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  #######################################
  #     SUSE x86_64 Buildvariants       #
  #######################################

  # Skipping kerberos tests on SUSE, see TOOLS-3014

  - name: suse12
    display_name: SUSE 12
    run_on:
      - suse12-sp5-small
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: suse15
    display_name: SUSE 15
    run_on:
      - suse15sp4-small
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  #######################################
  #    Ubuntu x86_64 Buildvariants      #
  #######################################

  - name: ubuntu1604
    display_name: Ubuntu 16.04
    run_on:
      - ubuntu1604-test
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: ubuntu1804
    display_name: Ubuntu 18.04
    run_on:
      - ubuntu1804-test
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: ubuntu2004
    display_name: Ubuntu 20.04
    run_on:
      - ubuntu2004-small
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: ubuntu2204
    display_name: Ubuntu 22.04
    run_on:
      - ubuntu2204-small
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: ubuntu2404
    display_name: Ubuntu 24.04
    run_on:
      - ubuntu2404-small
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  #######################################
  #        Windows Buildvariants        #
  #######################################

  - name: windows
    display_name: "# Windows 64-bit"
    run_on:
      - windows-2022-latest-large
    expansions:
      <<:
        [
          *mongod_ssl_startup_args,
          *mongo_ssl_startup_args,
          *mongod_tls_startup_args,
          *mongo_tls_startup_args,
        ]
      mongo_os: "windows-64"
      mongo_edition: "enterprise"
      mongo_target: "windows"
      python_binary: "/cygdrive/c/python/Python311/python"
      resmoke_args: --jobs 4
      resmoke_use_tls: _tls
      excludes: requires_large_ram,requires_mongo_24
      edition: enterprise
      extension: .exe
      preproc_gpm: "perl -pi -e 's/\\r\\n/\\n/g' "
      USE_SSL: "true"
    tasks:
      - name: "unit"
      - name: ".4.2"
      - name: ".4.4"
      - name: ".5.0"
      - name: ".6.0"
      - name: ".7.0"
      - name: ".8.0"
      - name: ".8.1"
      - name: ".8.2"
      - name: ".8.3"
      - name: ".latest"
      - name: ".kerberos"
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  #######################################
  #        ARM Buildvariants            #
  #######################################

  - name: ubuntu1604-arm64
    display_name: ZAP ARM64 Ubuntu 16.04
    run_on:
      - ubuntu1604-arm64
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: ubuntu1804-arm64
    display_name: ZAP ARM64 Ubuntu 18.04
    run_on:
      - ubuntu1804-arm64
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: ubuntu2004-arm64
    display_name: ZAP ARM64 Ubuntu 20.04
    run_on:
      - ubuntu2004-arm64
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: ubuntu2204-arm64
    display_name: ZAP ARM64 Ubuntu 22.04
    run_on:
      - ubuntu2204-arm64-small
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: ubuntu2404-arm64
    display_name: ZAP ARM64 Ubuntu 24.04
    run_on:
      - ubuntu2404-arm64-small
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: amazon2-aarch64
    display_name: Amazon Linux ARM v2
    run_on:
      - amazon2-arm64-small
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: amazon2023-aarch64
    display_name: Amazon Linux 2023 ARM
    run_on:
      - amazon2023-arm64-small
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: rhel88-aarch64
    display_name: RHEL 8.8 ARM
    run_on:
      - rhel8.8-arm64-small
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: rhel93-aarch64
    display_name: RHEL 9.3 ARM
    run_on:
      - rhel93-arm64-small
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  #######################################
  #        Power Buildvariants          #
  #######################################

  - name: rhel71-ppc64le
    display_name: ZAP PPC64LE RHEL 7.1
    run_on:
      - rhel71-power8
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: rhel81-ppc64le
    display_name: ZAP PPC64LE RHEL 8.1
    run_on:
      - rhel81-power8
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: rhel9-ppc64le
    display_name: ZAP PPC64LE RHEL 9
    run_on:
      - rhel9-power-small
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  #######################################
  #     Z (s390x) Buildvariants         #
  #######################################

  - name: rhel72-s390x
    display_name: ZAP s390x RHEL 7.2
    run_on:
      - rhel72-zseries
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: rhel83-s390x
    display_name: ZAP s390x RHEL 8.3
    run_on:
      - rhel83-zseries
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

  - name: rhel9-s390x
    display_name: ZAP s390x RHEL 9
    run_on:
      - rhel9-zseries-small
    stepback: false
    tasks:
      - name: "dist"
      - name: "sign"
        run_on: rhel87-small
      - name: "push"
        run_on: rhel80-small

# This set of aliases is generated by the code in the `evergreen` directory.
# Do not edit this by hand!
# It can be regenerated by running `go run evergreen/generator/main.go`.
github_pr_aliases:
  # Run all static analysis tasks.
  - variant: "^static$"
    task: ".*"
  # Run unit for every platform.
  - variant: ".*"
    task: "^unit$"
  # Run push and record this PR run in Papertrail.
  - variant: ".*"
    task: "^push$"
  # Run golang tests with the race detector enabled.
  - variant: "^rhel88-race$"
    task: "^(aws-auth|integration|kerberos|unit)"
  # Run all integration tests on one variant. We pick RHEL 8.8 because it's
  # a relatively recent platform that supports a wide range of servers.
  - variant: "^rhel88$"
    task: "^(aws-auth|integration|kerberos|legacy|native-cert-ssl|qa-dump-restore|qa-tests)"
  # Run a subset of integration tests against the latest version of MongoDB
  # Server on all variants where that is the most recent supported version.
  - variant: "^(rhel88|windows)$"
    task: "integration-latest"
