0

I have the following Codecov script (which works fine) but i'm trying to add a CHECKSUM check to the script line.

given the script:

bash <(curl https://codecov.io/bash) -s './CodeCoverageResults/' -f '*.xml' -Z -t <redacted>

I wish to now add the checksum check which they suggested in their docs:

curl https://codecov.io/bash | shasum -a 512 codecov
// Codecov provides SHA1, SHA256, and SHA512 hashes

So i'm not sure how to do this.

I tried:

bash <(curl https://codecov.io/bash | shasum -a 512 codecov) -s './CodeCover..... and that didn't work.

Any suggestions?

Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
  • Possible duplicate [Why does cURL return error “(23) Failed writing body”?](https://stackoverflow.com/questions/16703647/why-does-curl-return-error-23-failed-writing-body) – 0stone0 Apr 20 '21 at 13:56
  • 1
    I'd recommend not using `bash <()` but calling curl, compare checksum and then pipe to bash – 0stone0 Apr 20 '21 at 14:02

1 Answers1

2

Tom from Codecov here. This was an error in our docs and it should read

curl https://codecov.io/bash | shasum -a 512

Apologies for the inconvenience, and I've updated the docs.

Thomas Hu
  • 141
  • 5
  • Thanks @thomasHu for the update. To clarify, does this mean i *only* have to do the following to download _and verify_ the file: `bash <(curl https://codecov.io/bash | shasum -a 512) -s './CodeCoverageResults/' -f '*.xml' -Z -t ` ? or is that just ONE step and i need more? – Pure.Krome Apr 20 '21 at 14:20
  • @Pure.Krome : The stdout of `shasum` is not bash code, but a checksum. You can't feed it into bash. Also, you try to pass options `-s`, `-Z` and `t` to bash. This does not make sense either. – user1934428 Apr 20 '21 at 14:32
  • Okay - i have no idea how to do any of this. Can the docs please be updated to include a full example, with what we would put into a CI file, please? – Pure.Krome Apr 20 '21 at 14:50
  • 1
    @Pure.Krome I'll write up a tutorial on how to do this in the next few days, sorry that this has been challenging. – Thomas Hu Apr 21 '21 at 17:07
  • 1
    @Pure.Krome apologies for the delay here. We updated the docs and posted an example here: https://about.codecov.io/blog/validating-the-bash-script-on-ci/. Let me know if that works for you. – Thomas Hu May 05 '21 at 16:57