I have a freestyle project in Jenkins to run Playwright functional tests. During the build execute shell step, I execute some Playwright functional tests. I have a setup locally that will give me the Playwright test report file playwright-report/index.html with this config:
// playwright.config.js
// #ts-check
/** #type {import('#playwright/test').PlaywrightTestConfig} */
const config = {
reporter: [['html', {
open: 'never',
host: '0.0.0.0',
port: 9223,
}]],
};
module.exports = config;
I am able to open and view this file locally but I am trying to figure out how to get this file on Jenkins Job. During the build running, I was able to verify that the file playwright-report/index.html does get created by printing out the directory withpwd, which returns root/run . So my root/run looks like this :
file-A.js
file-B.js
//...other folders
playwright-report
And when I cd playwright-report, I do see index.html file. However, all of the files, folders under root/run get archived after build, except for my playwright-report folder.
My post-build archive artifacts set up is '**/.' so I expect Jenkins to archive everything. My understanding is archive artifacts step copies the selected artifacts in the %JENKINS_HOME%/jons/MY_JOB/builds... on the master server. And it will only archive files under my WORKSPACE. Is this correct ?
So I am not sure why only my playwright-report folder is deleted after the build and it is not archived. I tried to create a folder playwright-dupe during the build and then copy playwright-report to playwright-dupe during the build, but neither playwright-dupe nor playwright-folder is archived.
So I think the directory root/run is different from the directory WORKSPACE ? I can't find any documentation about copying a folder from root/run and put it in WORKSPACE.
Can someone help me please ? My goal is to figure out how to access that index.html file Playwright report generates on Jenkins with each Jenkin jobs to build functional tests. Thank you
My environment variables:
JENKINS_HOME: var/lib/jenkins
pwd: /home/jenkins/agent
WORKSPACE: home/jenkins/agent/workspace/<project-name>
So to sum up I tried:
Create a duplicate folder and copy the result playwright-report over during build step
Change archive set up todist/**, home/jenkins/agent/workspace/<project-name>/**/*.*, **/playwright-dupe
Related
I have a file in some folder on my computer that i want to add to the jenkins pipeline build folder before testing stage, without addind this file to the repository. is there a way to do that? this file is a config.yaml that contains a relevant version.
thanks
When I run my tests in my local machine, report file is always created/overwritten in: C:\Temp\myLocalFolder\target\site\serenity\index.html
But when I run my tests using Jenkins(localhost:8080), report file is Not being generated in: C:\Users\me\.jenkins\workspace\myJenkinsFolder\target\site\serenity
In Jenkins, I've already added the Thucydides plugin, added it in Post-Build Actions, and set Report Path to target/site/serenity. I tried copying the index.html from my local folder to the jenkins folder, and after running I can view the same report. However I want it to be overwritten by the latest run on Jenkins. Any ideas?
Apprarently I just had to set Report Path in Jenkins to the same directory as my local folder (C:\Temp\myLocalFolder\target\site\serenity\index.html). I'm not sure if that's the correct approach. It won't work if I run from my online github repository. I will try that one next.
Is it possible to configure Jenkins to get source code into a subdirectory of a %WORKSPACE%? Right now the source gets pulled into %WORKSPACE% and for the build output I explicitly specify a directory outside of the %WORKSPACE%.
Ideally I would like to have something similar to this:
%WORKSPACE%\source for source code and %WORKSPACE%\artifacts for build outputs. Is it possible to have this configuration?
Create a 'run batch command' build step and use xcopy, this is presuming jenkins is running on a Windows machine, if it's a deployment directory then make it a post build step.
cd c:/
xcopy /Y "c:/program files 86/junkies/workspace/app" "c:/path to new directory"
This is just a guess at your directories, replace with correct ones, the /Y forces it to be overwritten every time it's copied.
Im trying to setup jenkins in my company and Ive got some problems.
Im using this commands to build the project:
SET MSBuild="C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe"
SET BUILDS=C:\Program Files (x86)\Jenkins\jobs\xxx\builds\
SET OUTPUT_PATH="%BUILDS%%BUILD_NUMBER%"
SET RSVARS="C:\Program Files (x86)\Embarcadero\RAD Studio\10.0\bin\rsvars.bat"
CALL %RSVARS%
SET PATH=%PATH%;D:\komponenty\DXE3\ADSI
%MSBuild% xxx.dproj /t:Build /p:Config=Debug;Platform=Win32;DCC_ExeOutput=%OUTPUT_PATH% /maxcpucount:4
It works fine when i type this in cmd but. I gave administrive privileges to jenkins service. When I try to build project with jenkins i receive error like this:
F1026: File not found: 'ADSI.dcu
this is a component for Delphi and i have this component on second partition. Jenkins has access for many components on this partition but not for this one.
The difference between the two will be your current directory.
Jenkins will start you off in a specific working folder for the job (possibly C:\Users\<User-ID>\.jenkins\jobs\<Job-Name>\workspace).
Add the following to your Jenkins commands to see where you're doing the build from:
echo Current Folder: %cd%
A simple "solution" would be to just add a command in Jenkins to change directory to the same folder you're in when you test from the command-line.
However, I suggest you rather do the following:
Ensure Jenkins gets the latest source from your source repository into its working folder. (There are various plugins depending on what particular tool you use.)
Ensure you cd (change directory) to the correct folder within the workspace folder.
I have a multi-configuration Jenkins job which runs my tests in parallel on multiple slave nodes. I want to collect some artifacts from those slave builds back on the master, and then run a post build step to build a custom HTML page from them.
I have everything set up so those files appear to be copied back onto the master, but then I can't seem to access them. Does anybody have a working example of this configuration that they can share?
Here's the job configuration of the matrix axes:
and the build, which just creates a tmp.txt file:
and fingerprint, archiving artifacts and then post build step to copy that file back to the master:
The slave Console Output says the copy succeeded (and we can see from the plugin source code that any error would be reported - and I've definitely seen these errors getting logged when things go wrong):
17:39:23 [copy-to-slave] Copying '**/tmp.txt', excluding nothing, from 'file:/scratch/jenkins/workspace/Test%20Matrix%20Build%202/label/android/node_index/1/' on 'com.cloudbees.jenkins.plugins.mtslavescloud.MansionSlave#c9964fd8' to 'file:/home/<myaccount>/hudson_home/workspace/Test%20Matrix%20Build%202/label/android/node_index/1/' on the master.
However, I can't seem to access those files from a Post Build script running on the master:
17:39:24 + cat label/android/node_index/1/tmp.txt
17:39:24 cat: label/android/node_index/1/tmp.txt: No such file or directory
The files seem to be listed in the Workspace of the master:
I tried versions of the same command using the $WORKSPACE environment variable and they didn't work either, e.g.
20:40:13 + cat '/scratch/jenkins/workspace/Test Matrix Build 2/label/android/node_index/1/tmp.txt'
20:40:13 cat: /scratch/jenkins/workspace/Test Matrix Build 2/label/android/node_index/1/tmp.txt: No such file or directory
...and since "ws" was in the URL I tried adding that in as well (also didn't work):
20:42:51 + cat '/scratch/jenkins/workspace/Test Matrix Build 2/ws/label/android/node_index/1/tmp.txt'
20:42:51 cat: /scratch/jenkins/workspace/Test Matrix Build 2/ws/label/android/node_index/1/tmp.txt: No such file or directory