Stop nolio deployment on command line script fail - devops

I've tried to search for this but i couldn't fine anything. I have a Nolio flow that has a command line action to deploy a solution with psake. The command line is run like this:
psake.cmd .\deploy.ps1 -parameters #{env='Environment'} if ($psake.build_success -eq $false) { exit 1 } else { exit 0 }
But if the script deploy.ps1 fails the nolio deployments hangs and need to be stopped manually.
Is there a way to make the deployment stop automatically when the script fails?

I found a solution for this. Nolio offers an action called "ROC - Fail Deployment Step". I achieved what i wanted by deselecting the pause on failure and adding this action after the script execution and setting the operation on link to "On failed"

Related

For Kubernetes pods how to find cause of exit code 2

I have pods that are of kind Cronjob running in parallel. They complete task and run again after fixed interval of 20 minutes as per cron expression. I noticed that some pods are restarting 2-3 times before completing task.
I checked details in kubectl describe pod command and found that pod exit code 2 when it restart due to some error:
Last State: Terminated
Reason: Error
Exit Code: 2
I searched about exit code 2 and found that it is misuse of a shell builtin commands. How I can find which shell builtin is misused. How to debug cause of exit code 2.
Thanks in advance.
An exit code of 2 indicates either that the application chose to return that error code, or (by convention) there was a misuse of a shell built-in. Check your pod’s command specification to ensure that the command is correct. If you think it is correct, try running the image locally with a shell and run the command directly.
Refer to this link for more information.
You can get logs with
kubectl logs my-pod
Post output here if you can't fix it.

Codeship marks the test as "failed" even when there is no error

I have some rails-cucumber tests, all looks fine but CS says the test suite failed:
I didn't set "--strict" in the command line.
You'll want to investigate why it is that your process might be returning a non-zero exit code. The recommendation here is to hop into an ssh debug for your build and verify that each step is returning a zero exit code:
echo $?

How to kill travis build with exit code 0 using command?

Presently we are facing build failure problem in Travis because of https://github.com/travis-ci/travis-ci/issues/7702. I was just wondering if Travis has any command line option to kill it with exit code 0, then I can force travis to terminate 'after_success'. Will be a hacky way to deal with this situation until they solve this bug.
The shell function travis_terminate will help.
Alternatively, you can ensure to do set +e before the call to exit.
travis_terminate 0 is the best solution at the moment.

How to find output of shell command run by fastlane action?

Sometimes it happens that a fastlane action throws an error like:
ERROR [2016-11-06 03:34:20.16]: Shell command exited with exit status 48 instead of 0.
I found troubleshooting difficult, as --verbose is not not verbose enough. By action I don't mean sh action, which is rather special case, but other fastlane actions e.g. create_keychain. The action create_keychain calls shell command security create-keychain and when it fails there is no clue what happened.
How do I find output of a shell command run by fastlane's action?
How do I find what shell command including all parameters is fastlane actually trying to run?
The output of the shell command is printed out by default when you use the sh action. Alternatively you can also run the shell command directly yourself using backticks (standard Ruby)
puts `ls`
The answer is that there is no such option at the moment, but it should be easy to add it.
I have created git issue #6878 for it.

How to make Jenkins job success on specific error exit code other than 0?

I was trying to install a plugin through jenkins job. When it goes for restart , the exit code is 1641. But the installation is successful. So I want to make the build successful.
I am using "setup.exe /qb /log C:\installer.log /r:f" this command for silent install and force restart.
How can I mark the build successful
Jenkins will exit with the result of the last command. You just need to catch it and tell Jenkins how to exit.
Linux - RESULT=$?
Windows - set RESULT=%ERRORLEVEL%
After catching the command's result, you can put an if on it to decide how to exit.
Linux - if [ $RESULT -eq 1641 ]; then exit 0; fi
Windows - if %RESULT% EQ 1641 exit 0
I hope this helps.

Resources