<p>You should add export script (bash script which does exporting html files produced to the place they belong) after Cucumber Reports plugin step, as it should be used by job runned either solely or by pipeline.</p>

CC BY-SA 3.0
2017-06-11T04:52:01.717Z
Can you explain further? What export script?
lawnmowerlatte
CC BY-SA 3.0
2017-06-12T01:18:02.693Z
@lawnmowerlatte added to answer.
chupasaurus
CC BY-SA 3.0
2017-06-10T03:02:57.633Z
2017-06-12T01:17:17.290Z
2017-06-12T01:17:17.290Z
chupasaurus
<p>Working off what @chupasaurus said, here's what I came up with:</p>

<pre><code>node('master') {
    dir("../builds/${BUILD_NUMBER}/") {
        sh "cp -r cucumber-html-reports $WORKSPACE"
    }

    archive "cucumber-html-reports/*"
}
</code></pre>

<p>Obviously all this does is archive the report for that build, but you can easily extend this to copy it somewhere else where it can be hosted or manipulated. Just make sure you put this after the Cucumber Reports plugin step.</p>

CC BY-SA 3.0
2017-06-13T16:54:44.800Z
2017-06-13T16:54:44.800Z
lawnmowerlatte
<p>I'm using the Cucumber Reports Plugin for Jenkins and I want to be able to export the HTML reports so they can be posted on an external portal. I can see that there is a folder named <code>cucumber-html-reports</code> in the build directory in Jenkins, but how do I access this? Is there some way to access these files from within a pipeline?</p>

CC BY-SA 4.0
2019-03-12T03:44:42.987Z
@AnkitSuhane That script is a Jenkins scripted pipeline (https://jenkins.io/doc/book/pipeline/syntax/#scripted-pipeline), but it could be executed as a Shell step and an Archive step in a regular freestyle build.
lawnmowerlatte
CC BY-SA 4.0
2019-01-17T16:15:10.217Z
Many Thanks for your response.
May I know how to execute this code as in whether i have to feed it in jenkins job or i have to create a file with any specific extension and run? node('master') { dir("../builds/${BUILD_NUMBER}/") { sh "cp -r cucumber-html-reports $WORKSPACE" } archive "cucumber-html-reports/*" } Please help
Ankit Suhane
<jenkins><jenkins-plugins><testing><jenkins-pipeline>
How to export Cucumber Reports via Jenkins Pipeline
lawnmowerlatte
# How to export Cucumber Reports via Jenkins Pipeline

(Asked by: username_0 on 2017-06-09)

I'm using the Cucumber Reports Plugin for Jenkins and I want to be able to export the HTML reports so they can be posted on an external portal. I can see that there is a folder named `cucumber-html-reports` in the build directory in Jenkins, but how do I access this? Is there some way to access these files from within a pipeline?

**Tags:** jenkins, jenkins-plugins, testing, jenkins-pipeline

> **Comments:**
> **username_1**: Many Thanks for your response. May I know how to execute this code as in whether i have to feed it in jenkins job or i have to create a file with any specific extension and run? node('master') { dir("../builds/${BUILD_NUMBER}/") { sh "cp -r cucumber-html-reports $WORKSPACE" } archive "cucumber-html-reports/*" } Please help  
> **username_0**: @AnkitSuhane That script is a Jenkins scripted pipeline (https://jenkins.io/doc/book/pipeline/syntax/#scripted-pipeline), but it could be executed as a Shell step and an Archive step in a regular freestyle build.  

---

## 2 answers

### Answer by username_0 on 2017-06-13. Score: 3 | Accepted answer

Working off what @username_2 said, here's what I came up with:
node('master') {
    dir("../builds/${BUILD_NUMBER}/") {
        sh "cp -r cucumber-html-reports $WORKSPACE"
    }

    archive "cucumber-html-reports/*"
}

Obviously all this does is archive the report for that build, but you can easily extend this to copy it somewhere else where it can be hosted or manipulated. Just make sure you put this after the Cucumber Reports plugin step.


---

### Answer by username_2 on 2017-06-10. Score: 1

You should add export script (bash script which does exporting html files produced to the place they belong) after Cucumber Reports plugin step, as it should be used by job runned either solely or by pipeline.

> **Comments:**
> **username_0**: Can you explain further? What export script?  
> **username_2**: @username_0 added to answer.  

---

