I am new in writing pipelines, below is the job which I am trying to run
test website:
image: node
stage: test
script:
- npm i
- npm i -g gatsby-cli
- gatsby serve &
- sleep 3
- curl "http://localhost:9000" | grep -q "Gatsby"
But it failed at the very last step which below log
gatsby serve &
$ sleep 3
$ curl "http://localhost:9000" | grep -q "Gatsby"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 9000: Connection refused
ERROR: Job failed: exit code 1
Please help me to resolve this, also help me in understanding the mistake.
The error message means that nothing is running on localhost:9000. Check that your application is actually configured to run on port 9000 and if so, try to defer your curl request for a few seconds to allow the application to initialize.