Skip to content

Commit ad30c54

Browse files
chore(release): 0.0.13 add verification bypasses
1 parent 3bfa27e commit ad30c54

File tree

8 files changed

+193
-176
lines changed

8 files changed

+193
-176
lines changed

dist/codecov.sh

Lines changed: 121 additions & 110 deletions
Large diffs are not rendered by default.

package.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def _parse(file):
3838
return lines
3939

4040
def _shorten_line(line):
41-
return line.replace("CODECOV", "CC")
41+
return line.replace("CODECOV", "CC").replace("codecov_", "cc_")
4242

4343
def _get_script_from_line(line):
4444
matcher = r'\s*\. \.\/(\S+\.sh)$' #. ./version.sh

scripts/download.sh

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,39 @@
11
#!/usr/bin/env bash
22

3-
family=$(uname -s | tr '[:upper:]' '[:lower:]')
4-
codecov_os="windows"
5-
[[ $family == "darwin" ]] && codecov_os="macos"
3+
if [ -n "$CODECOV_BINARY" ];
4+
then
5+
if [ -f "$CODECOV_BINARY" ];
6+
then
7+
codecov_filename=$CODECOV_BINARY
8+
else
9+
exit_if_error "Could not find binary file $CODECOV_BINARY"
10+
fi
11+
else
12+
family=$(uname -s | tr '[:upper:]' '[:lower:]')
13+
codecov_os="windows"
14+
[[ $family == "darwin" ]] && codecov_os="macos"
615

7-
[[ $family == "linux" ]] && codecov_os="linux"
8-
[[ $codecov_os == "linux" ]] && \
9-
osID=$(grep -e "^ID=" /etc/os-release | cut -c4-)
10-
[[ $osID == "alpine" ]] && codecov_os="alpine"
11-
[[ $(arch) == "aarch64" && $family == "linux" ]] && codecov_os+="-arm64"
12-
say "$g==>$x Detected $b${codecov_os}$x"
13-
export codecov_os=${codecov_os}
14-
export codecov_version=${CODECOV_VERSION}
16+
[[ $family == "linux" ]] && codecov_os="linux"
17+
[[ $codecov_os == "linux" ]] && \
18+
osID=$(grep -e "^ID=" /etc/os-release | cut -c4-)
19+
[[ $osID == "alpine" ]] && codecov_os="alpine"
20+
[[ $(arch) == "aarch64" && $family == "linux" ]] && codecov_os+="-arm64"
21+
say "$g==>$x Detected $b${codecov_os}$x"
22+
export codecov_os=${codecov_os}
23+
export codecov_version=${CODECOV_VERSION}
1524

16-
codecov_filename="codecov"
17-
[[ $codecov_os == "windows" ]] && codecov_filename+=".exe"
18-
export codecov_filename=${codecov_filename}
19-
[[ $codecov_os == "macos" ]] && \
20-
! command -v gpg 2>&1 >/dev/null && \
21-
HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg
22-
codecov_url="https://cli.codecov.io"
23-
codecov_url="$codecov_url/${CODECOV_VERSION}"
24-
codecov_url="$codecov_url/${codecov_os}/${codecov_filename}"
25-
say "$g ->$x Downloading $b${codecov_url}$x"
26-
curl -Os $codecov_url
25+
codecov_filename="codecov"
26+
[[ $codecov_os == "windows" ]] && codecov_filename+=".exe"
27+
export codecov_filename=${codecov_filename}
28+
[[ $codecov_os == "macos" ]] && \
29+
! command -v gpg 2>&1 >/dev/null && \
30+
HOMEBREW_NO_AUTO_UPDATE=1 brew install gpg
31+
codecov_url="https://cli.codecov.io"
32+
codecov_url="$codecov_url/${CODECOV_VERSION}"
33+
codecov_url="$codecov_url/${codecov_os}/${codecov_filename}"
34+
say "$g ->$x Downloading $b${codecov_url}$x"
35+
curl -Os $codecov_url
2736

28-
say "$g==>$x Finishing downloading $b${codecov_os}:${CODECOV_VERSION}$x"
29-
say " "
37+
say "$g==>$x Finishing downloading $b${codecov_os}:${CODECOV_VERSION}$x"
38+
say " "
39+
fi

scripts/run.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
. ./version.sh
44
. ./set_defaults.sh
55
. ./download.sh
6-
. ./set_validation_key.sh
76
. ./validate.sh
87

98
. ./set_cli_args.sh

scripts/set_cli_args.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
#!/usr/bin/env bash
22

3-
codecov_cli_args=""
3+
codecov_cli_args=()
44

55
if [ -n "$CODECOV_AUTO_LOAD_PARAMS_FROM" ];
66
then
7-
codecov_cli_args+=" --auto-load-params-from ${CODECOV_AUTO_LOAD_PARAMS_FROM}"
7+
codecov_cli_args+=( " --auto-load-params-from " "${CODECOV_AUTO_LOAD_PARAMS_FROM}" )
88
fi
99

1010
if [ -n "$CODECOV_ENTERPRISE_URL" ];
1111
then
12-
codecov_cli_args+=" --enterprise-url ${CODECOV_ENTERPRISE_URL}"
12+
codecov_cli_args+=( " --enterprise-url " "${CODECOV_ENTERPRISE_URL}" )
1313
fi
1414

