简体   繁体   English

运行自由式Maven-Gatling项目时Jenkins作业失败

[英]Jenkins job failure when running a freestyle maven-gatling project

I have created a gatling maven based application; 我创建了一个基于gatling的Maven应用程序; wrote some actions, scenario and able to successfully run them locally in IDE using $mvn gatling:test to build project and view the gatling reports. 编写了一些操作,方案,并能够使用$mvn gatling:test在IDE中本地成功运行它们,以构建项目并查看gatling报告。

Now I'm trying to have a jenkins job configured to automate this however using the same command in bash script is failing with : 现在,我正在尝试配置一个jenkins作业以使其自动化,但是在bash脚本中使用相同的命令失败:

Build step 'Execute shell' marked build as failure
Archiving Gatling reports...
Could not find a Gatling report in results folder.

My pom.xml is same as : https://github.com/gatling/gatling-maven-plugin-demo/blob/master/pom.xml except i also tried to add: 我的pom.xml与: https : //github.com/gatling/gatling-maven-plugin-demo/blob/master/pom.xml相同,但我也尝试添加:

<configuration>
 <resultsFolder>/jenkinsworkspace/projectName/target/gatling</resultsFolder>
</configuration>

pom.xml: pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>io.gatling</groupId>
  <artifactId>project-id</artifactId>
  <version>3.1.2</version>

  <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <gatling.version>${project.version}</gatling.version>
    <gatling-plugin.version>3.0.1</gatling-plugin.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.gatling.highcharts</groupId>
      <artifactId>gatling-charts-highcharts</artifactId>
      <version>${gatling.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>io.gatling</groupId>
        <artifactId>gatling-maven-plugin</artifactId>
        <version>${gatling-plugin.version}</version>
      </plugin>
    </plugins>
  </build>

</project>

Firstly, Do I need to use a Maven jenkins project type instead of a freestyle project? 首先,我是否需要使用Maven jenkins项目类型而不是自由式项目?

Secondly, from testing in local my gatling reports are generated in target folder in the project structure on every execution. 其次,根据本地测试,每次执行时,我的整理报告都会在项目结构的目标文件夹中生成。 And in my repo I have ignored this folder (in .gitignore) so is that the reason of not being able to find in workspace when ran the job? 在我的仓库中,我已经忽略了该文件夹(.gitignore中的文件夹),是因为执行该作业时无法在工作空间中找到它的原因?

Not sure if its something wrong with either the maven command I'm using in execute shell Build step or is my pom.xml wrong. 不知道我在执行外壳构建步骤中使用的maven命令是否有问题,或者我的pom.xml是否有问题。

From jenkins console output, it seems to download all the maven dependencies mentioned in pom.xml but then results in build failure. 从jenkins控制台输出中,似乎下载了pom.xml中提到的所有Maven依赖项,但随后导致构建失败。 I'm new to this, kindly provide any suggestions and help. 我是新手,请提供任何建议和帮助。

I'm not sure how this can be fixed on a freestyle project but I'm sure a Gatling-Maven project works with a pipeline job. 我不确定如何在自由式项目中解决此问题,但是我确定Gatling-Maven项目可与管道作业一起使用。 See a detailed description here: how to integrate gatling with jenkins 在此处查看详细说明: 如何将加特林与詹金斯集成

As for the reports, you have to install the Gatling plugin on Jenkins. 至于报告,您必须在Jenkins上安装Gatling插件 This adds a Gatling option to the menu bar on the left where the reports are listed from all the previous builds. 这会将“ Gatling选项添加到左侧菜单栏中,该菜单栏中列出了所有先前版本的报告。 It also shows some build statistics on graphs, which is nice. 它还在图形上显示了一些构建统计信息,这很不错。 However, the reports are not portable (or at least I didn't find a way to download and zip all the source files as I would with the local report folder). 但是,报告不是可移植的(或者至少我找不到像使用本地报告文件夹那样下载和压缩所有源文件的方法)。

Created a new free style job in jenkins and configured the Build step as: put the Root POM as pom.xml , in Goals and options gatling:test 在jenkins中创建了一个新的自由样式作业,并将Build步骤配置为:在目标和选项gatling:test中将Root POM放置为pom.xml

Also enabled simulation tracking 还启用了simulation tracking

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我们在 Jenkins 中构建任何自由式项目时,Maven 会出现在后台吗? - When we build any freestyle project in Jenkins, does Maven comes into picture in the background? Maven项目运行时发生构建失败 - A build failure occurs when a maven project is running Jenkins 运行 Maven 作业时的多配置传递参数 - Jenkins multi configuration passing parameters when running Maven job 詹金斯(Jenkins):在项目发布时运行工作(通过执行Maven发布) - Jenkins: run the job when the project was released( by performing a maven release) 通过maven安装运行项目时构建失败 - Build Failure when running the Project through maven install 如何在jenkins的自由式项目中添加.m2存储库jar或maven依赖罐? - How can I add .m2 repository jars or maven dependency jars in a freestyle project in jenkins? 当Gatling负载测试表现不佳时,如何让jenkins工作失败 - How to bring jenkins job to fail when Gatling load tests underperform Jenkins / Maven工作 - 两次运行测试套件? - Jenkins/Maven job - running the test suite twice? 使用不同的 maven 并行运行 Jenkins 作业 - Running Jenkins job with different maven opts in parallel 从jenkins Freestyle项目部署工件 - Deploy Artifacts from jenkins Freestyle project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM