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

#1

agits777

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

  • Members
  • 5 сообщений
  • ФИО:Alexander Gits

Отправлено 15 августа 2012 — 16:36

Пожалуйста помогите решить следующую пробlему.
Запускаю тест в Jenkins (Cucumber). В консоле вижу такое сообщение:

Started by user anonymous
Building on master in workspace C:\Users\Administrator\.jenkins\jobs\Prerogerscoupon_Functional_Test\workspace
[workspace] $ cmd /c call C:\Windows\TEMP\hudson4551767386326684001.bat

C:\Users\Administrator\.jenkins\jobs\Prerogerscoupon_Functional_Test\workspace>cd FunctionalTests

C:\Users\Administrator\.jenkins\jobs\Prerogerscoupon_Functional_Test\workspace\FunctionalTests>cucumber -t ~@previp -f html -o results.html
*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon) to get coloured output on Windows
Build step ‘Execute Windows batch command’ marked build as failure
Recording test results
Finished: FAILURE

Тест выполняется успешно, но Jenkins не помечает его как passed. Выдает ошибку выполнения.
в чем может быть проблема??

  • 0

  • Наверх


#2

dip

dip

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

  • Members
  • 14 сообщений
  • ФИО:Александр Богатов
  • Город:Домодедово

Отправлено 16 августа 2012 — 08:14

по результатам выполнения сборка будет считаться провалившейся, если сценарий выставит ненулевой %ERRORLEVEL%.

из аннотации к выполнению команды в консоли Windows. в данном случае есть варнинг, поэтому код возврата сценария не равен 0.

как вариант, можно попробовать выполнить к конце команду, которая вернёт 0. например:

cd ..

или же проверять на наличие варнинга и если не критично, присваивать 0 переменной ERRORLEVEL

IF ERRORLEVEL 1 SET ERRORLEVEL=0

  • 0

  • Наверх


Загрузка…

  • testomat.io управление авто тестами
  • Python
  • Реклама
  • Работа
  • Консультации
  • Обучение

An error is as follows:

Building in Workspace C: \ Windows \ System32 \ Config \ SystemProfile \ AppData \ Local \ Jenkins \ .jenkins \ Workspace \ Sales Order Double Tag - Coke
 [Sales Order Double Sign - Coke] $ CMD / C Call C: \ Windows \ Temp \ Jenkins16265249724103305523.bat

 C: \ windows \ system32 \ config \ systemprofile \ appdata \ local \ jenkins \ .jenkins \ Workspace \ Sales Order Double Tag - Coke> D:

 D: \> CD D: \ Interface Automation \ Sales Order Dual Sign " 

 D: \ Interface Automation \ Sales Order Dual Sign \ Coke> Newman Run D: \ Interface Automation \ Sales Order Dual Sign \ Coke \ Sales Order - Coke - Double Signing .postman_Collection.json-E D: \ Interface Automation \ Sales Order Double Sign \ Script Environment.postman_environment.json -d D: \ Interface Automation \ Sales Order Double Sign \ Sales. CSV -R HTMLEXTRA - REPORTER-HTMLEXTRA-EXPORT D: / Interface Automation / Sales Order Double Tag / Coke / Test Report / Report.html 
Using htmlextra version 1.22.3
Created the htmlextra report.
Build step 'Execute Windows batch command' marked build as failure
[htmlpublisher] Archiving HTML reports...
 [htmlpublisher] Archiving At Project Level D: / Interface Automation / Sales Order Double Tag / Coke / Test Report To C: \ Windows \ System32 \ Config \ SystemProfile \ AppData \ Local \ JENKINS \ .Jenkins \ Jobs \ Sales Order Double Tag - coke \ htmlreports \ HTML_20Report
Finished: FAILURE

reason:
Jenkins execute commands, generates a batch file execution, and the newman command is an external command for batch, so adding CALL to reply to the call. Jenkens executes the window command, if the exit code is not 0, Jenkins will mark the component as a failure, so it is necessary to add EXIT 0 to the execution completion exit.

Solution:
The build command plus Call in front of Newman, and finally add exit 0, as shown in the figure:

Распознавание голоса и речи на C#

UnmanagedCoder 05.05.2025

Интеграция голосового управления в приложения на C# стала намного доступнее благодаря развитию специализированных библиотек и API. При этом многие разработчики до сих пор считают голосовое управление. . .

Реализация своих итераторов в C++

NullReferenced 05.05.2025

Итераторы в C++ — это абстракция, которая связывает весь экосистему Стандартной Библиотеки Шаблонов (STL) в единое целое, позволяя алгоритмам работать с разнородными структурами данных без знания их. . .

Разработка собственного фреймворка для тестирования в C#

UnmanagedCoder 04.05.2025

C# довольно богат готовыми решениями – NUnit, xUnit, MSTest уже давно стали своеобразными динозаврами индустрии. Однако, как и любой динозавр, они не всегда могут протиснуться в узкие коридоры. . .

Распределенная трассировка в Java с помощью OpenTelemetry

Javaican 04.05.2025

Микросервисная архитектура стала краеугольным камнем современной разработки, но вместе с ней пришла и головная боль, знакомая многим — отслеживание прохождения запросов через лабиринт взаимосвязанных. . .

Шаблоны обнаружения сервисов в Kubernetes

Mr. Docker 04.05.2025

Современные Kubernetes-инфраструктуры сталкиваются с серьёзными вызовами. Развертывание в нескольких регионах и облаках одновременно, необходимость обеспечения низкой задержки для глобально. . .

Создаем SPA на C# и Blazor

stackOverflow 04.05.2025