1515
unset CODECOV_YML_PATH
1616
if [ -n "$CODECOV_YML_PATH" ];
1717
then
18-
codecov_cli_args+=" --codecov-yml-path ${CODECOV_YML_PATH}"
18+
codecov_cli_args+=( " --codecov-yml-path " "${CODECOV_YML_PATH}" )
1919
fi
2020

scripts/upload.sh

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,49 +15,40 @@ fi
1515
say "$g ->$x Token of length ${#token} detected"
1616
token_str=""
1717
token_arg=()
18-
if [ -n $token ];
18+
if [ -n "$token" ];
1919
then
2020
token_str+=" -t <redacted>"
2121
token_arg+=( " -t " "$token")
2222
fi
2323

24-
#create commit
2524
say "$g==>$x Running create-commit"
2625
say " $b./$codecov_filename$codecov_cli_args create-commit$token_str$codecov_cc_args$x"
27-
2826
if ! ./$codecov_filename \
29-
$codecov_cli_args \
27+
${codecov_cli_args[@]} \
3028
create-commit \
3129
${token_arg[@]} \
3230
${codecov_cc_args[@]};
3331
then
3432
exit_if_error "Failed to create-commit"
3533
fi
36-
3734
say " "
3835

39-
#create report
4036
say "$g==>$x Running create-report"
4137
say " $b./$codecov_filename$codecov_cli_args create-commit$token_str$codecov_cr_args$x"
42-
4338
if ! ./$codecov_filename \
44-
$codecov_cli_args \
39+
${codecov_cli_args[@]} \
4540
create-report \
4641
${token_arg[@]} \
4742
${codecov_cr_args[@]};
4843
then
4944
exit_if_error "Failed to create-report"
5045
fi
51-
5246
say " "
5347

54-
#upload reports
55-
# alpine doesn't allow for indirect expansion
5648
say "$g==>$x Running do-upload"
5749
say " $b./$codecov_filename$codecov_cli_args do-upload$token_str$codecov_du_args$x"
58-
5950
if ! ./$codecov_filename \
60-
$codecov_cli_args \
51+
${codecov_cli_args[@]} \
6152
do-upload \
6253
${token_arg[@]} \
6354
${codecov_du_args[@]};

scripts/validate.sh

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
#!/usr/bin/env bash
22

3-
echo "${CODECOV_PUBLIC_PGP_KEY}" | \
4-
gpg --no-default-keyring --import
5-
# One-time step
6-
say "$g==>$x Verifying GPG signature integrity"
7-
sha_url="https://cli.codecov.io"
8-
sha_url="${sha_url}/${codecov_version}/${codecov_os}"
9-
sha_url="${sha_url}/${codecov_filename}.SHA256SUM"
10-
say "$g ->$x Downloading $b${sha_url}$x"
11-
say "$g ->$x Downloading $b${sha_url}.sig$x"
12-
say " "
3+
if [ "$CODECOV_SKIP_VALIDATION" = "true" ] || [ -n "$CODECOV_BINARY" ];
4+
then
5+
say "$r==>$x Bypassing validation as requested by user"
6+
else
7+
. ./set_validation_key.sh
8+
echo "${CODECOV_PUBLIC_PGP_KEY}" | \
9+
gpg --no-default-keyring --import
10+
# One-time step
11+
say "$g==>$x Verifying GPG signature integrity"
12+
sha_url="https://cli.codecov.io"
13+
sha_url="${sha_url}/${codecov_version}/${codecov_os}"
14+
sha_url="${sha_url}/${codecov_filename}.SHA256SUM"
15+
say "$g ->$x Downloading $b${sha_url}$x"
16+
say "$g ->$x Downloading $b${sha_url}.sig$x"
17+
say " "
1318

14-
curl -Os "$sha_url"
15-
curl -Os "${sha_url}.sig"
19+
curl -Os "$sha_url"
20+
curl -Os "${sha_url}.sig"
1621

17-
if ! gpg --verify "${codecov_filename}.SHA256SUM.sig" "${codecov_filename}.SHA256SUM";
18-
then
19-
exit_if_error "Could not verify signature. Please contact Codecov if problem continues"
20-
fi
22+
if ! gpg --verify "${codecov_filename}.SHA256SUM.sig" "${codecov_filename}.SHA256SUM";
23+
then
24+
exit_if_error "Could not verify signature. Please contact Codecov if problem continues"
25+
fi
2126

22-
if ! (shasum -a 256 -c "${codecov_filename}.SHA256SUM" || \
23-
sha256sum -c "${codecov_filename}.SHA256SUM");
24-
then
25-
exit_if_error "Could not verify SHASUM. Please contact Codecov if problem continues"
27+
if ! (shasum -a 256 -c "${codecov_filename}.SHA256SUM" || \
28+
sha256sum -c "${codecov_filename}.SHA256SUM");
29+
then
30+
exit_if_error "Could not verify SHASUM. Please contact Codecov if problem continues"
31+
fi
32+
say "$g==>$x CLI integrity verified"
33+
say
2634
fi
27-
say "$g==>$x CLI integrity verified"
28-
say

scripts/version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
#!/usr/bin/env bash
2-
CODECOV_WRAPPER_VERSION="0.0.12"
2+
CODECOV_WRAPPER_VERSION="0.0.13"

0 commit comments

Comments
 (0)