I am using travis for building my project. I am having a deploy script something like below,
deploy:
provider: script
script:
- npm run deploy
- npm run test:deploy-results
skip-cleanup: true
on:
branch: build
Here is how the npm script in package.json
looks like,
"test:deploy-results": "node ./scripts/deploy-test-reports.js",
Travis is failing with status code 127. I tried to find some info but couldn't get any.
I am using travis for building my project. I am having a deploy script something like below,
deploy:
provider: script
script:
- npm run deploy
- npm run test:deploy-results
skip-cleanup: true
on:
branch: build
Here is how the npm script in package.json
looks like,
"test:deploy-results": "node ./scripts/deploy-test-reports.js",
Travis is failing with status code 127. I tried to find some info but couldn't get any.
Share Improve this question edited Apr 27, 2018 at 17:17 Sivasankar asked Apr 27, 2018 at 9:04 SivasankarSivasankar 8039 silver badges22 bronze badges3 Answers
Reset to default 3If you want to execute multiple scripts, you can also bundle them in a single shell script (like scripts/deploy.sh
) and execute this one in your deploy step:
.travis.yml
deploy:
provider: script
script: bash scripts/deploy.sh
on:
branch: master
scripts/deploy.sh
#!/bin/bash
echo 'Hello'
echo 'World'
It is equivalent to:
.travis.yml
deploy:
- provider: script
script: echo 'Hello'
on:
branch: master
- provider: script
skip_cleanup: true
script: echo 'World'
on:
branch: master
Tip: Make sure to use LF line endings in the shell script, otherwise you will receive this error:
scripts/deploy.sh: line 2: $'\r': mand not found
Happens often with Windows systems because they use CRLF line endings.
After reading more, I figured it out that it is a Linux error code for not able to find the interpreter/piler or missing executable.
Also, I need to add multiple deploy provider for executing multiple scripts in .travis.yml
like below
deploy:
skip_cleanup: true
# Publish docs
provider: script
script: npm run test:deploy-results
on:
branch: build
# Test reports
provider: script
script: npm run test:deploy-results
on:
branch: build
I got this because I was using a script that was not executable by Travis. Changing the permissions before executing solved it for me.
Something like this:
script: chmod +x scripts/deploy.sh && scripts/deploy.sh