1
1
#! /usr/bin/env bash
2
- CC_WRAPPER_VERSION=" 0.2.1"
3
2
set +u
4
3
say () {
5
4
echo -e " $1 "
@@ -37,17 +36,19 @@ b="\033[0;36m" # variables/constants
37
36
g=" \033[0;32m" # info/debug
38
37
r=" \033[0;31m" # errors
39
38
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} "
40
44
say " _____ _
41
45
/ ____| | |
42
46
| | ___ __| | ___ ___ _____ __
43
47
| | / _ \\ / _\` |/ _ \\ / __/ _ \\ \\ / /
44
48
| |___| (_) | (_| | __/ (_| (_) \\ V /
45
49
\\ _____\\ ___/ \\ __,_|\\ ___|\\ ___\\ ___/ \\ _/
46
50
$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
+ "
51
52
if [ -n " $CC_BINARY " ];
52
53
then
53
54
if [ -f " $CC_BINARY " ];
85
86
[[ $CC_OS == " macos" ]] && \
86
87
! command -v gpg 2>&1 > /dev/null && \
87
88
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} "
89
90
c_url=" $c_url /${CC_VERSION} "
90
91
c_url=" $c_url /${CC_OS} /${c_filename} "
91
92
say " $g ->$x Downloading $b ${c_url} $x "
92
- curl -O -- retry 5 --retry-delay 2 " $c_url "
93
+ curl -O $ retry " $c_url "
93
94
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 "
97
98
say " "
98
99
fi
99
100
if [ " $CC_SKIP_VALIDATION " == " true" ] || [ -n " $CC_BINARY " ] || [ " $CC_USE_PYPI " == " true" ];
100
101
then
101
102
say " $r ==>$x Bypassing validation..."
102
103
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)
104
105
echo " ${CC_PUBLIC_PGP_KEY} " | \
105
106
gpg --no-default-keyring --import
106
107
# One-time step
@@ -111,8 +112,8 @@ CC_PUBLIC_PGP_KEY=$(curl -s https://keybase.io/codecovsecurity/pgp_keys.asc)
111
112
say " $g ->$x Downloading $b ${sha_url} $x "
112
113
say " $g ->$x Downloading $b ${sha_url} .sig$x "
113
114
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"
116
117
if ! gpg --verify " ${c_filename} .SHA256SUM.sig" " ${c_filename} .SHA256SUM" ;
117
118
then
118
119
exit_if_error " Could not verify signature. Please contact Codecov if problem continues"
151
152
else
152
153
token=" $( eval echo $CC_TOKEN ) "
153
154
fi
154
- say " $g ->$x Token of length ${# token} detected "
155
+ say " $g ->$x Token length: ${# token} "
155
156
token_str=" "
156
157
token_arg=()
157
158
if [ -n " $token " ];
0 commit comments