Skip to content

Upload evergreen test results to codecov.io #1736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: v2.x
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .evergreen/config/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,22 @@ functions:
- command: attach.results
params:
file_location: "${DRIVERS_TOOLS}/results.json"
- command: shell.exec
params:
working_dir: src
script: |
${PREPARE_SHELL}
curl -Os https://cli.codecov.io/latest/linux/codecov
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this isn't be pulled from a repository, it'd be prudent to integrity check the binary. I noted this didn't apply to the earlier GitHub Action integration (ae31f00) since you just reference their action (codecov/test-results-action).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the shasum check for the time being. I can add the gpg signature check for the checksum file as well, but with evergreen sharing hosts between runs I'm not sure if we should be messing with the keychain.

sudo chmod +x codecov
[[ -f test-results.xml ]] && \
./codecov upload-process \
--report-type test_results \
--disable-search \
--fail-on-error \
--token ${CODECOV_TOKEN} \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this reference a variable from the Evergreen project config? I didn't see this when taking a look at the PHPLIB 2.x project settings.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason uploading the test result file worked even without a token. I have added it to the repo variables nonetheless.

--flag "${MONGODB_VERSION}-${TOPOLOGY}" \
--file test-results.xml || \
echo "Skipping codecov test result upload due to error"

"bootstrap mongo-orchestration":
- command: shell.exec
Expand All @@ -143,6 +159,13 @@ functions:
LOAD_BALANCER=${LOAD_BALANCER} \
REQUIRE_API_VERSION=${REQUIRE_API_VERSION} \
bash ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
- command: shell.exec
params:
script: |
printf "\n" >> mo-expansion.yml
printf "MONGODB_VERSION: '%s'\n" "${MONGODB_VERSION}" >> mo-expansion.yml
printf "TOPOLOGY: '%s'\n" "${TOPOLOGY}" >> mo-expansion.yml
cat mo-expansion.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this necessary? $MONGODB_VERSION and $TOPOLOGY should already be available in the environment, since they're referenced in the previous shell.exec command. The inclusion of cat here also looks like it may be leftover debugging.

Based on the comment below, expansions.update was only necessary to add
MONGODB_URI and CRYPT_SHARED_LIB_PATH, which are written in drivers_orchestration.py.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MONGODB_VERSION and TOPOLOGY are passed as variables to the bootstrap mongo-orchestration function only, so they are no longer available later in the run. Adding them to the expansion file created by the script allows us to reuse the values later.

# run-orchestration generates expansion file with MONGODB_URI and CRYPT_SHARED_LIB_PATH
- command: expansions.update
params:
Expand Down