|
| 1 | +# When a task that used to pass starts to fail |
| 2 | +# Go through all versions that may have been skipped to detect |
| 3 | +# when the task started failing |
| 4 | +stepback: true |
| 5 | + |
| 6 | +# Mark a failure as a system/bootstrap failure (purple box) rather then a task |
| 7 | +# failure by default. |
| 8 | +# Actual testing tasks are marked with `type: test` |
| 9 | +command_type: system |
| 10 | + |
| 11 | +# Protect ourself against rogue test case, or curl gone wild, that runs forever |
| 12 | +# Good rule of thumb: the averageish length a task takes, times 5 |
| 13 | +# That roughly accounts for variable system performance for various buildvariants |
| 14 | +exec_timeout_secs: 1800 # 6 minutes is the longest we'll ever run |
| 15 | + |
| 16 | +# What to do when evergreen hits the timeout (`post:` tasks are run automatically) |
| 17 | +timeout: |
| 18 | + - command: shell.exec |
| 19 | + params: |
| 20 | + script: | |
| 21 | + ls -la |
| 22 | +
|
| 23 | +functions: |
| 24 | + "fetch source": |
| 25 | + # Executes git clone and applies the submitted patch, if any |
| 26 | + - command: git.get_project |
| 27 | + params: |
| 28 | + directory: "src" |
| 29 | + # Applies the submitted patch, if any |
| 30 | + # Deprecated. Should be removed. But still needed for certain agents (ZAP) |
| 31 | + - command: git.apply_patch |
| 32 | + # Make an evergreen exapanstion file with dynamic values |
| 33 | + - command: shell.exec |
| 34 | + params: |
| 35 | + working_dir: "src" |
| 36 | + script: | |
| 37 | + # Get the current unique version of this checkout |
| 38 | + if [ "${is_patch}" = "true" ]; then |
| 39 | + CURRENT_VERSION=$(git describe)-patch-${version_id} |
| 40 | + else |
| 41 | + CURRENT_VERSION=latest |
| 42 | + fi |
| 43 | +
|
| 44 | + export DRIVERS_TOOLS="$(pwd)/../drivers-tools" |
| 45 | + export PROJECT_DIRECTORY="$(pwd)" |
| 46 | + export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin" |
| 47 | + export UPLOAD_BUCKET="${project}" |
| 48 | +
|
| 49 | + cat <<EOT > expansion.yml |
| 50 | + CURRENT_VERSION: "$CURRENT_VERSION" |
| 51 | + DRIVERS_TOOLS: "$DRIVERS_TOOLS" |
| 52 | + MONGO_ORCHESTRATION_HOME: "$MONGO_ORCHESTRATION_HOME" |
| 53 | + MONGODB_BINARIES: "$MONGODB_BINARIES" |
| 54 | + UPLOAD_BUCKET: "$UPLOAD_BUCKET" |
| 55 | + PROJECT_DIRECTORY: "$PROJECT_DIRECTORY" |
| 56 | + PREPARE_SHELL: | |
| 57 | + set -o errexit |
| 58 | + set -o xtrace |
| 59 | + export DRIVERS_TOOLS="$DRIVERS_TOOLS" |
| 60 | + export MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME" |
| 61 | + export MONGODB_BINARIES="$MONGODB_BINARIES" |
| 62 | + export UPLOAD_BUCKET="$UPLOAD_BUCKET" |
| 63 | + export PROJECT_DIRECTORY="$PROJECT_DIRECTORY" |
| 64 | +
|
| 65 | + export TMPDIR="$MONGO_ORCHESTRATION_HOME/db" |
| 66 | + export PATH="$MONGODB_BINARIES:$PATH" |
| 67 | + export PROJECT="${project}" |
| 68 | + EOT |
| 69 | + # See what we've done |
| 70 | + cat expansion.yml |
| 71 | +
|
| 72 | + # Load the expansion file to make an evergreen variable with the current unique version |
| 73 | + - command: expansions.update |
| 74 | + params: |
| 75 | + file: src/expansion.yml |
| 76 | + |
| 77 | + "prepare resources": |
| 78 | + - command: shell.exec |
| 79 | + params: |
| 80 | + script: | |
| 81 | + ${PREPARE_SHELL} |
| 82 | + rm -rf $DRIVERS_TOOLS |
| 83 | + git clone git://github.com/mongodb-labs/drivers-evergreen-tools.git $DRIVERS_TOOLS |
| 84 | +
|
| 85 | + "run tests": |
| 86 | + - command: shell.exec |
| 87 | + type: test |
| 88 | + params: |
| 89 | + working_dir: "src" |
| 90 | + script: | |
| 91 | + ${PREPARE_SHELL} |
| 92 | + MONGODB_VERSION=${VERSION} TOPOLOGY=${TOPOLOGY} AUTH=${AUTH} SSL=${SSL} MONGODB_URI="${MONGODB_URI}" sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh |
| 93 | +
|
| 94 | + "cleanup": |
| 95 | + - command: shell.exec |
| 96 | + params: |
| 97 | + script: | |
| 98 | + ${PREPARE_SHELL} |
| 99 | + rm -rf $DRIVERS_TOOLS || true |
| 100 | +
|
| 101 | + "fix absolute paths": |
| 102 | + - command: shell.exec |
| 103 | + params: |
| 104 | + script: | |
| 105 | + ${PREPARE_SHELL} |
| 106 | + for filename in $(find ${DRIVERS_TOOLS} -name \*.json); do |
| 107 | + perl -p -i -e "s|ABSOLUTE_PATH_REPLACEMENT_TOKEN|${DRIVERS_TOOLS}|g" $filename |
| 108 | + done |
| 109 | +
|
| 110 | + # "windows fix": |
| 111 | + # - command: shell.exec |
| 112 | + # params: |
| 113 | + # script: | |
| 114 | + # ${PREPARE_SHELL} |
| 115 | + # for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do |
| 116 | + # cat $i | tr -d '\r' > $i.new |
| 117 | + # mv $i.new $i |
| 118 | + # done |
| 119 | + # # Copy client certificate because symlinks do not work on Windows. |
| 120 | + # cp ${DRIVERS_TOOLS}/.evergreen/x509gen/client.pem ${MONGO_ORCHESTRATION_HOME}/lib/client.pem |
| 121 | + |
| 122 | + "make files executable": |
| 123 | + - command: shell.exec |
| 124 | + params: |
| 125 | + script: | |
| 126 | + ${PREPARE_SHELL} |
| 127 | + for i in $(find ${DRIVERS_TOOLS}/.evergreen ${PROJECT_DIRECTORY}/.evergreen -name \*.sh); do |
| 128 | + chmod +x $i |
| 129 | + done |
| 130 | +
|
| 131 | + "install dependencies": |
| 132 | + - command: shell.exec |
| 133 | + params: |
| 134 | + working_dir: "src" |
| 135 | + script: | |
| 136 | + ${PREPARE_SHELL} |
| 137 | + NODE_LTS_NAME=${NODE_LTS_NAME} sh ${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh |
| 138 | +
|
| 139 | + "run atlas tests": |
| 140 | + - command: shell.exec |
| 141 | + params: |
| 142 | + working_dir: "src" |
| 143 | + silent: true |
| 144 | + script: | |
| 145 | + # DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does) |
| 146 | + NODE_LTS_NAME='${NODE_LTS_NAME}' ATLAS_REPL='${atlas_repl}' ATLAS_SHRD='${atlas_shrd}' ATLAS_FREE='${atlas_free}' ATLAS_TLS11='${atlas_tls11}' ATLAS_TLS12='${atlas_tls12}' sh ${PROJECT_DIRECTORY}/.evergreen/run-atlas-tests.sh |
| 147 | +
|
| 148 | +pre: |
| 149 | + - func: "fetch source" |
| 150 | + - func: "prepare resources" |
| 151 | + # - func: "windows fix" |
| 152 | + - func: "fix absolute paths" |
| 153 | + - func: "make files executable" |
| 154 | + - func: "install dependencies" |
| 155 | + |
| 156 | +post: |
| 157 | + - func: "cleanup" |
0 commit comments