Jenkins build step выполнить команду windows marked build as failure

Below are three PowerShell Commands run in Jenkins and the build result. Why it fails? Which command could be failing? I've read this post: How/When does Execute Shell mark a build as failure in Je...

The answer is sort of in the post you linked.

the exit code of last command of the Jenkin’s Execute Shell build step is what determines the success/failure of the Build Step

I get that you understand that much, but what makes it come into play is the return code for robocopy which was you last command. While the link is for server 2008 I won’t be surprised if they are OS common.

Value   Description
0       No files were copied. No failure was encountered. No files were mismatched. The files already exist in the destination directory; therefore, the copy operation was skipped.
1       All files were copied successfully.

If all the files were copied successfully then the return code is 1. Anything other than 0 is reported as a failure by the build step as we have read in the linked question.


I think what you need to do is check the return code of robocopy and change it.

To check it you need to look at a PowerShell automatic variable $?

$?
Contains the execution status of the last operation. It contains
TRUE if the last operation succeeded and FALSE if it failed.

So the last couple of lines could be…

ROBOCOPY "$env:WORKSPACEETLProject Type 0binDEFAULT" "$outputdir" /E /v
If($?){exit 0}

What this should do is take any non zero result from robocopy and force the script to return true. Again, be aware that this would return OK for all return codes. If this is not desirable then you could easily build some logic for certain codes.

I cannot really test this code as I do not have your environment but in theory it should work or at least get you started on where you need to be.

Asked
6 years, 2 months ago

Viewed
6k times

Hy everyone!

In Jenkins when i try to build my job I run a batch command before robocopy /mir pathSource pathDest in tn Configue->Build of my job. But when he executes the command, he stops without run the build.xml. So he prints this just after the command batch before stopping :

16:47:25    Ended : Mon Nov 07 16:47:25 2016
16:47:25 
16:47:25 c:jenkins_slaveworkspace********>exit 1 
16:47:25 Build step 'Execute Windows batch command' marked build as failure
16:47:26 Sending e-mail to: *********** (launcher, owner).
16:47:26 Notifying upstream projects of job completion
16:47:26 Finished: FAILURE

How can I fix this please?

asked Nov 7, 2016 at 16:09

1

Robocopy have different return codes and error levels which indicates the status of the copy. short version — you can exit 0.
Long version — run the following:

Robocopy SOURCE DEST /e /np /R:5 /mt:64 /XD IGNORE

if errorlevel 16 echo ***FATAL ERROR*** & goto endError
if errorlevel 15 echo FAIL MISM XTRA COPY & goto endError
if errorlevel 14 echo FAIL MISM XTRA & goto endError
if errorlevel 13 echo FAIL MISM COPY & goto endError
if errorlevel 12 echo FAIL MISM & goto endError
if errorlevel 11 echo FAIL XTRA COPY & goto endError
if errorlevel 10 echo FAIL XTRA & goto endError
if errorlevel 9 echo FAIL COPY & goto endError
if errorlevel 8 echo FAIL & goto endError
if errorlevel 7 echo MISM XTRA COPY & goto endError
if errorlevel 6 echo MISM XTRA & goto endError
if errorlevel 5 echo MISM COPY & goto endError
if errorlevel 4 echo MISM & goto endError
if errorlevel 3 echo XTRA COPY & goto endSuccess
if errorlevel 2 echo XTRA & goto endSuccess
if errorlevel 1 echo COPY & goto endSuccess
if errorlevel 0 echo –no change– & goto endSuccess

:endSuccess
exit 0
:endError
exit 1

Good luck!

answered Nov 7, 2016 at 17:10

Dvir669's user avatar

Dvir669Dvir669

5,7671 gold badge19 silver badges21 bronze badges

2

Asked
6 years, 2 months ago

Viewed
6k times

Hy everyone!

In Jenkins when i try to build my job I run a batch command before robocopy /mir pathSource pathDest in tn Configue->Build of my job. But when he executes the command, he stops without run the build.xml. So he prints this just after the command batch before stopping :

16:47:25    Ended : Mon Nov 07 16:47:25 2016
16:47:25 
16:47:25 c:jenkins_slaveworkspace********>exit 1 
16:47:25 Build step 'Execute Windows batch command' marked build as failure
16:47:26 Sending e-mail to: *********** (launcher, owner).
16:47:26 Notifying upstream projects of job completion
16:47:26 Finished: FAILURE

How can I fix this please?

asked Nov 7, 2016 at 16:09

1

Robocopy have different return codes and error levels which indicates the status of the copy. short version — you can exit 0.
Long version — run the following:

Robocopy SOURCE DEST /e /np /R:5 /mt:64 /XD IGNORE