Мир веб-разработки за последние десять лет претерпел коллосальные изменения. Переход от традиционных многостраничных сайтов к одностраничным приложениям (Single Page Applications, SPA) — это. . .

Реализация шаблонов проектирования GoF на C++

NullReferenced 04.05.2025

«Банда четырёх» (Gang of Four или GoF) — Эрих Гамма, Ричард Хелм, Ральф Джонсон и Джон Влиссидес — в 1994 году сформировали канон шаблонов, который выдержал проверку временем. И хотя C++ претерпел. . .

C# и сети: Сокеты, gRPC и SignalR

UnmanagedCoder 04.05.2025

Сетевые технологии не стоят на месте, а вместе с ними эволюционируют и инструменты разработки. В . NET появилось множество решений — от низкоуровневых сокетов, позволяющих управлять каждым байтом. . .

Создание микросервисов с Domain-Driven Design

ArchitectMsa 04.05.2025

Архитектура микросервисов за последние годы превратилась в мощный архитектурный подход, который позволяет разрабатывать гибкие, масштабируемые и устойчивые системы. А если добавить сюда ещё и. . .

Многопоточность в C++: Современные техники C++26

bytestream 04.05.2025

C++ долго жил по принципу «один поток — одна задача» — как старательный солдатик, выполняющий команды одну за другой. В то время, когда процессоры уже обзавелись несколькими ядрами, этот подход стал. . .

bearrito

unread,

Aug 9, 2012, 9:59:09 PM8/9/12

to jenkins…@googlegroups.com

Jenkins will randomly not execute batch files as part of the build.

In the failing case I get a message like :

18:01:43  C:\JenkinsHome\Slave\workspace\Job1>exit 2 
18:01:44  Build step 'Execute Windows batch command' marked build as failure

In the successful case I get 

11:40:37  C:\JenkinsHome\Slave\workspace\Job1l>exit 0 
11:40:37  [SrcInfrastructureYellowSql] $ powershell.exe "& 'C:\Users\#Jenkins\AppData\Local\Temp\hudson5725866031798325048.ps1'"
11:40:53  [SrcInfrastructureYellowSql] $ cmd /c call C:\Users\#Jenkins\AppData\Local\Temp\hudson2668871926239131897.bat
11:40:53  
11:40:53  C:\JenkinsHome\Slave\workspace\Job1>powershell.exe "& {C:\JenkinsHome\Slave\workspace\Job1\Job2\script.ps1; exit $lastexitcode}"

It seems as though the powershell session is not able to be started? 
Any hints on this?


Sami Tikka

unread,

Aug 10, 2012, 1:49:15 AM8/10/12

to jenkins…@googlegroups.com

This is just a wild guess because I do not use windows: Could it be Jenkins aborts the build when it sees the «exit 2» ?

For Linux and Mac versions of Jenkins it is a sign of failure when a build script exits with non-zero exit code.

— Sami

j.barrett strausser

unread,

Aug 10, 2012, 6:04:05 AM8/10/12

to jenkins…@googlegroups.com

That’s absolutely the reason it is being marked as failure. Jenkins interprets non-zero codes as failure. The question is why it exits with 2 to begin with. 

The batch file is just wrapping a call to powershell but when it fails it appears to never even make the call to poweshell.

Scott Evans

unread,

Aug 10, 2012, 7:10:27 AM8/10/12

to jenkins…@googlegroups.com

Just a thought — are the successes and failures both running on the

same agent box? If not, then perhaps one is configured differently

than the other.

Scott

j.barrett strausser

unread,

Aug 10, 2012, 7:21:12 AM8/10/12

to jenkins…@googlegroups.com

Same box. A failed build tends to be followed by a successful build. Hence, I was thinking making there is some resource contention taking place. 

Again from my log snippet I really feel there is an issue spawning the powershell session.

-barrett

Scott Evans

unread,

Aug 10, 2012, 7:48:19 AM8/10/12

to jenkins…@googlegroups.com

Grasping at straws here late at night —

1. Do you have multiple builds running in separate agents at the same

time, or just one agent active? Do you have anything else running

that might be using powershell at the same time? I’ve not used it so

I don’t know how it works if you try and spawn multiple powershell

sessions at the same time.

2. It looks like you’re calling

C:\JenkinsHome\Slave\workspace\Job1\Job2\script.ps1 in a successful

run. Does that file/path exist in situations when it fails? It seems

a bit odd that it’s Job1\Job2 in the path, but perhaps that is as

intended.

3. Is there anything within the powershell script itself (script.ps1)

that might be returning an exit code of 2? By default, from what

Google is telling me, powershell defaults to returning either 0

(success) or 1 (failure). Unless I’m not finding accurate information

(which is entirely possible), I’m wondering if something else is

kicking it to a 2 exit code other than powershell itself.

-Scott

On Thu, Aug 9, 2012 at 10:21 PM, j.barrett strausser

j.barrett strausser

unread,

Aug 10, 2012, 5:38:47 PM8/10/12

to jenkins…@googlegroups.com

1. There is a single executor running on the machine. There is no issue with multiple powershell sessions at the same time. It just creates a new powershell process.

2.That path exists even when the script fails. 

3. There isn’t anything in the script that returns 2. The way that I structure my powershell is to catch an unhandled exceptions in the outermost catch I will set an exit code that is quite high, say 1500, I’ll return this as last exit code.

-barrett

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Как узнать дату смены пароля windows
  • Как уменьшить звук в приложении windows 10
  • Ovpn windows 10 настройка
  • Ошибка 0x000011b windows 7
  • Для чего служит буфер обмена windows