test-reporter icon indicating copy to clipboard operation
test-reporter copied to clipboard

Fetching the test reporter and calling `before-build` is failing again

Open sprasad09 opened this issue 5 years ago • 3 comments

Hi Folks,

We are experiencing this issue again. This issue was originally posted here: Originally posted by @efueger in https://github.com/codeclimate/test-reporter/issues/396#issuecomment-490982319

We have a dockerfile (actually over 100) with these lines

# Fetch code climate binary
RUN curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
RUN chmod +x ./cc-test-reporter
# Notify code climate a build is starting
RUN ./cc-test-reporter before-build
RUN npm run lint && npm run test-coverage

I'm all of a sudden getting this error when trying to deploy my app.

Step 18/35 : RUN ./cc-test-reporter before-build
---> Running in 7c747687630e
./cc-test-reporter: line 1: can't open html: no such file
./cc-test-reporter: line 2: syntax error: unexpected redirection
The command '/bin/sh -c ./cc-test-reporter before-build' returned a non-zero code: 2
make: *** [build] Error 2

Could you please look into this again. This is blocker for devs right now.

sprasad09 avatar Jan 24 '20 22:01 sprasad09

@sprasad09 was this resolved for you? I just ran into the same issue.

TheHenrick avatar Mar 02 '22 22:03 TheHenrick

We hit the same issue. The HTTP call in the CURL command is failing, and your ./cc-test-reporter binary file will actually just contain HTML text.

To fix - rebuild your image, and probably add some error checking.

So instead of getting the binary file, running cat ./cc-test-reporter will show-

<html>
<head><title>503 Service Temporarily Unavailable</title></head>
<body>
<center><h1>503 Service Temporarily Unavailable</h1></center>
</body>
</html>

If you saved this text into a different file, and marked the file as executable, what would happen if you executed it?

~ % chmod 755 my-html-binary
~ % ./my-html-binary
./20220303test: line 1: syntax error near unexpected token `newline'
./20220303test: line 1: `<html>'

patmacpherson-sc avatar Mar 03 '22 10:03 patmacpherson-sc