if errorlevel 16 echo ***FATAL ERROR*** & goto endError
if errorlevel 15 echo FAIL MISM XTRA COPY & goto endError
if errorlevel 14 echo FAIL MISM XTRA & goto endError
if errorlevel 13 echo FAIL MISM COPY & goto endError
if errorlevel 12 echo FAIL MISM & goto endError
if errorlevel 11 echo FAIL XTRA COPY & goto endError
if errorlevel 10 echo FAIL XTRA & goto endError
if errorlevel 9 echo FAIL COPY & goto endError
if errorlevel 8 echo FAIL & goto endError
if errorlevel 7 echo MISM XTRA COPY & goto endError
if errorlevel 6 echo MISM XTRA & goto endError
if errorlevel 5 echo MISM COPY & goto endError
if errorlevel 4 echo MISM & goto endError
if errorlevel 3 echo XTRA COPY & goto endSuccess
if errorlevel 2 echo XTRA & goto endSuccess
if errorlevel 1 echo COPY & goto endSuccess
if errorlevel 0 echo –no change– & goto endSuccess

:endSuccess
exit 0
:endError
exit 1

Good luck!

answered Nov 7, 2016 at 17:10

Dvir669's user avatar

Dvir669Dvir669

5,7671 gold badge19 silver badges21 bronze badges

2

Your problem is running gems inside jenkins build .. Differences on the environment are producing this . Try to first make sure you can run gems from jenkins build than you will have no problems with fastlane …

Actually this is not a fastlane issue . It is a problem with your jenkins configuration .

In my video on youtube i’ve started jenkins from the cmd line , so once it loads it has access to the same paths and vars that my command line does I dont know if you are starting it from a daemon or other way ..

But again i would search for that before anything else ..

Sent from my iPhone

On Jan 27, 2016, at 8:12 AM, uthen sorsiang notifications@github.com wrote:

build result on terminal:

fastlane build_for_test_Jenkins

[17:11:00]: Setting Provisioning Profile type to ‘app-store’

+——+————————————-+————-+
| fastlane summary |
+——+————————————-+————-+
| Step | Action | Time (in s) |
+——+————————————-+————-+
| 1 | Verifying required fastlane version | 0 |
| 2 | default_platform | 0 |
| 3 | cert | 10 |
| 4 | sigh | 13 |
+——+————————————-+————-+

[17:11:00]: fastlane.tools finished successfully 🎉


Reply to this email directly or view it on GitHub.

  • Remove From My Forums
  • Question

  • User330586 posted

    I am working on Mac machine. I have installed jenkin with docker using following docker run -p 8080:8080 jenkinsci/blueocean

    I am able to set up jenkin. I am trying to build Xamarin form project.
    I have followed steps for building Xamarin.Ios project from following link: https://docs.microsoft.com/en-us/xamarin/tools/ci/jenkins-walkthrough

    I have set Add MSBuild step through Global Tool Configuration option as:

    /Library/Frameworks/Mono.framework/Versions/5.16.0/bin/xbuild.exe

    For Xamarin.ios build, I have given following command through option: Add Build Step

    xbuild /p:Configuration=»Release»
    /p:Platform=»iPhone»
    /p:IpaPackageDir=»$HOME/Builds»
    /t:Build XamarinSampleCI.sln

    Then I am trying to build project manually by click on button Build Now.
    But build is getting failed getting following error:

    • xbuild ‘/p:Configuration=Release’ ‘ ‘
      /tmp/jenkins1794719331410690610.sh: line 1: xbuild: not found
      Build step ‘Execute shell’ marked build as failure
      Finished: FAILURE

    please help.
    Thanks in advance.

#1

katrina

    Новый участник

  • Members
  • Pip

  • 11 сообщений
  • ФИО:Катрина

Отправлено 23 апреля 2012 — 14:54

Добрый вечер!
Jenkins вижу впервые и у меня есть такая проблема… Jenkins установлен на windows 7. Хочу запустить тест на phpunit. Для этого выбираю «Выполнить команду windows». Прописываю там:
C:Userswebserversusrlocalphp5phpunit C:Userswebserversusrlocalphp5unit

Запускаю. Получаю ответ:

Started by user anonymous
Building in workspace C:Program Files (x86)Jenkinsworkspacemy_test
[my_test] $ cmd /c call C:WindowsTEMPhudson2314888094495222091.bat

C:Program Files (x86)Jenkinsworkspacemy_test>C:Userswebserversusrlocalphp5phpunit C:Userswebserversusrlocalphp5unit 
‘Ёб⥬Ґ ­Ґ г¤ Ґвбп ­ ©вЁ гЄ § ­­л© Їгвм.
Build step 'Выполнить команду Windows' marked build as failure
Finished: FAILURE

Не могу понять,почему он пишет, что системе ­не удается ­найти указанный путь, потому что если это же выполняю из cmd.exe, то тест успешно запускается.
Подскажите, пожалуйста, как надо делать?

  • 0

  • Наверх

Понравилась статья? Поделить с друзьями:
  • Jedi knight dark forces 2 windows 10
  • Jedi knight 2 jedi outcast windows 10
  • Jitdebugging установленное в секции system windows forms
  • Jedi academy вылетает при запуске windows 10
  • Jdk скачать для windows для слабых компьютеров