Comments (11)
I can't find the exact issue as I was searching on the CD pipeline, maybe I executed it from my local machine. As I remembered it, it's just a normal npm install
(Nodejs stuff) that got a timeout error, and I also remembered that I put the --any-errors-fatal
flag.
But I will surely create a repro over the weekend if that's okay.
from sake.
Or maybe you should add an option whether to exit with code 1 or equal to the error code returned by the task. I guess providing both options would be a better way to put things.
from sake.
There's the flag any-errors-fatal
and config spec setting any_errors_fatal
that you can enable to stop task execution on all servers when exit code is non-zero. But perhaps, you mean the output of sake
is sent to stdout instead of stderr?
Could you copy your command's actual and wanted output and relevant config settings/tasks?
from sake.
Just to clarify, it should fail on non-zero exit already, if the setting any-errors-fatal is set. So, could be there's a bug, but I tried with a simple script and it seemed to work as intended:
$ go run ../../main.go run lala -t pihole --any-errors-fatal=false
TASK [lala]
172.24.2.3 | 123
172.24.2.3 | Process exited with status 1
TASK [lala]
172.24.2.3 | 123
172.24.2.3 | Process exited with status 1
$ go run ../../main.go run lala -t pihole --any-errors-fatal=true
TASK [lala]
172.24.2.3 | 123
172.24.2.3 | Process exited with status 1
lala:
cmd: |
echo 123
exit 1
from sake.
Sorry it took a while. I ran it on the CD server with the sake configuration as:
pull_master:
desc: Pull from the master branch
cmd: |
git remote set-url origin https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/some-organization/some-repository.git
git pull
git remote set-url origin https://github.com/some-organization/some-repository.git
work_dir: /home/user/some-repository
env:
GIT_USERNAME: $(echo $GIT_USERNAME)
GIT_PASSWORD: $(echo $GIT_PASSWORD)
DEBIAN_FRONTEND: noninteractive
The CD results is (the first line is the command I executed):
Run yes | sake run pull_master --servers onpremise -i /root/.ssh/id_ed25519 --known-hosts-file /root/.ssh/known_hosts --any-errors-fatal
Unknown Host: ***:22
Fingerprint: <redacted>
Would you like to add it? type (y)es or (n)o:
TASK [pull_master: Pull from the master branch]
*** | error: No such remote 'origin'
*** | There is no tracking information for the current branch.
*** | Please specify which branch you want to merge with.
*** | See git-pull(1) for details.
*** |
*** | git pull <remote> <branch>
*** |
*** | If you wish to set tracking information for this branch you can do so with:
*** |
*** | git branch --set-upstream-to=<remote>/<branch> master
*** |
*** | Process exited with status 2
*** | error: No such remote 'origin'
from sake.
Thanks for finding the bug, the issue is that the exit code for sake
is 0, even if the tasks have a different exit code.
The simplest solution is to exit with code 1 if there's an error with the task execution, which I'll add.
from sake.
Hi @alajmo
I want to know if there are any progress to this particular issue. If you don't have time to work on this one, I might be able to submit a PR later this weekend.
from sake.
I was on vacation but I got back yesterday so will most likely solve it tonight (I did find the responsible code and it should be an easy fix).
from sake.
from sake.
Fix should be working now for release v0.10.2, the following changes are included:
- If a task fails, then return the last exit code from said task iff
--any-errors-fatal=true
, otherwise the exit code will be 0 - If a host is unreachable and
--ignore-unreachable=false
, return error code4
Note, it only outputs correct exit code for serial host execution (since there's some additional work needed for parallel execution, like what if multiple hosts have different exit codes).
from sake.
Thank you! I will test it right away.
from sake.
Related Issues (20)
- Configuration handling HOT 2
- Too many authentication failures when defining lots of servers HOT 2
- How do you pronounce sake? HOT 3
- How can a task pass a value to next task HOT 4
- error: strconv.ParseInt: parsing "": invalid syntax HOT 7
- Option to disable "Running" output HOT 1
- Sake vs Ansible? HOT 4
- Port out of range error when used in host string HOT 2
- Outdated docs and NPE when formatting table headers HOT 2
- Can't access libvirt hosts via dns name HOT 11
- Is there a way to specify an alternative user for ssh via flag? HOT 2
- Workdir for remote is being used by `local: true` task HOT 1
- ssh: handshake failed HOT 7
- Distinguish servers by server-name, port and user in output HOT 3
- Exec command with single quotes HOT 4
- Multiple bastions HOT 2
- Bug when using sake with .ssh/config HOT 3
- Usage with sudo? HOT 1
- Bug ssh: handshake failed: ssh: unable to authenticate HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sake.