Skip to content

Commit 2b79379

Browse files
authored
feat: upgrade wrapper to 0.2.4 (#1864)
1 parent 39a2af1 commit 2b79379

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

dist/codecov.sh

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env bash
2-
CC_WRAPPER_VERSION="0.2.1"
32
set +u
43
say() {
54
echo -e "$1"
@@ -37,17 +36,19 @@ b="\033[0;36m" # variables/constants
3736
g="\033[0;32m" # info/debug
3837
r="\033[0;31m" # errors
3938
x="\033[0m"
39+
retry="--retry 5 --retry-delay 2"
40+
CC_WRAPPER_VERSION="0.2.4"
41+
CC_VERSION="${CC_VERSION:-latest}"
42+
CC_FAIL_ON_ERROR="${CC_FAIL_ON_ERROR:-false}"
43+
CC_RUN_CMD="${CC_RUN_CMD:-upload-coverage}"
4044
say " _____ _
4145
/ ____| | |
4246
| | ___ __| | ___ ___ _____ __
4347
| | / _ \\ / _\` |/ _ \\/ __/ _ \\ \\ / /
4448
| |___| (_) | (_| | __/ (_| (_) \\ V /
4549
\\_____\\___/ \\__,_|\\___|\\___\\___/ \\_/
4650
$r Wrapper-$CC_WRAPPER_VERSION$x
47-
"
48-
CC_VERSION="${CC_VERSION:-latest}"
49-
CC_FAIL_ON_ERROR="${CC_FAIL_ON_ERROR:-false}"
50-
CC_RUN_CMD="${CC_RUN_CMD:-upload-coverage}"
51+
"
5152
if [ -n "$CC_BINARY" ];
5253
then
5354
if [ -f "$CC_BINARY" ];
@@ -85,22 +86,22 @@ else
8586
[[ $CC_OS == "macos" ]] && \
8687
! command -v gpg 2>&1 >/dev/null && \
8788
HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg
88-
c_url="https://cli.codecov.io"
89+
c_url="${CC_CLI_URL:-https://cli.codecov.io}"
8990
c_url="$c_url/${CC_VERSION}"
9091
c_url="$c_url/${CC_OS}/${c_filename}"
9192
say "$g ->$x Downloading $b${c_url}$x"
92-
curl -O --retry 5 --retry-delay 2 "$c_url"
93+
curl -O $retry "$c_url"
9394
say "$g==>$x Finishing downloading $b${CC_OS}:${CC_VERSION}$x"
94-
version_url="https://cli.codecov.io/api/${CC_OS}/${CC_VERSION}"
95-
version=$(curl -s "$version_url" -H "Accept:application/json" | tr \{ '\n' | tr , '\n' | tr \} '\n' | grep "\"version\"" | awk -F'"' '{print $4}' | tail -1)
96-
say " Version: $b$version$x"
95+
v_url="https://cli.codecov.io/api/${CC_OS}/${CC_VERSION}"
96+
v=$(curl $retry --retry-all-errors -s "$v_url" -H "Accept:application/json" | tr \{ '\n' | tr , '\n' | tr \} '\n' | grep "\"version\"" | awk -F'"' '{print $4}' | tail -1)
97+
say " Version: $b$v$x"
9798
say " "
9899
fi
99100
if [ "$CC_SKIP_VALIDATION" == "true" ] || [ -n "$CC_BINARY" ] || [ "$CC_USE_PYPI" == "true" ];
100101
then
101102
say "$r==>$x Bypassing validation..."
102103
else
103-
CC_PUBLIC_PGP_KEY=$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)
104+
CC_PUBLIC_PGP_KEY=$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)
104105
echo "${CC_PUBLIC_PGP_KEY}" | \
105106
gpg --no-default-keyring --import
106107
# One-time step
@@ -111,8 +112,8 @@ CC_PUBLIC_PGP_KEY=$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)
111112
say "$g ->$x Downloading $b${sha_url}$x"
112113
say "$g ->$x Downloading $b${sha_url}.sig$x"
113114
say " "
114-
curl -Os --retry 5 --retry-delay 2 --connect-timeout 2 "$sha_url"
115-
curl -Os --retry 5 --retry-delay 2 --connect-timeout 2 "${sha_url}.sig"
115+
curl -Os $retry --connect-timeout 2 "$sha_url"
116+
curl -Os $retry --connect-timeout 2 "${sha_url}.sig"
116117
if ! gpg --verify "${c_filename}.SHA256SUM.sig" "${c_filename}.SHA256SUM";
117118
then
118119
exit_if_error "Could not verify signature. Please contact Codecov if problem continues"
@@ -151,7 +152,7 @@ then
151152
else
152153
token="$(eval echo $CC_TOKEN)"
153154
fi
154-
say "$g ->$x Token of length ${#token} detected"
155+
say "$g ->$x Token length: ${#token}"
155156
token_str=""
156157
token_arg=()
157158
if [ -n "$token" ];

0 commit comments

Comments
 (0)