11#! /usr/bin/env bash
2- CC_WRAPPER_VERSION=" 0.2.1"
32set +u
43say () {
54 echo -e " $1 "
@@ -37,17 +36,19 @@ b="\033[0;36m" # variables/constants
3736g=" \033[0;32m" # info/debug
3837r=" \033[0;31m" # errors
3938x=" \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} "
4044say " _____ _
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+ "
5152if [ -n " $CC_BINARY " ];
5253then
5354 if [ -f " $CC_BINARY " ];
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 " "
9899fi
99100if [ " $CC_SKIP_VALIDATION " == " true" ] || [ -n " $CC_BINARY " ] || [ " $CC_USE_PYPI " == " true" ];
100101then
101102 say " $r ==>$x Bypassing validation..."
102103else
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"
151152else
152153 token=" $( eval echo $CC_TOKEN ) "
153154fi
154- say " $g ->$x Token of length ${# token} detected "
155+ say " $g ->$x Token length: ${# token} "
155156token_str=" "
156157token_arg=()
157158if [ -n " $token " ];
0 commit comments