jenkins - archive artifacts ‘*’ doesn’t match anything - jenkins

I'm trying to set up a step to archive artifacts and I want to archive everything however specifying * does not work. Jenkins comes up with
‘*’ doesn’t match anything
if I run the job regardless the job fails and logs show:
ERROR: No artifacts found that match the file pattern "". Configuration error?
ERROR: ‘’ doesn’t match anything
I tried using ** too but that came back with the same errors

Here is what to check for:
archive artifacts will only work in the workspace and fails outside
the path should be a relative path in the workspace and doesnt start with "." :
archiveArtifacts artifacts: "build/**"
archiveArtifacts artifacts: "./build/**" // Fails
archiveArtifacts artifacts: "$workspace/build/**" // Fails
" *" matches any file in the directory, ** will match everything including dir and subdirectories, **/.log will matches all files in all subdirectories with potfix
depending on if it s a windows or linux node, you will want to express your path differently

If you run Jenkins on Windows host, you must use *.* for everything

* only matches any files in workspace, if the artifacts you want to archive is in some subdirectories, you need the pattern like **/*.sh to match all files in all subdirectories with postfix .sh.

Related

How to get Playwright test result index.html on Jenkins

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

jenkins doesn't find path **/* when Archiving artifacts

i want to archive the artifacts in the path '**/*' but i'm getting the error:
‘**/*’ doesn’t match anything: ‘**’ exists but not ‘**/*’
under workspace i have a folder named 'build' and that folder contains the file that should be archived
from what i understand '**' should go to the build folder and the '*' should get the file
i tried use backslash('\') instead or **/. or **//* none of these worked, also when i try build/* it says build doesn't exist
console output:
Archiving artifacts
‘**/*’ doesn’t match anything: ‘**’ exists but not ‘**/*’
No artifacts found that match the file pattern "**/*". Configuration error?
update:
i found out that the workspace that it's trying to access isn't on the Jenkins server but on another server that the test is connecting using 'SSH site'.
how do i fix this?
assuming that you said the folder name under you project called build that you want all files under it to archive it use:
build/*.*

Jenkins - failed: No test report files were found. Configuration error?

I'm beginner for "Jenkins" and following this tutorial.
At the Sixth step I got below error.
xcodebuild: error: Scheme JenkinsTest is not currently configured for the test action.
Build step 'Xcode' marked build as failure
Recording test results
ERROR: Step ‘Publish JUnit test result report’ failed: No test report files were found. Configuration error?
Finished: FAILURE
In the Test report XMLs I did set "test-reports/.*xml"
I tried to find my solution and also many questions are founded on SO like same issue I have too but did not get solution.
I have some confusion, Is .xml file automatically generated by "Jenkins" or First we manually need to add .xml file ?
In short guide me on right direction based on above error.
You can also enable the 'allowEmptyResults' option so that the junit plugin won't throw an exception when it doesn't find test results.
This way it doesn't matter if the 'test-results' directory exists.
junit allowEmptyResults: true, testResults: '**/test-results/*.xml'
First make sure junit.xml is getting generated after the test run.
Jenkins job at times cannot see past the current workspace. so it is always a good idea to copy the reports back to the current workspace before using it.
cd <path to report>
cp *.xml $WORKSPACE
Now the jenkins should pick-up the report.
Note: The config may show error first(since it cannot find the xml file in workspace) but after a build this should go away and also the result should get recorded
I'm using nosetest (python) to generate an xUnit compatible file and I was getting:
ERROR: No test report files were found. Configuration error?
I was using junit plugin as:
junit "test-results-unit.xml"
junit seems to add WORKSPACE directory by default so using the full PATH to the file wouldn't work either. I created symlink from the resulting file to the WORKSPACE directory to make it work:
sh 'ln -s tests/test-results-unit.xml $WORKSPACE'
junit "test-results-unit.xml"
Other answers suggest copying the files to the workspace directory, but for me simply changing the path to start with '**' seemed to solve the issue
junit '**/test-reports/*.xml'
The Jenkins junit plugin page says that you need to "specify the path to JUnit XML files in the Ant glob syntax". I've not dug into the full details of what this means, but starting the path with '**' was enough to get it working for me.
Thanks #Acid, it really helped me.
First, copy the module/build/test-results to workspace directory
cp -r app/build/test-results $WORKSPACE/test-results
And then I used this wildcard path
**/test-results/**/*.xml
I had the same problem and my test report file name got changed due to an upgrade in scala version,
Hence I have to change from,
junit '/myworkspace/target/myreport.xml'
to
junit '/myworkspace/target/TEST-myreport.xml'
How about:
junit allowEmptyResults: true, testResults: "${WORKSPACE}/test-results/*.xml"
or just:
junit "${WORKSPACE}/test-results/*.xml"
You have to find the path where your test reports are saved in your .jenkins workspace:
/Users/<USERNAME/>/.jenkins/workspace/<PROJECT/>/target/surefire-reports/*.xml
to find the folder type in your terminal:
.jenkins
then
open .

failed archiving ipa files jenkins

I have a extrange problem,
when building the ios app with jenkins the ipa file is generated, and signed correctly but when I try to archive the ipa file it fails
the jenkins log says
Results at '/Users/Shared/Jenkins/Home/jobs/iosHelp/workspace/build/ipa/Verion.ipa'
[Debug-iphoneos] $ ditto -c -k --keepParent -rsrc /Users/Shared/Jenkins/Home/jobs/iosHelp/workspace/build/Debug-iphoneos/FormSlider.app.dSYM /Users/Shared/Jenkins/Home/jobs/iosHelp/workspace/build/ipa/Verion-dSYM.zip
Archiving artifacts
ERROR: No artifacts found that match the file pattern "/Users/Shared/Jenkins/Home/jobs/iosHelp/workspace/build/ipa/Verion.ipa". Configuration error?
ERROR: ‘/Users/Shared/Jenkins/Home/jobs/iosHelp/workspace/build/ipa/Verion.ipa’ doesn’t match anything: ‘’ exists but not ‘/Users/Shared/Jenkins/Home/jobs/iosHelp/workspace/build/ipa/Verion.ipa’
Build step 'Archive the artifacts' changed build result to FAILURE
Finished: FAILURE
clearly it states that jenkins couldn't find the ipa but in the statement before shows that the ipa was generated also using the terminal to go to the build/ipa directory I cheked that the file currently exists and is generated,
any help would be appreciated
What do you use in your "Archive Artifacts" configuration? It should be relative to $workspace, so in your case just build/ipa/Verion.ipa.
Make sure there are no extra quotes either
When you navigate to this job folder is there a file there? If you are using Ant blob syntax try adding a "*" at the end in case the file extension you wrote in is incorrect or instead of "build/ipa/Verion.ipa" use "build/ipa/Verion*" to try and locate the file, as #Slav mentioned use a path relative to the $workspace

Jenkins: How to copy files from a Matrix build back to the master and actually use them

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

Resources