Skip to content

Commit 31c9926

Browse files
authored
Merge pull request #441 from codacy/fix-get-script-for-self-hosted
Change the get.sh to pin the coverage reporter version to a working o…
2 parents fc19cff + 18f6bc5 commit 31c9926

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

get.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,33 @@ download_reporter() {
160160
fi
161161
}
162162

163+
is_self_hosted_instance() {
164+
if [[ "$CODACY_API_BASE_URL" == "https://api.codacy.com"* ]] || \
165+
[[ "$CODACY_API_BASE_URL" == "https://app.codacy.com"* ]] || \
166+
[[ "$CODACY_API_BASE_URL" == "https://app.staging.codacy.org"* ]] || \
167+
[[ "$CODACY_API_BASE_URL" == "https://api.staging.codacy.org"* ]] || \
168+
[[ "$CODACY_API_BASE_URL" == "https://app.dev.codacy.org"* ]] || \
169+
[[ "$CODACY_API_BASE_URL" == "https://api.dev.codacy.org"* ]]; then
170+
false
171+
else
172+
true
173+
fi
174+
}
175+
163176
os_name=$(uname)
164177

178+
# This version should be one that matches the latest self hosted release.
179+
SELF_HOSTED_CODACY_REPORTER_VERSION="13.10.15"
180+
165181
# Find the latest version in case is not specified
166182
if [ -z "$CODACY_REPORTER_VERSION" ] || [ "$CODACY_REPORTER_VERSION" = "latest" ]; then
167-
CODACY_REPORTER_VERSION=$(download_stdout "https://artifacts.codacy.com/bin/codacy-coverage-reporter/latest")
183+
# In case of a self hosted installation, pin a version to the latest released self hosted version working coverage reporter
184+
if [ -n "$CODACY_API_BASE_URL" ] && is_self_hosted_instance; then
185+
log "Self hosted instance detected, setting codacy coverage reporter version to $SELF_HOSTED_CODACY_REPORTER_VERSION"
186+
CODACY_REPORTER_VERSION="$SELF_HOSTED_CODACY_REPORTER_VERSION"
187+
else
188+
CODACY_REPORTER_VERSION=$(download_stdout "https://artifacts.codacy.com/bin/codacy-coverage-reporter/latest")
189+
fi
168190
fi
169191

170192
# Temporary folder for downloaded files

0 commit comments

Comments
 (0)