Skip to content

Commit

Permalink
Merge pull request #441 from codacy/fix-get-script-for-self-hosted
Browse files Browse the repository at this point in the history
Change the get.sh to pin the coverage reporter version to a working o…
  • Loading branch information
rubencodacy committed Dec 7, 2022
2 parents fc19cff + 18f6bc5 commit 31c9926
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,33 @@ download_reporter() {
fi
}

is_self_hosted_instance() {
if [[ "$CODACY_API_BASE_URL" == "https://api.codacy.com"* ]] || \
[[ "$CODACY_API_BASE_URL" == "https://app.codacy.com"* ]] || \
[[ "$CODACY_API_BASE_URL" == "https://app.staging.codacy.org"* ]] || \
[[ "$CODACY_API_BASE_URL" == "https://api.staging.codacy.org"* ]] || \
[[ "$CODACY_API_BASE_URL" == "https://app.dev.codacy.org"* ]] || \
[[ "$CODACY_API_BASE_URL" == "https://api.dev.codacy.org"* ]]; then
false
else
true
fi
}

os_name=$(uname)

# This version should be one that matches the latest self hosted release.
SELF_HOSTED_CODACY_REPORTER_VERSION="13.10.15"

# Find the latest version in case is not specified
if [ -z "$CODACY_REPORTER_VERSION" ] || [ "$CODACY_REPORTER_VERSION" = "latest" ]; then
CODACY_REPORTER_VERSION=$(download_stdout "https://artifacts.codacy.com/bin/codacy-coverage-reporter/latest")
# In case of a self hosted installation, pin a version to the latest released self hosted version working coverage reporter
if [ -n "$CODACY_API_BASE_URL" ] && is_self_hosted_instance; then
log "Self hosted instance detected, setting codacy coverage reporter version to $SELF_HOSTED_CODACY_REPORTER_VERSION"
CODACY_REPORTER_VERSION="$SELF_HOSTED_CODACY_REPORTER_VERSION"
else
CODACY_REPORTER_VERSION=$(download_stdout "https://artifacts.codacy.com/bin/codacy-coverage-reporter/latest")
fi
fi

# Temporary folder for downloaded files
Expand Down

0 comments on commit 31c9926

Please sign in to comment.