First things first, hover the mouse over the grey area below. Not part of the answer, but absolutely has to be said: Show
The short answer is: the exit code of last command of the Jenkin's Execute Shell build step is what determines the success/failure of the Build Step. You've mentioned Finally, have a read here Jenkins Build Script exits after Google Test execution. It is not directly related to your question, but note that part about Jenkins launching the Execute Shell build step, as a shell script with The To circumvent this, add Since you say your script does all it is supposed to do, chances are the failing command is somewhere at the end of the script. Maybe a final echo? Or copy of artifacts somewhere? Without seeing the full console output, we are just guessing. Please post the job run's console output, and preferably the shell script itself too, and then we could tell you exactly which line is failing. View Image Modify configure explain in detailWhen running the script when Jenkins builds an error: Build step'Execute shell' marked build as failure Note 1: #! is a special indicator, which means the shell path to explain this script. How do I run a shell in Jenkins?Your answer. Create a freestyle project on Jenkins.. Use the advanced configuration page to use custom workspace.. Add the path to your shell script.. Under the build step, select "execute shell". Finally, enter the name of your shell script and click on save and execute it.. How do you mark as fail in Jenkins?The default setting in Jenkins is to mark a job yellow, when a Maven build fails because of failing tests.. Go to Manage Jenkins -> Manage system.. Add -Dmaven. test. failure. ... . Save this change and that's it.. What does #!/ Bin sh do?#!/bin/sh: It is used to execute the file using sh, which is a Bourne shell, or a compatible shell. #!/bin/csh: It is used to execute the file using csh, the C shell, or a compatible shell. #!/usr/bin/perl -T: It is used to execute using Perl with the option for taint checks.
Why do we use #!/ Bin bash in the beginning of a script?#!/bin/bash
Essentially it tells your terminal that when you run the script it should use bash to execute it. It can be vital since you may be using a different shell in your machine ( zsh , fish , sh , etc.), but you designed the script to work specifically with bash.
|