Skip to content

Fix for: Include links to the Evergreen build and to the driver security testing summary in the SSDLC report #1433

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

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion .evergreen/.evg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ functions:
env:
PRODUCT_NAME: ${product_name}
PRODUCT_VERSION: ${product_version}
PRODUCT_RELEASE_CREATOR: ${author}
EVERGREEN_VERSION_ID: ${version_id}
script: .evergreen/ssdlc-report.sh
- command: ec2.assume_role
Expand Down
34 changes: 26 additions & 8 deletions .evergreen/ssdlc-report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set -eu
# Supported/used environment variables:
# PRODUCT_NAME
# PRODUCT_VERSION
# PRODUCT_RELEASE_CREATOR
# EVERGREEN_VERSION_ID

if [ -z "${PRODUCT_NAME}" ]; then
Expand All @@ -16,10 +15,6 @@ if [ -z "${PRODUCT_VERSION}" ]; then
printf "\nPRODUCT_VERSION must be set to a non-empty string\n"
exit 1
fi
if [ -z "${PRODUCT_RELEASE_CREATOR}" ]; then
printf "\PRODUCT_RELEASE_CREATOR must be set to a non-empty string\n"
exit 1
fi
if [ -z "${EVERGREEN_VERSION_ID}" ]; then
printf "\EVERGREEN_VERSION_ID must be set to a non-empty string\n"
exit 1
Expand All @@ -34,14 +29,37 @@ source "${RELATIVE_DIR_PATH}/javaConfig.bash"
printf "\nCreating SSDLC reports\n"
printf "\nProduct name: %s\n" "${PRODUCT_NAME}"
printf "\nProduct version: %s\n" "${PRODUCT_VERSION}"
printf "\nProduct release creator: %s\n" "${PRODUCT_RELEASE_CREATOR}"
declare -r EVERGREEN_BUILD_URL="https://spruce.mongodb.com/version/${EVERGREEN_VERSION_ID}"
printf "\nEvergreen build URL: %s\n" "${EVERGREEN_BUILD_URL}"

declare -r SSDLC_PATH="${RELATIVE_DIR_PATH}/../build/ssdlc"
declare -r SSDLC_STATIC_ANALYSIS_REPORTS_PATH="${SSDLC_PATH}/static-analysis-reports"
mkdir "${SSDLC_PATH}"
mkdir "${SSDLC_STATIC_ANALYSIS_REPORTS_PATH}"

declare -r EVERGREEN_PROJECT_NAME_PREFIX="${PRODUCT_NAME//-/_}"
declare -r EVERGREEN_BUILD_URL_PREFIX="https://spruce.mongodb.com/version"
declare -r GIT_TAG="r${PRODUCT_VERSION}"
GIT_COMMIT_HASH="$(git rev-list --ignore-missing -n 1 "${GIT_TAG}")"
set +e
GIT_BRANCH_MASTER="$(git branch -a --contains "${GIT_TAG}" | grep 'master$')"
GIT_BRANCH_PATCH="$(git branch -a --contains "${GIT_TAG}" | grep '\.x$')"
set -e
if [ -n "${GIT_BRANCH_MASTER}" ]; then
declare -r EVERGREEN_BUILD_URL="${EVERGREEN_BUILD_URL_PREFIX}/${EVERGREEN_PROJECT_NAME_PREFIX}_${GIT_COMMIT_HASH}"
elif [ -n "${GIT_BRANCH_PATCH}" ]; then
# strip out the patch version
declare -r EVERGREEN_PROJECT_NAME_SUFFIX="${PRODUCT_VERSION%.*}"
declare -r EVERGREEN_BUILD_URL="${EVERGREEN_BUILD_URL_PREFIX}/${EVERGREEN_PROJECT_NAME_PREFIX}_${EVERGREEN_PROJECT_NAME_SUFFIX}_${GIT_COMMIT_HASH}"
elif [[ "${PRODUCT_NAME}" == *'-snapshot' ]]; then
declare -r EVERGREEN_BUILD_URL="${EVERGREEN_BUILD_URL_PREFIX}/${EVERGREEN_VERSION_ID}"
else
printf "\nFailed to compute EVERGREEN_BUILD_URL\n"
exit 1
fi
printf "\nEvergreen build URL: %s\n" "${EVERGREEN_BUILD_URL}"

PRODUCT_RELEASE_CREATOR="$(git log --ignore-missing "${GIT_TAG}"^.."${GIT_TAG}" --simplify-by-decoration --pretty='format:%aN')"
printf "\nProduct release creator: %s\n" "${PRODUCT_RELEASE_CREATOR}"

printf "\nCreating SpotBugs SARIF reports\n"
./gradlew -version
set +e
Expand Down